]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
gpio: mvebu: clear irq in edge cause register before unmask edge irq
authorMaxim Kiselev <bigunclemax@gmail.com>
Wed, 15 Jan 2020 07:38:11 +0000 (10:38 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 23 Jan 2020 14:52:40 +0000 (15:52 +0100)
When input GPIO set from 0 to 1, the interrupt bit asserted in the GPIO
Interrupt Cause Register (ICR) even if the corresponding interrupt
masked in the GPIO Interrupt Mask Register.

Because interrupt mask register only affects assertion of the interrupt
bits in Main Interrupt Cause Register and it does not affect the
setting of bits in the GPIO ICR.

So, there is problem, when we unmask interrupt with already
asserted bit in the GPIO ICR, then false interrupt immediately occurs
even if GPIO don't change their value since last unmask.

Signed-off-by: Maxim Kiselev <bigunclemax@gmail.com>
Link: https://lore.kernel.org/r/20200115073811.24438-1-bigunclemax@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-mvebu.c

index f0fd82b3417cf29ff7a24f488f974d9b3b33c3df..d2b999c7987f11f6075cbcc35d186a0ba5f4b10c 100644 (file)
@@ -431,6 +431,7 @@ static void mvebu_gpio_edge_irq_unmask(struct irq_data *d)
        u32 mask = d->mask;
 
        irq_gc_lock(gc);
+       mvebu_gpio_write_edge_cause(mvchip, ~mask);
        ct->mask_cache_priv |= mask;
        mvebu_gpio_write_edge_mask(mvchip, ct->mask_cache_priv);
        irq_gc_unlock(gc);