diff mbox series

[v2,2/2] gpio/aspeed-sgpio: don't enable all interrupts by default

Message ID 20200911015105.48581-2-jk@codeconstruct.com.au
State Accepted
Commit bf0d394e885015941ed2d5724c0a6ed8d42dd95e
Headers show
Series [v2,1/2] gpio/aspeed-sgpio: enable access to all 80 input & output sgpios | expand

Commit Message

Jeremy Kerr Sept. 11, 2020, 1:51 a.m. UTC
Currently, the IRQ setup for the SGPIO driver enables all interrupts in
dual-edge trigger mode. Since the default handler is handle_bad_irq, any
state change on input GPIOs will trigger bad IRQ warnings.

This change applies sensible IRQ defaults: single-edge trigger, and all
IRQs disabled.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Fixes: 7db47faae79b ("gpio: aspeed: Add SGPIO driver")

---
v2:
 - update comments to reflect trigger mode change
 - tweak wording to reflect disabled state & single-edge trigger mode
---
 drivers/gpio/gpio-aspeed-sgpio.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Joel Stanley Sept. 11, 2020, 2:21 a.m. UTC | #1
On Fri, 11 Sep 2020 at 02:11, Jeremy Kerr <jk@codeconstruct.com.au> wrote:
>
> Currently, the IRQ setup for the SGPIO driver enables all interrupts in
> dual-edge trigger mode. Since the default handler is handle_bad_irq, any
> state change on input GPIOs will trigger bad IRQ warnings.
>
> This change applies sensible IRQ defaults: single-edge trigger, and all
> IRQs disabled.
>
> Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
> Fixes: 7db47faae79b ("gpio: aspeed: Add SGPIO driver")

Reviewed-by: Joel Stanley <joel@jms.id.au>

>
> ---
> v2:
>  - update comments to reflect trigger mode change
>  - tweak wording to reflect disabled state & single-edge trigger mode
> ---
>  drivers/gpio/gpio-aspeed-sgpio.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpio/gpio-aspeed-sgpio.c b/drivers/gpio/gpio-aspeed-sgpio.c
> index a18ca52432e0..64e54f8c30d2 100644
> --- a/drivers/gpio/gpio-aspeed-sgpio.c
> +++ b/drivers/gpio/gpio-aspeed-sgpio.c
> @@ -452,17 +452,15 @@ static int aspeed_sgpio_setup_irqs(struct aspeed_sgpio *gpio,
>         irq->parents = &gpio->irq;
>         irq->num_parents = 1;
>
> -       /* set IRQ settings and Enable Interrupt */
> +       /* Apply default IRQ settings */
>         for (i = 0; i < ARRAY_SIZE(aspeed_sgpio_banks); i++) {
>                 bank = &aspeed_sgpio_banks[i];
>                 /* set falling or level-low irq */
>                 iowrite32(0x00000000, bank_reg(gpio, bank, reg_irq_type0));
>                 /* trigger type is edge */
>                 iowrite32(0x00000000, bank_reg(gpio, bank, reg_irq_type1));
> -               /* dual edge trigger mode. */
> -               iowrite32(0xffffffff, bank_reg(gpio, bank, reg_irq_type2));
> -               /* enable irq */
> -               iowrite32(0xffffffff, bank_reg(gpio, bank, reg_irq_enable));
> +               /* single edge trigger */
> +               iowrite32(0x00000000, bank_reg(gpio, bank, reg_irq_type2));
>         }
>
>         return 0;
> --
> 2.28.0
>
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-aspeed-sgpio.c b/drivers/gpio/gpio-aspeed-sgpio.c
index a18ca52432e0..64e54f8c30d2 100644
--- a/drivers/gpio/gpio-aspeed-sgpio.c
+++ b/drivers/gpio/gpio-aspeed-sgpio.c
@@ -452,17 +452,15 @@  static int aspeed_sgpio_setup_irqs(struct aspeed_sgpio *gpio,
 	irq->parents = &gpio->irq;
 	irq->num_parents = 1;
 
-	/* set IRQ settings and Enable Interrupt */
+	/* Apply default IRQ settings */
 	for (i = 0; i < ARRAY_SIZE(aspeed_sgpio_banks); i++) {
 		bank = &aspeed_sgpio_banks[i];
 		/* set falling or level-low irq */
 		iowrite32(0x00000000, bank_reg(gpio, bank, reg_irq_type0));
 		/* trigger type is edge */
 		iowrite32(0x00000000, bank_reg(gpio, bank, reg_irq_type1));
-		/* dual edge trigger mode. */
-		iowrite32(0xffffffff, bank_reg(gpio, bank, reg_irq_type2));
-		/* enable irq */
-		iowrite32(0xffffffff, bank_reg(gpio, bank, reg_irq_enable));
+		/* single edge trigger */
+		iowrite32(0x00000000, bank_reg(gpio, bank, reg_irq_type2));
 	}
 
 	return 0;