diff options
Diffstat (limited to 'arch/arm/mach-pxa/include/mach/gpio.h')
-rw-r--r-- | arch/arm/mach-pxa/include/mach/gpio.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h index b024a8b37439..c4639502efca 100644 --- a/arch/arm/mach-pxa/include/mach/gpio.h +++ b/arch/arm/mach-pxa/include/mach/gpio.h | |||
@@ -99,11 +99,24 @@ | |||
99 | #define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2)) | 99 | #define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2)) |
100 | 100 | ||
101 | 101 | ||
102 | #define NR_BUILTIN_GPIO 128 | 102 | #define NR_BUILTIN_GPIO PXA_GPIO_IRQ_NUM |
103 | 103 | ||
104 | #define gpio_to_bank(gpio) ((gpio) >> 5) | 104 | #define gpio_to_bank(gpio) ((gpio) >> 5) |
105 | #define gpio_to_irq(gpio) IRQ_GPIO(gpio) | 105 | #define gpio_to_irq(gpio) IRQ_GPIO(gpio) |
106 | #define irq_to_gpio(irq) IRQ_TO_GPIO(irq) | 106 | |
107 | static inline int irq_to_gpio(unsigned int irq) | ||
108 | { | ||
109 | int gpio; | ||
110 | |||
111 | if (irq == IRQ_GPIO0 || irq == IRQ_GPIO1) | ||
112 | return irq - IRQ_GPIO0; | ||
113 | |||
114 | gpio = irq - PXA_GPIO_IRQ_BASE; | ||
115 | if (gpio >= 2 && gpio < NR_BUILTIN_GPIO) | ||
116 | return gpio; | ||
117 | |||
118 | return -1; | ||
119 | } | ||
107 | 120 | ||
108 | #ifdef CONFIG_CPU_PXA26x | 121 | #ifdef CONFIG_CPU_PXA26x |
109 | /* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted, | 122 | /* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted, |