aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2009-02-04 03:49:45 -0500
committerBryan Wu <cooloney@kernel.org>2009-02-04 03:49:45 -0500
commita2be3931144b8fab73c3d876c148ada7a3c09066 (patch)
tree9a69e48cfa69c2b1191299e3493a3b2416753ed3
parent5e7bb132bbed2088b8b103e410d143b341dcb837 (diff)
Blackfin arch: reset POLAR setting when acquiring a gpio for the first time
when requesting a GPIO for the first time, the POLAR setting is not set to a sane state. this can lead to indeterminate behavior that cannot be resolved without an explicit write to the Blackfin port POLAR register. when requesting a GPIO for the first time via gpio_request(), the POLAR setting for the GPIO in question should be set to sane state. this should occur if the GPIO has not been allocated in any other way. some examples: - when doing something like "request_irq(); gpio_request();" on the same GPIO, the POLAR setting should not be reset. - when doing "gpio_request(); gpio_request();" on the same GPIO, the POLAR setting should be reset only the first time and not the second. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
-rw-r--r--arch/blackfin/kernel/bfin_gpio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c
index ea67ae5b033e..0c4fc31029c2 100644
--- a/arch/blackfin/kernel/bfin_gpio.c
+++ b/arch/blackfin/kernel/bfin_gpio.c
@@ -1053,9 +1053,15 @@ int bfin_gpio_request(unsigned gpio, const char *label)
1053 local_irq_restore_hw(flags); 1053 local_irq_restore_hw(flags);
1054 return -EBUSY; 1054 return -EBUSY;
1055 } 1055 }
1056 if (unlikely(reserved_gpio_irq_map[gpio_bank(gpio)] & gpio_bit(gpio))) 1056 if (unlikely(reserved_gpio_irq_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
1057 printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!" 1057 printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!"
1058 " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio); 1058 " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio);
1059 }
1060#ifndef BF548_FAMILY
1061 else { /* Reset POLAR setting when acquiring a gpio for the first time */
1062 set_gpio_polar(gpio, 0);
1063 }
1064#endif
1059 1065
1060 reserved_gpio_map[gpio_bank(gpio)] |= gpio_bit(gpio); 1066 reserved_gpio_map[gpio_bank(gpio)] |= gpio_bit(gpio);
1061 set_label(gpio, label); 1067 set_label(gpio, label);