diff mbox series

[bug,report] GPIO & Hierarchy IRQ support for HiFive Unleashed

Message ID CAHOvCC4y8x6_fBSAug3ecN+4QFiNJCooUt7Py9=J+NnBd4J8dQ@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series [bug,report] GPIO & Hierarchy IRQ support for HiFive Unleashed | expand

Commit Message

JaeJoon Jung Jan. 30, 2020, 4:16 p.m. UTC
Hello Yash Shah,

I am testing the your patch:
[PATCH v4 0/6] GPIO & Hierarchy IRQ support for HiFive Unleashed
from 2019-12-10 11:11 Yash Shah

I found out that you repaired the generic GPIO using bgpio_init(...) API.
bgpio_init() has 9 parameters, and the last is flags.
The flag getting to bgpio_init() is must be BGPIOF_READ_OUTPUT_REG_SET.

Because FU540 GPIOs have different input/output register,
If GPIO direction is input(SIFIVE_GPIO_INPUT_VAL), it must be read
input value(SIFIVE_GPIO_INPUT_EN).
If GPIO direction is output(SIFIVE_GPIO_OUTPUT_VAL), it must be read
output value(SIFIVE_GPIO_OUTPUT_EN).

If The flag is 0, GPIO output value is being reset and the value is
reading 0 always.


Yours,
JaeJoon Jung

Comments

Yash Shah Feb. 19, 2020, 3:56 a.m. UTC | #1
> -----Original Message-----
> From: JaeJoon Jung <rgbi3307@gmail.com>
> Sent: 30 January 2020 21:47
> To: Yash Shah <yash.shah@sifive.com>
> Cc: linux-riscv <linux-riscv@lists.infradead.org>
> Subject: [bug report] GPIO & Hierarchy IRQ support for HiFive Unleashed
> 
> Hello Yash Shah,
> 
> I am testing the your patch:
> [PATCH v4 0/6] GPIO & Hierarchy IRQ support for HiFive Unleashed from
> 2019-12-10 11:11 Yash Shah
> 
> I found out that you repaired the generic GPIO using bgpio_init(...) API.
> bgpio_init() has 9 parameters, and the last is flags.
> The flag getting to bgpio_init() is must be BGPIOF_READ_OUTPUT_REG_SET.
> 
> Because FU540 GPIOs have different input/output register, If GPIO direction
> is input(SIFIVE_GPIO_INPUT_VAL), it must be read input
> value(SIFIVE_GPIO_INPUT_EN).
> If GPIO direction is output(SIFIVE_GPIO_OUTPUT_VAL), it must be read
> output value(SIFIVE_GPIO_OUTPUT_EN).
> 
> If The flag is 0, GPIO output value is being reset and the value is reading 0
> always.
> 
> diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c index
> 23d5e22694d1..1de1af452fcb 100644
> --- a/drivers/gpio/gpio-sifive.c
> +++ b/drivers/gpio/gpio-sifive.c
> @@ -206,7 +206,7 @@ static int sifive_gpio_probe(struct platform_device
> *pdev)
>                          NULL,
>                          chip->base + SIFIVE_GPIO_OUTPUT_EN,
>                          chip->base + SIFIVE_GPIO_INPUT_EN,
> -                        0);
> +                        BGPIOF_READ_OUTPUT_REG_SET);
>         if (ret) {
>                 dev_err(dev, "unable to init generic GPIO\n");
>                 return ret;
> 
> Yours,
> JaeJoon Jung

Thanks for the bug report. I will look into this and send a fix.

- Yash
JaeJoon Jung Feb. 19, 2020, 9:14 p.m. UTC | #2
Great, thanks!
I am interested in RISC-V and SiFive.
If I find another bug, I will report.
JaeJoon Jung.

On Wed, 19 Feb 2020 at 12:56, Yash Shah <yash.shah@sifive.com> wrote:
>
> > -----Original Message-----
> > From: JaeJoon Jung <rgbi3307@gmail.com>
> > Sent: 30 January 2020 21:47
> > To: Yash Shah <yash.shah@sifive.com>
> > Cc: linux-riscv <linux-riscv@lists.infradead.org>
> > Subject: [bug report] GPIO & Hierarchy IRQ support for HiFive Unleashed
> >
> > Hello Yash Shah,
> >
> > I am testing the your patch:
> > [PATCH v4 0/6] GPIO & Hierarchy IRQ support for HiFive Unleashed from
> > 2019-12-10 11:11 Yash Shah
> >
> > I found out that you repaired the generic GPIO using bgpio_init(...) API.
> > bgpio_init() has 9 parameters, and the last is flags.
> > The flag getting to bgpio_init() is must be BGPIOF_READ_OUTPUT_REG_SET.
> >
> > Because FU540 GPIOs have different input/output register, If GPIO direction
> > is input(SIFIVE_GPIO_INPUT_VAL), it must be read input
> > value(SIFIVE_GPIO_INPUT_EN).
> > If GPIO direction is output(SIFIVE_GPIO_OUTPUT_VAL), it must be read
> > output value(SIFIVE_GPIO_OUTPUT_EN).
> >
> > If The flag is 0, GPIO output value is being reset and the value is reading 0
> > always.
> >
> > diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c index
> > 23d5e22694d1..1de1af452fcb 100644
> > --- a/drivers/gpio/gpio-sifive.c
> > +++ b/drivers/gpio/gpio-sifive.c
> > @@ -206,7 +206,7 @@ static int sifive_gpio_probe(struct platform_device
> > *pdev)
> >                          NULL,
> >                          chip->base + SIFIVE_GPIO_OUTPUT_EN,
> >                          chip->base + SIFIVE_GPIO_INPUT_EN,
> > -                        0);
> > +                        BGPIOF_READ_OUTPUT_REG_SET);
> >         if (ret) {
> >                 dev_err(dev, "unable to init generic GPIO\n");
> >                 return ret;
> >
> > Yours,
> > JaeJoon Jung
>
> Thanks for the bug report. I will look into this and send a fix.
>
> - Yash
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c
index 23d5e22694d1..1de1af452fcb 100644
--- a/drivers/gpio/gpio-sifive.c
+++ b/drivers/gpio/gpio-sifive.c
@@ -206,7 +206,7 @@  static int sifive_gpio_probe(struct platform_device *pdev)
                         NULL,
                         chip->base + SIFIVE_GPIO_OUTPUT_EN,
                         chip->base + SIFIVE_GPIO_INPUT_EN,
-                        0);
+                        BGPIOF_READ_OUTPUT_REG_SET);
        if (ret) {
                dev_err(dev, "unable to init generic GPIO\n");
                return ret;