diff options
-rw-r--r-- | 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 be52fabf6dc0..ab403b2ed26b 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -87,6 +87,9 @@ static char *omap_mux_options; | |||
87 | int __init omap_mux_init_gpio(int gpio, int val) | 87 | int __init omap_mux_init_gpio(int gpio, int val) |
88 | { | 88 | { |
89 | struct omap_mux_entry *e; | 89 | struct omap_mux_entry *e; |
90 | struct omap_mux *gpio_mux; | ||
91 | u16 old_mode; | ||
92 | u16 mux_mode; | ||
90 | int found = 0; | 93 | int found = 0; |
91 | 94 | ||
92 | if (!gpio) | 95 | if (!gpio) |
@@ -95,34 +98,33 @@ int __init omap_mux_init_gpio(int gpio, int val) | |||
95 | list_for_each_entry(e, &muxmodes, node) { | 98 | list_for_each_entry(e, &muxmodes, node) { |
96 | struct omap_mux *m = &e->mux; | 99 | struct omap_mux *m = &e->mux; |
97 | if (gpio == m->gpio) { | 100 | if (gpio == m->gpio) { |
98 | u16 old_mode; | 101 | gpio_mux = m; |
99 | u16 mux_mode; | ||
100 | |||
101 | old_mode = omap_mux_read(m->reg_offset); | ||
102 | mux_mode = val & ~(OMAP_MUX_NR_MODES - 1); | ||
103 | if (omap_mux_flags & MUXABLE_GPIO_MODE3) | ||
104 | mux_mode |= OMAP_MUX_MODE3; | ||
105 | else | ||
106 | mux_mode |= OMAP_MUX_MODE4; | ||
107 | printk(KERN_DEBUG "mux: Setting signal " | ||
108 | "%s.gpio%i 0x%04x -> 0x%04x\n", | ||
109 | m->muxnames[0], gpio, old_mode, mux_mode); | ||
110 | omap_mux_write(mux_mode, m->reg_offset); | ||
111 | found++; | 102 | found++; |
112 | } | 103 | } |
113 | } | 104 | } |
114 | 105 | ||
115 | if (found == 1) | 106 | if (found == 0) { |
116 | return 0; | 107 | printk(KERN_ERR "mux: Could not set gpio%i\n", gpio); |
108 | return -ENODEV; | ||
109 | } | ||
117 | 110 | ||
118 | if (found > 1) { | 111 | if (found > 1) { |
119 | printk(KERN_ERR "mux: Multiple gpio paths for gpio%i\n", gpio); | 112 | printk(KERN_INFO "mux: Multiple gpio paths (%d) for gpio%i\n", |
113 | found, gpio); | ||
120 | return -EINVAL; | 114 | return -EINVAL; |
121 | } | 115 | } |
122 | 116 | ||
123 | printk(KERN_ERR "mux: Could not set gpio%i\n", gpio); | 117 | old_mode = omap_mux_read(gpio_mux->reg_offset); |
118 | mux_mode = val & ~(OMAP_MUX_NR_MODES - 1); | ||
119 | if (omap_mux_flags & MUXABLE_GPIO_MODE3) | ||
120 | mux_mode |= OMAP_MUX_MODE3; | ||
121 | else | ||
122 | mux_mode |= OMAP_MUX_MODE4; | ||
123 | printk(KERN_DEBUG "mux: Setting signal %s.gpio%i 0x%04x -> 0x%04x\n", | ||
124 | gpio_mux->muxnames[0], gpio, old_mode, mux_mode); | ||
125 | omap_mux_write(mux_mode, gpio_mux->reg_offset); | ||
124 | 126 | ||
125 | return -ENODEV; | 127 | return 0; |
126 | } | 128 | } |
127 | 129 | ||
128 | int __init omap_mux_init_signal(char *muxname, int val) | 130 | int __init omap_mux_init_signal(char *muxname, int val) |