[Blackfin] arch:Fix BUG [#3876] pfbutton test for BTN3 on bf533 don't show complete...
authorMichael Hennerich <michael.hennerich@analog.com>
Sat, 2 Feb 2008 08:17:52 +0000 (16:17 +0800)
committerBryan Wu <bryan.wu@analog.com>
Sat, 2 Feb 2008 08:17:52 +0000 (16:17 +0800)
 - Buttons on the BF533-STAMP board are not inverted
 - Fix spurious GPIO Interrupt caused during set irq_type for edge triggered interrupts

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
arch/blackfin/mach-bf533/boards/stamp.c
arch/blackfin/mach-common/ints-priority.c

index 0185350feacc165768899bd959a4cd946549a53b..41ec72f8a08ca0754b6cb1edd509dc1105be9c8f 100644 (file)
@@ -423,9 +423,9 @@ static struct platform_device bfin_pata_device = {
 #include <linux/gpio_keys.h>
 
 static struct gpio_keys_button bfin_gpio_keys_table[] = {
-       {BTN_0, GPIO_PF5, 1, "gpio-keys: BTN0"},
-       {BTN_1, GPIO_PF6, 1, "gpio-keys: BTN1"},
-       {BTN_2, GPIO_PF8, 1, "gpio-keys: BTN2"},
+       {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"},
+       {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"},
+       {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"},
 };
 
 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
index 81d00183ae91ee23f849471a4f543b7b92e7d023..880595afe98da61b2ade7323701b17de6b4070b6 100644 (file)
@@ -430,16 +430,8 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
                return 0;
        }
 
+       set_gpio_inen(gpionr, 0);
        set_gpio_dir(gpionr, 0);
-       set_gpio_inen(gpionr, 1);
-
-       if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
-               gpio_edge_triggered[gpio_bank(gpionr)] |= gpio_bit(gpionr);
-               set_gpio_edge(gpionr, 1);
-       } else {
-               set_gpio_edge(gpionr, 0);
-               gpio_edge_triggered[gpio_bank(gpionr)] &= ~gpio_bit(gpionr);
-       }
 
        if ((type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING))
            == (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING))
@@ -452,6 +444,18 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
        else
                set_gpio_polar(gpionr, 0);      /* high or rising edge denoted by zero */
 
+       if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
+               set_gpio_edge(gpionr, 1);
+               set_gpio_inen(gpionr, 1);
+               gpio_edge_triggered[gpio_bank(gpionr)] |= gpio_bit(gpionr);
+               set_gpio_data(gpionr, 0);
+
+       } else {
+               set_gpio_edge(gpionr, 0);
+               gpio_edge_triggered[gpio_bank(gpionr)] &= ~gpio_bit(gpionr);
+               set_gpio_inen(gpionr, 1);
+       }
+
        SSYNC();
 
        if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING))