ARM: 7041/1: gpio-ep93xx: hookup the to_irq callback in the driver
Remove the ep93xx machine specific dependencies for gpio_to_irq() by hooking up the callback in the driver and using __gpio_to_irq. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
committed by
Russell King
parent
5f3fcf9649
commit
257af9f972
@@ -99,14 +99,7 @@
|
|||||||
/* maximum value for irq capable line identifiers */
|
/* maximum value for irq capable line identifiers */
|
||||||
#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7)
|
#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7)
|
||||||
|
|
||||||
/*
|
#define gpio_to_irq __gpio_to_irq
|
||||||
* Map GPIO A0..A7 (0..7) to irq 64..71,
|
|
||||||
* B0..B7 (7..15) to irq 72..79, and
|
|
||||||
* F0..F7 (16..24) to irq 80..87.
|
|
||||||
*/
|
|
||||||
#define gpio_to_irq(gpio) \
|
|
||||||
(((gpio) <= EP93XX_GPIO_LINE_MAX_IRQ) ? (64 + (gpio)) : -EINVAL)
|
|
||||||
|
|
||||||
#define irq_to_gpio(irq) ((irq) - gpio_to_irq(0))
|
#define irq_to_gpio(irq) ((irq) - gpio_to_irq(0))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -307,6 +307,21 @@ static int ep93xx_gpio_set_debounce(struct gpio_chip *chip,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Map GPIO A0..A7 (0..7) to irq 64..71,
|
||||||
|
* B0..B7 (7..15) to irq 72..79, and
|
||||||
|
* F0..F7 (16..24) to irq 80..87.
|
||||||
|
*/
|
||||||
|
static int ep93xx_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
|
||||||
|
{
|
||||||
|
int gpio = chip->base + offset;
|
||||||
|
|
||||||
|
if (gpio > EP93XX_GPIO_LINE_MAX_IRQ)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
return 64 + gpio;
|
||||||
|
}
|
||||||
|
|
||||||
static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev,
|
static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev,
|
||||||
void __iomem *mmio_base, struct ep93xx_gpio_bank *bank)
|
void __iomem *mmio_base, struct ep93xx_gpio_bank *bank)
|
||||||
{
|
{
|
||||||
@@ -321,8 +336,10 @@ static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev,
|
|||||||
bgc->gc.label = bank->label;
|
bgc->gc.label = bank->label;
|
||||||
bgc->gc.base = bank->base;
|
bgc->gc.base = bank->base;
|
||||||
|
|
||||||
if (bank->has_debounce)
|
if (bank->has_debounce) {
|
||||||
bgc->gc.set_debounce = ep93xx_gpio_set_debounce;
|
bgc->gc.set_debounce = ep93xx_gpio_set_debounce;
|
||||||
|
bgc->gc.to_irq = ep93xx_gpio_to_irq;
|
||||||
|
}
|
||||||
|
|
||||||
return gpiochip_add(&bgc->gc);
|
return gpiochip_add(&bgc->gc);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user