diff mbox series

[v2,2/4] gpio: dwapb: Read GPIO base from gpio-base property

Message ID 20210804160019.77105-2-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v2,1/4] gpio: dwapb: Unify ACPI enumeration checks in get_irq() and configure_irqs() | expand

Commit Message

Andy Shevchenko Aug. 4, 2021, 4 p.m. UTC
For backward compatibility with some legacy devices introduce
a new (*) property gpio-base to read GPIO base. This will allow
further cleaning up of the driver.

*) Note, it's not new for the GPIO library since the mockup driver
   is using it already.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: added check to ensure that the property won't be used by FW (Serge)
 drivers/gpio/gpio-dwapb.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Andy Shevchenko Aug. 5, 2021, 10:38 a.m. UTC | #1
On Wed, Aug 04, 2021 at 07:00:17PM +0300, Andy Shevchenko wrote:
> For backward compatibility with some legacy devices introduce
> a new (*) property gpio-base to read GPIO base. This will allow
> further cleaning up of the driver.
> 
> *) Note, it's not new for the GPIO library since the mockup driver
>    is using it already.

Serge, I haven't put any tags here since the patch has been modified.
It still works for my case. I hope that's what you wanted me to do.

Since Lee gave his ACKs, this is the last in the series to be reviewed.
Serge Semin Aug. 5, 2021, 12:08 p.m. UTC | #2
Hi Andy

On Thu, Aug 05, 2021 at 01:38:46PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 04, 2021 at 07:00:17PM +0300, Andy Shevchenko wrote:
> > For backward compatibility with some legacy devices introduce
> > a new (*) property gpio-base to read GPIO base. This will allow
> > further cleaning up of the driver.
> > 
> > *) Note, it's not new for the GPIO library since the mockup driver
> >    is using it already.
> 
> Serge, I haven't put any tags here since the patch has been modified.
> It still works for my case. I hope that's what you wanted me to do.


Thanks for the update. Yep, it works like a charm. No gpio-base is read
from DT.

Tested-by: Serge Semin <fancer.lancer@gmail.com>
Acked-by: Serge Semin <fancer.lancer@gmail.com>

-Sergey

> 
> Since Lee gave his ACKs, this is the last in the series to be reviewed.
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
>
Linus Walleij Aug. 11, 2021, 12:50 p.m. UTC | #3
On Wed, Aug 4, 2021 at 6:15 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> For backward compatibility with some legacy devices introduce
> a new (*) property gpio-base to read GPIO base. This will allow
> further cleaning up of the driver.
>
> *) Note, it's not new for the GPIO library since the mockup driver
>    is using it already.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: added check to ensure that the property won't be used by FW (Serge)
>  drivers/gpio/gpio-dwapb.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index 4c7153cb646c..674e91e69cc5 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -584,6 +584,10 @@ static struct dwapb_platform_data *dwapb_gpio_get_pdata(struct device *dev)
>
>                 pp->gpio_base   = -1;
>
> +               /* For internal use only, new platforms mustn't exercise this */
> +               if (is_software_node(fwnode))
> +                       fwnode_property_read_u32(fwnode, "gpio-base", &pp->gpio_base);

You rewrite the code quicker than I can review  :D

So this is elegant, I would prefer "linux,gpio-base" but the
overall change is more important, with or without that change:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Andy Shevchenko Aug. 11, 2021, 1:05 p.m. UTC | #4
On Wed, Aug 11, 2021 at 02:50:46PM +0200, Linus Walleij wrote:
> On Wed, Aug 4, 2021 at 6:15 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> 
> > For backward compatibility with some legacy devices introduce
> > a new (*) property gpio-base to read GPIO base. This will allow
> > further cleaning up of the driver.
> >
> > *) Note, it's not new for the GPIO library since the mockup driver
> >    is using it already.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> > v2: added check to ensure that the property won't be used by FW (Serge)
> >  drivers/gpio/gpio-dwapb.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> > index 4c7153cb646c..674e91e69cc5 100644
> > --- a/drivers/gpio/gpio-dwapb.c
> > +++ b/drivers/gpio/gpio-dwapb.c
> > @@ -584,6 +584,10 @@ static struct dwapb_platform_data *dwapb_gpio_get_pdata(struct device *dev)
> >
> >                 pp->gpio_base   = -1;
> >
> > +               /* For internal use only, new platforms mustn't exercise this */
> > +               if (is_software_node(fwnode))
> > +                       fwnode_property_read_u32(fwnode, "gpio-base", &pp->gpio_base);
> 
> You rewrite the code quicker than I can review  :D

Sorry for that :-)

> So this is elegant, I would prefer "linux,gpio-base" but the
> overall change is more important, with or without that change:

I'm okay with the either, but the thing is that gpio-base is already in use.
Perhaps in the future somebody can change both (gpio-mockup and this driver)
to use the proposed one (AFAIU we free to change it since it's not part of FW
interface).

> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Thanks!
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index 4c7153cb646c..674e91e69cc5 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -584,6 +584,10 @@  static struct dwapb_platform_data *dwapb_gpio_get_pdata(struct device *dev)
 
 		pp->gpio_base	= -1;
 
+		/* For internal use only, new platforms mustn't exercise this */
+		if (is_software_node(fwnode))
+			fwnode_property_read_u32(fwnode, "gpio-base", &pp->gpio_base);
+
 		/*
 		 * Only port A can provide interrupts in all configurations of
 		 * the IP.