Commit 7ae710f9 authored by Andrew Lunn's avatar Andrew Lunn Committed by Linus Walleij

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: 7f2691a1 ("gpio: vf610: add gpiolib/IRQ chip driver for Vybrid")
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Acked-by: default avatarStefan Agner <stefan@agner.ch>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent aa284d64
...@@ -253,6 +253,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) ...@@ -253,6 +253,7 @@ static int vf610_gpio_probe(struct platform_device *pdev)
struct vf610_gpio_port *port; struct vf610_gpio_port *port;
struct resource *iores; struct resource *iores;
struct gpio_chip *gc; struct gpio_chip *gc;
int i;
int ret; int ret;
port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL);
...@@ -319,6 +320,10 @@ static int vf610_gpio_probe(struct platform_device *pdev) ...@@ -319,6 +320,10 @@ static int vf610_gpio_probe(struct platform_device *pdev)
if (ret < 0) if (ret < 0)
return ret; return ret;
/* Mask all GPIO interrupts */
for (i = 0; i < gc->ngpio; i++)
vf610_gpio_writel(0, port->base + PORT_PCR(i));
/* Clear the interrupt status register for all GPIO's */ /* Clear the interrupt status register for all GPIO's */
vf610_gpio_writel(~0, port->base + PORT_ISFR); vf610_gpio_writel(~0, port->base + PORT_ISFR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment