Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: vf610: Mask all GPIO interrupts

On SoC reset all GPIO interrupts are disable. However, if kexec is
used to boot into a new kernel, the SoC does not experience a
reset. Hence GPIO interrupts can be left enabled from the previous
kernel. It is then possible for the interrupt to fire before an
interrupt handler is registered, resulting in the kernel complaining
of an "unexpected IRQ trap", the interrupt is never cleared, and so
fires again, resulting in an interrupt storm.

Disable all GPIO interrupts before registering the GPIO IRQ chip.

Fixes: 7f2691a19627 ("gpio: vf610: add gpiolib/IRQ chip driver for Vybrid")
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Andrew Lunn and committed by
Linus Walleij
7ae710f9 aa284d64

+5
+5
drivers/gpio/gpio-vf610.c
··· 253 253 struct vf610_gpio_port *port; 254 254 struct resource *iores; 255 255 struct gpio_chip *gc; 256 + int i; 256 257 int ret; 257 258 258 259 port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); ··· 319 318 ret = gpiochip_add_data(gc, port); 320 319 if (ret < 0) 321 320 return ret; 321 + 322 + /* Mask all GPIO interrupts */ 323 + for (i = 0; i < gc->ngpio; i++) 324 + vf610_gpio_writel(0, port->base + PORT_PCR(i)); 322 325 323 326 /* Clear the interrupt status register for all GPIO's */ 324 327 vf610_gpio_writel(~0, port->base + PORT_ISFR);