pinctrl: bcm2835: Clear the event latch register when disabling interrupts
authorJonathan Bell <jonathan@raspberrypi.org>
Tue, 30 Jun 2015 11:35:39 +0000 (12:35 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 20 Jul 2015 09:01:52 +0000 (11:01 +0200)
commit714b1dd8f72e39ef4bc0f38f7f341bb1d57d98bf
treed60063bd16f3e5d298b84925d26121ecb24aa691
parentc10372e615b8f790d30cbfcf59e43908ca42bf1a
pinctrl: bcm2835: Clear the event latch register when disabling interrupts

It's possible to hit a race condition if interrupts are generated on a GPIO
pin when the IRQ line in question is being disabled.

If the interrupt is freed, bcm2835_gpio_irq_disable() is called which
disables the event generation sources (edge, level). If an event occurred
between the last disabling of hard IRQs and the write to the event
source registers, a bit would be set in the GPIO event detect register
(GPEDSn) which goes unacknowledged by bcm2835_gpio_irq_handler()
so Linux complains loudly.

There is no per-GPIO mask register, so when disabling GPIO interrupts
write 1 to the relevant bit in GPEDSn to clear out any stale events.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/bcm/pinctrl-bcm2835.c