From: Michael Hennerich Date: Sat, 17 May 2008 08:01:51 +0000 (+0800) Subject: Blackfin arch: Add workaround to read edge triggered GPIOs X-Git-Tag: v2.6.26-rc4~118^2~8 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=803a8d2acbf220aeb27f0a98dacb36d4af3d6559;p=linux-2.6 Blackfin arch: Add workaround to read edge triggered GPIOs Signed-off-by: Michael Hennerich Signed-off-by: Bryan Wu --- diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c index 7e8eaf4a31..b6d89d1644 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c @@ -1130,6 +1130,25 @@ void bfin_gpio_irq_prepare(unsigned gpio) #else +int gpio_get_value(unsigned gpio) +{ + unsigned long flags; + int ret; + + if (unlikely(get_gpio_edge(gpio))) { + local_irq_save(flags); + set_gpio_edge(gpio, 0); + ret = get_gpio_data(gpio); + set_gpio_edge(gpio, 1); + local_irq_restore(flags); + + return ret; + } else + return get_gpio_data(gpio); +} +EXPORT_SYMBOL(gpio_get_value); + + int gpio_direction_input(unsigned gpio) { unsigned long flags; diff --git a/include/asm-blackfin/gpio.h b/include/asm-blackfin/gpio.h index 27ff532a80..ff95e9d883 100644 --- a/include/asm-blackfin/gpio.h +++ b/include/asm-blackfin/gpio.h @@ -437,7 +437,6 @@ void gpio_set_value(unsigned gpio, int arg); int gpio_get_value(unsigned gpio); #ifndef BF548_FAMILY -#define gpio_get_value(gpio) get_gpio_data(gpio) #define gpio_set_value(gpio, value) set_gpio_data(gpio, value) #endif