diff options
-rw-r--r-- | arch/arm/mach-ep93xx/include/mach/gpio.h | 9 | ||||
-rw-r--r-- | drivers/gpio/gpio-ep93xx.c | 19 |
2 files changed, 19 insertions, 9 deletions
diff --git a/arch/arm/mach-ep93xx/include/mach/gpio.h b/arch/arm/mach-ep93xx/include/mach/gpio.h index 071f676c6e09..76c68faca943 100644 --- a/arch/arm/mach-ep93xx/include/mach/gpio.h +++ b/arch/arm/mach-ep93xx/include/mach/gpio.h | |||
@@ -99,14 +99,7 @@ | |||
99 | /* maximum value for irq capable line identifiers */ | 99 | /* maximum value for irq capable line identifiers */ |
100 | #define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7) | 100 | #define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7) |
101 | 101 | ||
102 | /* | 102 | #define gpio_to_irq __gpio_to_irq |
103 | * Map GPIO A0..A7 (0..7) to irq 64..71, | ||
104 | * B0..B7 (7..15) to irq 72..79, and | ||
105 | * F0..F7 (16..24) to irq 80..87. | ||
106 | */ | ||
107 | #define gpio_to_irq(gpio) \ | ||
108 | (((gpio) <= EP93XX_GPIO_LINE_MAX_IRQ) ? (64 + (gpio)) : -EINVAL) | ||
109 | |||
110 | #define irq_to_gpio(irq) ((irq) - gpio_to_irq(0)) | 103 | #define irq_to_gpio(irq) ((irq) - gpio_to_irq(0)) |
111 | 104 | ||
112 | #endif | 105 | #endif |
diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c index 72fb9c665320..fbd6a6066777 100644 --- a/drivers/gpio/gpio-ep93xx.c +++ b/drivers/gpio/gpio-ep93xx.c | |||
@@ -307,6 +307,21 @@ static int ep93xx_gpio_set_debounce(struct gpio_chip *chip, | |||
307 | return 0; | 307 | return 0; |
308 | } | 308 | } |
309 | 309 | ||
310 | /* | ||
311 | * Map GPIO A0..A7 (0..7) to irq 64..71, | ||
312 | * B0..B7 (7..15) to irq 72..79, and | ||
313 | * F0..F7 (16..24) to irq 80..87. | ||
314 | */ | ||
315 | static int ep93xx_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | ||
316 | { | ||
317 | int gpio = chip->base + offset; | ||
318 | |||
319 | if (gpio > EP93XX_GPIO_LINE_MAX_IRQ) | ||
320 | return -EINVAL; | ||
321 | |||
322 | return 64 + gpio; | ||
323 | } | ||
324 | |||
310 | static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev, | 325 | static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev, |
311 | void __iomem *mmio_base, struct ep93xx_gpio_bank *bank) | 326 | void __iomem *mmio_base, struct ep93xx_gpio_bank *bank) |
312 | { | 327 | { |
@@ -321,8 +336,10 @@ static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev, | |||
321 | bgc->gc.label = bank->label; | 336 | bgc->gc.label = bank->label; |
322 | bgc->gc.base = bank->base; | 337 | bgc->gc.base = bank->base; |
323 | 338 | ||
324 | if (bank->has_debounce) | 339 | if (bank->has_debounce) { |
325 | bgc->gc.set_debounce = ep93xx_gpio_set_debounce; | 340 | bgc->gc.set_debounce = ep93xx_gpio_set_debounce; |
341 | bgc->gc.to_irq = ep93xx_gpio_to_irq; | ||
342 | } | ||
326 | 343 | ||
327 | return gpiochip_add(&bgc->gc); | 344 | return gpiochip_add(&bgc->gc); |
328 | } | 345 | } |