diff options
Diffstat (limited to 'arch/arm/mach-davinci/gpio.c')
-rw-r--r-- | arch/arm/mach-davinci/gpio.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/arch/arm/mach-davinci/gpio.c b/arch/arm/mach-davinci/gpio.c index e7221398e5af..cafbe13a82a5 100644 --- a/arch/arm/mach-davinci/gpio.c +++ b/arch/arm/mach-davinci/gpio.c | |||
@@ -254,8 +254,10 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc) | |||
254 | { | 254 | { |
255 | struct davinci_gpio_regs __iomem *g; | 255 | struct davinci_gpio_regs __iomem *g; |
256 | u32 mask = 0xffff; | 256 | u32 mask = 0xffff; |
257 | struct davinci_gpio_controller *d; | ||
257 | 258 | ||
258 | g = (__force struct davinci_gpio_regs __iomem *) irq_desc_get_handler_data(desc); | 259 | d = (struct davinci_gpio_controller *)irq_desc_get_handler_data(desc); |
260 | g = (struct davinci_gpio_regs __iomem *)d->regs; | ||
259 | 261 | ||
260 | /* we only care about one bank */ | 262 | /* we only care about one bank */ |
261 | if (irq & 1) | 263 | if (irq & 1) |
@@ -274,11 +276,14 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc) | |||
274 | if (!status) | 276 | if (!status) |
275 | break; | 277 | break; |
276 | __raw_writel(status, &g->intstat); | 278 | __raw_writel(status, &g->intstat); |
277 | if (irq & 1) | ||
278 | status >>= 16; | ||
279 | 279 | ||
280 | /* now demux them to the right lowlevel handler */ | 280 | /* now demux them to the right lowlevel handler */ |
281 | n = (int)irq_get_handler_data(irq); | 281 | n = d->irq_base; |
282 | if (irq & 1) { | ||
283 | n += 16; | ||
284 | status >>= 16; | ||
285 | } | ||
286 | |||
282 | while (status) { | 287 | while (status) { |
283 | res = ffs(status); | 288 | res = ffs(status); |
284 | n += res; | 289 | n += res; |
@@ -424,7 +429,13 @@ static int __init davinci_gpio_irq_setup(void) | |||
424 | 429 | ||
425 | /* set up all irqs in this bank */ | 430 | /* set up all irqs in this bank */ |
426 | irq_set_chained_handler(bank_irq, gpio_irq_handler); | 431 | irq_set_chained_handler(bank_irq, gpio_irq_handler); |
427 | irq_set_handler_data(bank_irq, (__force void *)g); | 432 | |
433 | /* | ||
434 | * Each chip handles 32 gpios, and each irq bank consists of 16 | ||
435 | * gpio irqs. Pass the irq bank's corresponding controller to | ||
436 | * the chained irq handler. | ||
437 | */ | ||
438 | irq_set_handler_data(bank_irq, &chips[gpio / 32]); | ||
428 | 439 | ||
429 | for (i = 0; i < 16 && gpio < ngpio; i++, irq++, gpio++) { | 440 | for (i = 0; i < 16 && gpio < ngpio; i++, irq++, gpio++) { |
430 | irq_set_chip(irq, &gpio_irqchip); | 441 | irq_set_chip(irq, &gpio_irqchip); |