From patchwork Thu Jul 8 13:54:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 110847 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o68DtAJK015682 for ; Thu, 8 Jul 2010 13:55:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757910Ab0GHNy6 (ORCPT ); Thu, 8 Jul 2010 09:54:58 -0400 Received: from mho-02-ewr.mailhop.org ([204.13.248.72]:55904 "EHLO mho-02-ewr.mailhop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757859Ab0GHNy5 (ORCPT ); Thu, 8 Jul 2010 09:54:57 -0400 Received: from muru.com ([72.249.23.125] helo=baageli.muru.com) by mho-02-ewr.mailhop.org with esmtpa (Exim 4.68) (envelope-from ) id 1OWrZ3-0007mw-1b; Thu, 08 Jul 2010 13:54:57 +0000 X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 72.249.23.125 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/mailhop/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/G4wSPiSdNWrsT/lVCwXN9 Subject: [PATCH 08/13] omap: mux: fix multipath gpio handling To: linux-arm-kernel@lists.infradead.org From: Tony Lindgren Cc: linux-omap@vger.kernel.org, Grazvydas Ignotas Date: Thu, 08 Jul 2010 16:54:55 +0300 Message-ID: <20100708135455.26276.13094.stgit@baageli.muru.com> In-Reply-To: <20100708135342.26276.80936.stgit@baageli.muru.com> References: <20100708135342.26276.80936.stgit@baageli.muru.com> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 08 Jul 2010 13:55:10 +0000 (UTC) diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index be52fab..ab403b2 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c @@ -87,6 +87,9 @@ static char *omap_mux_options; int __init omap_mux_init_gpio(int gpio, int val) { struct omap_mux_entry *e; + struct omap_mux *gpio_mux; + u16 old_mode; + u16 mux_mode; int found = 0; if (!gpio) @@ -95,34 +98,33 @@ int __init omap_mux_init_gpio(int gpio, int val) list_for_each_entry(e, &muxmodes, node) { struct omap_mux *m = &e->mux; if (gpio == m->gpio) { - u16 old_mode; - u16 mux_mode; - - old_mode = omap_mux_read(m->reg_offset); - mux_mode = val & ~(OMAP_MUX_NR_MODES - 1); - if (omap_mux_flags & MUXABLE_GPIO_MODE3) - mux_mode |= OMAP_MUX_MODE3; - else - mux_mode |= OMAP_MUX_MODE4; - printk(KERN_DEBUG "mux: Setting signal " - "%s.gpio%i 0x%04x -> 0x%04x\n", - m->muxnames[0], gpio, old_mode, mux_mode); - omap_mux_write(mux_mode, m->reg_offset); + gpio_mux = m; found++; } } - if (found == 1) - return 0; + if (found == 0) { + printk(KERN_ERR "mux: Could not set gpio%i\n", gpio); + return -ENODEV; + } if (found > 1) { - printk(KERN_ERR "mux: Multiple gpio paths for gpio%i\n", gpio); + printk(KERN_INFO "mux: Multiple gpio paths (%d) for gpio%i\n", + found, gpio); return -EINVAL; } - printk(KERN_ERR "mux: Could not set gpio%i\n", gpio); + old_mode = omap_mux_read(gpio_mux->reg_offset); + mux_mode = val & ~(OMAP_MUX_NR_MODES - 1); + if (omap_mux_flags & MUXABLE_GPIO_MODE3) + mux_mode |= OMAP_MUX_MODE3; + else + mux_mode |= OMAP_MUX_MODE4; + printk(KERN_DEBUG "mux: Setting signal %s.gpio%i 0x%04x -> 0x%04x\n", + gpio_mux->muxnames[0], gpio, old_mode, mux_mode); + omap_mux_write(mux_mode, gpio_mux->reg_offset); - return -ENODEV; + return 0; } int __init omap_mux_init_signal(char *muxname, int val)