All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] omap: mux: fix multipath gpio handling
@ 2010-07-05 20:06 Grazvydas Ignotas
  2010-07-06 13:25 ` Tony Lindgren
  2010-07-07 11:00 ` [APPLIED] " Tony Lindgren
  0 siblings, 2 replies; 4+ messages in thread
From: Grazvydas Ignotas @ 2010-07-05 20:06 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Grazvydas Ignotas

OMAP3530 CBB package can have GPIO126 muxed on 2 pins: mmc1_dat4 and
cam_strobe. This causes a problem with current multipath GPIO mux
handling, which muxes both pins as GPIO126 and makes the GPIO unusable.

Fix this by not muxing any pins if multipath GPIO is detected and
just print a warning instead. It's up to board files to set correct
mux using omap_mux_init_signal and pin name.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
 arch/arm/mach-omap2/mux.c |   38 ++++++++++++++++++++------------------
 1 files changed, 20 insertions(+), 18 deletions(-)

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)
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] omap: mux: fix multipath gpio handling
  2010-07-05 20:06 [PATCH] omap: mux: fix multipath gpio handling Grazvydas Ignotas
@ 2010-07-06 13:25 ` Tony Lindgren
  2010-07-06 13:54   ` Grazvydas Ignotas
  2010-07-07 11:00 ` [APPLIED] " Tony Lindgren
  1 sibling, 1 reply; 4+ messages in thread
From: Tony Lindgren @ 2010-07-06 13:25 UTC (permalink / raw)
  To: Grazvydas Ignotas; +Cc: linux-omap

* Grazvydas Ignotas <notasas@gmail.com> [100705 23:00]:
> OMAP3530 CBB package can have GPIO126 muxed on 2 pins: mmc1_dat4 and
> cam_strobe. This causes a problem with current multipath GPIO mux
> handling, which muxes both pins as GPIO126 and makes the GPIO unusable.
> 
> Fix this by not muxing any pins if multipath GPIO is detected and
> just print a warning instead. It's up to board files to set correct
> mux using omap_mux_init_signal and pin name.

This looks good to me. Are you OK if we merge it during the upcoming
merge window? Kind of worried that we might break some other boards
that rely on the first GPIO getting muxed..

Tony

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] omap: mux: fix multipath gpio handling
  2010-07-06 13:25 ` Tony Lindgren
@ 2010-07-06 13:54   ` Grazvydas Ignotas
  0 siblings, 0 replies; 4+ messages in thread
From: Grazvydas Ignotas @ 2010-07-06 13:54 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap

On Tue, Jul 6, 2010 at 4:25 PM, Tony Lindgren <tony@atomide.com> wrote:
> * Grazvydas Ignotas <notasas@gmail.com> [100705 23:00]:
>> OMAP3530 CBB package can have GPIO126 muxed on 2 pins: mmc1_dat4 and
>> cam_strobe. This causes a problem with current multipath GPIO mux
>> handling, which muxes both pins as GPIO126 and makes the GPIO unusable.
>>
>> Fix this by not muxing any pins if multipath GPIO is detected and
>> just print a warning instead. It's up to board files to set correct
>> mux using omap_mux_init_signal and pin name.
>
> This looks good to me. Are you OK if we merge it during the upcoming
> merge window? Kind of worried that we might break some other boards
> that rely on the first GPIO getting muxed..

Yeah that should be fine, no need to rush.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [APPLIED] [PATCH] omap: mux: fix multipath gpio handling
  2010-07-05 20:06 [PATCH] omap: mux: fix multipath gpio handling Grazvydas Ignotas
  2010-07-06 13:25 ` Tony Lindgren
@ 2010-07-07 11:00 ` Tony Lindgren
  1 sibling, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2010-07-07 11:00 UTC (permalink / raw)
  To: linux-omap

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: for-next

Initial commit ID (Likely to change): 916c48fbec05b4718b4fd447f634725ced6cc9e7

PatchWorks
http://patchwork.kernel.org/patch/110284/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=916c48fbec05b4718b4fd447f634725ced6cc9e7



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-07-07 11:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-05 20:06 [PATCH] omap: mux: fix multipath gpio handling Grazvydas Ignotas
2010-07-06 13:25 ` Tony Lindgren
2010-07-06 13:54   ` Grazvydas Ignotas
2010-07-07 11:00 ` [APPLIED] " Tony Lindgren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.