Skip to content

Commit

Permalink
gpio: zynq: Take bank offset into account when reporting a IRQ
Browse files Browse the repository at this point in the history
When looking up the IRQ the bank offset needs to be taken into account.
Otherwise interrupts for banks other than bank 0 get incorrectly reported as
interrupts for bank 0.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Lars-Peter Clausen authored and Linus Walleij committed Sep 3, 2014
1 parent 0752e16 commit 016da14
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/gpio/gpio-zynq.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ static inline void zynq_gpio_get_bank_pin(unsigned int pin_num,
}
}

static const unsigned int zynq_gpio_bank_offset[] = {
ZYNQ_GPIO_BANK0_PIN_MIN,
ZYNQ_GPIO_BANK1_PIN_MIN,
ZYNQ_GPIO_BANK2_PIN_MIN,
ZYNQ_GPIO_BANK3_PIN_MIN,
};

/**
* zynq_gpio_get_value - Get the state of the specified pin of GPIO device
* @chip: gpio_chip instance to be worked on
Expand Down Expand Up @@ -461,6 +468,7 @@ static void zynq_gpio_handle_bank_irq(struct zynq_gpio *gpio,
unsigned int bank_num,
unsigned long pending)
{
unsigned int bank_offset = zynq_gpio_bank_offset[bank_num];
struct irq_domain *irqdomain = gpio->chip.irqdomain;
int offset;

Expand All @@ -470,7 +478,7 @@ static void zynq_gpio_handle_bank_irq(struct zynq_gpio *gpio,
for_each_set_bit(offset, &pending, 32) {
unsigned int gpio_irq;

gpio_irq = irq_find_mapping(irqdomain, offset);
gpio_irq = irq_find_mapping(irqdomain, offset + bank_offset);
generic_handle_irq(gpio_irq);
}
}
Expand Down

0 comments on commit 016da14

Please sign in to comment.