realtek: clear spurious GPIO interrupts
[openwrt/staging/nbd.git] / target / linux / realtek / patches-5.10 / 317-gpio-realtek-otto-clear-spurious-interrups.patch
1 realtek: clear spurious GPIO interrupts
2
3 The interrupt controller in the internal GPIO peripheral will sometimes
4 generate spurious interrupts. If these are not properly acknowledged, the
5 system will be held busy until reboot. These spurious interrupts are identified
6 by the fact that there is no system IRQ number associated, since the interrupt
7 line was never allocated. Although most prevalent on RTL839x, RTL838x SoCs have
8 also displayed this behaviour.
9
10 Reported-by: Luiz Angelo Daros de Luca <luizluca@gmail.com> # DGS-1210-52
11 Reported-by: Birger Koblitz <mail@birger-koblitz.de> # Netgear GS724TP v2
12 Reported-by: Jan Hoffmann <jan@3e8.eu> # HPE 1920-16G
13 Signed-off-by: Sander Vanheule <sander@svanheule.net>
14 ---
15 drivers/gpio/gpio-realtek-otto.c | 4 ++++
16 1 file changed, 4 insertions(+)
17
18 --- a/drivers/gpio/gpio-realtek-otto.c
19 +++ b/drivers/gpio/gpio-realtek-otto.c
20 @@ -251,6 +251,10 @@ static void realtek_gpio_irq_handler(str
21 port_pin_count = min(gc->ngpio - lines_done, 8U);
22 for_each_set_bit(offset, &status, port_pin_count) {
23 irq = irq_find_mapping(gc->irq.domain, offset + lines_done);
24 + if (unlikely(!irq)) {
25 + realtek_gpio_clear_isr(ctrl, lines_done / 8, BIT(offset));
26 + continue;
27 + }
28 generic_handle_irq(irq);
29 }
30 }