aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-08-18 05:54:56 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-09-03 07:56:31 -0400
commit016da14439b83fbb82c67c497eb770c8025608fe (patch)
treee90beacc51314641af8a11550c4796c05ed9b171 /drivers/gpio
parent0752e169ba523e35f70d2fee4d06680b33e0e202 (diff)
gpio: zynq: Take bank offset into account when reporting a IRQ
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>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-zynq.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
index 36034b6811bb..dccadea9d830 100644
--- a/drivers/gpio/gpio-zynq.c
+++ b/drivers/gpio/gpio-zynq.c
@@ -138,6 +138,13 @@ static inline void zynq_gpio_get_bank_pin(unsigned int pin_num,
138 } 138 }
139} 139}
140 140
141static const unsigned int zynq_gpio_bank_offset[] = {
142 ZYNQ_GPIO_BANK0_PIN_MIN,
143 ZYNQ_GPIO_BANK1_PIN_MIN,
144 ZYNQ_GPIO_BANK2_PIN_MIN,
145 ZYNQ_GPIO_BANK3_PIN_MIN,
146};
147
141/** 148/**
142 * zynq_gpio_get_value - Get the state of the specified pin of GPIO device 149 * zynq_gpio_get_value - Get the state of the specified pin of GPIO device
143 * @chip: gpio_chip instance to be worked on 150 * @chip: gpio_chip instance to be worked on
@@ -461,6 +468,7 @@ static void zynq_gpio_handle_bank_irq(struct zynq_gpio *gpio,
461 unsigned int bank_num, 468 unsigned int bank_num,
462 unsigned long pending) 469 unsigned long pending)
463{ 470{
471 unsigned int bank_offset = zynq_gpio_bank_offset[bank_num];
464 struct irq_domain *irqdomain = gpio->chip.irqdomain; 472 struct irq_domain *irqdomain = gpio->chip.irqdomain;
465 int offset; 473 int offset;
466 474
@@ -470,7 +478,7 @@ static void zynq_gpio_handle_bank_irq(struct zynq_gpio *gpio,
470 for_each_set_bit(offset, &pending, 32) { 478 for_each_set_bit(offset, &pending, 32) {
471 unsigned int gpio_irq; 479 unsigned int gpio_irq;
472 480
473 gpio_irq = irq_find_mapping(irqdomain, offset); 481 gpio_irq = irq_find_mapping(irqdomain, offset + bank_offset);
474 generic_handle_irq(gpio_irq); 482 generic_handle_irq(gpio_irq);
475 } 483 }
476} 484}