summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorGrazvydas Ignotas <notasas@gmail.com>2010-08-02 13:18:28 +0300
committerTony Lindgren <tony@atomide.com>2010-08-02 14:23:07 +0300
commit8a6f7e14fc3b3ea911838c3f4ce137cb8a3d134a (patch)
treef8da6e446475d300661936711c720fef706e6f29 /arch/arm
parent7d35b8d09fb0cb0a89c8c265a5bfb52c2867b1d5 (diff)
downloadlinux-3.10-8a6f7e14fc3b3ea911838c3f4ce137cb8a3d134a.tar.gz
linux-3.10-8a6f7e14fc3b3ea911838c3f4ce137cb8a3d134a.tar.bz2
linux-3.10-8a6f7e14fc3b3ea911838c3f4ce137cb8a3d134a.zip
omap: mux: fix multipath gpio handling
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> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/mux.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index be52fabf6dc..ab403b2ed26 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)