diff mbox series

[RFC,v3,2/2] gpio: rcar: Set pin as a GPIO when configuring an interrupt

Message ID 1542727156-31432-3-git-send-email-fabrizio.castro@bp.renesas.com (mailing list archive)
State Under Review
Delegated to: Geert Uytterhoeven
Headers show
Series Request GPIO when enabling interrupt | expand

Commit Message

Fabrizio Castro Nov. 20, 2018, 3:19 p.m. UTC
As it turns out, the bootloader or a POR may get in the way
of the current implementation of gpio_rcar_irq_set_type, as
the pinmuxing may not be GPIO.
This patch makes sure the pin is configured as a GPIO when
requesting it an interrupt, as that's necessary for the
interrupt to work properly. Failing to do so may damage
the board as this can cause shorts.

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
 drivers/gpio/gpio-rcar.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series


diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 1322f7e..615404c 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -168,6 +168,9 @@  static int gpio_rcar_irq_set_type(struct irq_data *d, unsigned int type)
 		return -EINVAL;
+	pinctrl_mux_gpio_request_enable(gc->base + hwirq);
 	return 0;