Skip to content

Commit

Permalink
gpio: davinci: use chained_irq_enter/chained_irq_exit API
Browse files Browse the repository at this point in the history
It's unsafe to call IRQ chip callbacks (.irq_mask/irq_unmask/irq_ack)
from chained IRQ handler directly. Because, Davinci GPIO block is used
by different SoCs, which, in turn, have different Main IRQ controllers
(Davinci - aintc, cp-intc; Keystone - arm-gic) which may introduce
diffrent set of IRQ chip callbacks. As result, call of
gpio_irq_handler() on Keysone will simply cause crash the system,
because ARM-GIC implements .irq_eoi() instead of .irq_ack().

Hence, fix it by using Kernel chained_irq_enter/chained_irq_exit APIs as
they are intended to handle exact such cases.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
  • Loading branch information
Grygorii Strashko authored and Sekhar Nori committed Dec 25, 2013
1 parent c770844 commit 0d978eb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpio/gpio-davinci.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/platform_data/gpio-davinci.h>
#include <linux/irqchip/chained_irq.h>

struct davinci_gpio_regs {
u32 dir;
Expand Down Expand Up @@ -321,8 +322,7 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)
mask <<= 16;

/* temporarily mask (level sensitive) parent IRQ */
desc->irq_data.chip->irq_mask(&desc->irq_data);
desc->irq_data.chip->irq_ack(&desc->irq_data);
chained_irq_enter(irq_desc_get_chip(desc), desc);
while (1) {
u32 status;
int bit;
Expand All @@ -343,7 +343,7 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)
d->chip.base + bit));
}
}
desc->irq_data.chip->irq_unmask(&desc->irq_data);
chained_irq_exit(irq_desc_get_chip(desc), desc);
/* now it may re-trigger */
}

Expand Down

0 comments on commit 0d978eb

Please sign in to comment.