@@ -249,8 +249,16 @@ static struct irq_chip gpio_irqchip = {
.flags = IRQCHIP_SET_TYPE_MASKED,
};
+static unsigned int first_irq_in_bankirq(unsigned int bank_irq)
+{
+ struct davinci_soc_info *soc_info = &davinci_soc_info;
+
+ /* Each irq bank consists of up to 16 irqs */
+ return gpio_to_irq(0) + (16 * (bank_irq - soc_info->gpio_irq));
+}
+
static void
-gpio_irq_handler(unsigned irq, struct irq_desc *desc)
+gpio_irq_handler(unsigned bank_irq, struct irq_desc *desc)
{
struct davinci_gpio_regs __iomem *g;
u32 mask = 0xffff;
@@ -258,7 +266,7 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)
g = (__force struct davinci_gpio_regs __iomem *) irq_desc_get_handler_data(desc);
/* we only care about one bank */
- if (irq & 1)
+ if (bank_irq & 1)
mask <<= 16;
/* temporarily mask (level sensitive) parent IRQ */
@@ -274,11 +282,11 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)
if (!status)
break;
__raw_writel(status, &g->intstat);
- if (irq & 1)
+ if (bank_irq & 1)
status >>= 16;
/* now demux them to the right lowlevel handler */
- n = (int)irq_get_handler_data(irq);
+ n = first_irq_in_bankirq(bank_irq);
while (status) {
res = ffs(status);
n += res;
Commit 7416401 ("arm: davinci: Fix fallout from generic irq chip conversion") introduced a bug, causing low level interrupt handlers to get a bogus irq number as an argument. The gpio irq handler falsely assumes that the handler data is the irq base number and that is no longer true. Fix this by converting gpio_irq_handler's bank_irq argument to the corresponding irq base number. Signed-off-by: Ido Yariv <ido@wizery.com> CC: Thomas Gleixner <tglx@linutronix.de> --- arch/arm/mach-davinci/gpio.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-)