diff options
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r-- | arch/arm/plat-omap/gpio.c | 9 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/gpio.h | 16 |
2 files changed, 21 insertions, 4 deletions
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 8ff225bb1e46..e07ab233e783 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c | |||
@@ -1285,6 +1285,14 @@ static void gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
1285 | spin_unlock_irqrestore(&bank->lock, flags); | 1285 | spin_unlock_irqrestore(&bank->lock, flags); |
1286 | } | 1286 | } |
1287 | 1287 | ||
1288 | static int gpio_2irq(struct gpio_chip *chip, unsigned offset) | ||
1289 | { | ||
1290 | struct gpio_bank *bank; | ||
1291 | |||
1292 | bank = container_of(chip, struct gpio_bank, chip); | ||
1293 | return bank->virtual_irq_start + offset; | ||
1294 | } | ||
1295 | |||
1288 | /*---------------------------------------------------------------------*/ | 1296 | /*---------------------------------------------------------------------*/ |
1289 | 1297 | ||
1290 | static int initialized; | 1298 | static int initialized; |
@@ -1480,6 +1488,7 @@ static int __init _omap_gpio_init(void) | |||
1480 | bank->chip.get = gpio_get; | 1488 | bank->chip.get = gpio_get; |
1481 | bank->chip.direction_output = gpio_output; | 1489 | bank->chip.direction_output = gpio_output; |
1482 | bank->chip.set = gpio_set; | 1490 | bank->chip.set = gpio_set; |
1491 | bank->chip.to_irq = gpio_2irq; | ||
1483 | if (bank_is_mpuio(bank)) { | 1492 | if (bank_is_mpuio(bank)) { |
1484 | bank->chip.label = "mpuio"; | 1493 | bank->chip.label = "mpuio"; |
1485 | #ifdef CONFIG_ARCH_OMAP16XX | 1494 | #ifdef CONFIG_ARCH_OMAP16XX |
diff --git a/arch/arm/plat-omap/include/mach/gpio.h b/arch/arm/plat-omap/include/mach/gpio.h index 98e9008b7e9d..5f996f350c84 100644 --- a/arch/arm/plat-omap/include/mach/gpio.h +++ b/arch/arm/plat-omap/include/mach/gpio.h | |||
@@ -109,16 +109,24 @@ static inline int gpio_cansleep(unsigned gpio) | |||
109 | 109 | ||
110 | static inline int gpio_to_irq(unsigned gpio) | 110 | static inline int gpio_to_irq(unsigned gpio) |
111 | { | 111 | { |
112 | if (gpio < (OMAP_MAX_GPIO_LINES + 16)) | 112 | return __gpio_to_irq(gpio); |
113 | return OMAP_GPIO_IRQ(gpio); | ||
114 | return -EINVAL; | ||
115 | } | 113 | } |
116 | 114 | ||
117 | static inline int irq_to_gpio(unsigned irq) | 115 | static inline int irq_to_gpio(unsigned irq) |
118 | { | 116 | { |
117 | int tmp; | ||
118 | |||
119 | /* omap1 SOC mpuio */ | ||
119 | if (cpu_class_is_omap1() && (irq < (IH_MPUIO_BASE + 16))) | 120 | if (cpu_class_is_omap1() && (irq < (IH_MPUIO_BASE + 16))) |
120 | return (irq - IH_MPUIO_BASE) + OMAP_MAX_GPIO_LINES; | 121 | return (irq - IH_MPUIO_BASE) + OMAP_MAX_GPIO_LINES; |
121 | return irq - IH_GPIO_BASE; | 122 | |
123 | /* SOC gpio */ | ||
124 | tmp = irq - IH_GPIO_BASE; | ||
125 | if (tmp < OMAP_MAX_GPIO_LINES) | ||
126 | return tmp; | ||
127 | |||
128 | /* we don't supply reverse mappings for non-SOC gpios */ | ||
129 | return -EIO; | ||
122 | } | 130 | } |
123 | 131 | ||
124 | #endif | 132 | #endif |