[PATCH] ramips: gpio-ralink: use ngpios, not ralink,num-gpios

Chuanhong Guo gch981213 at gmail.com
Thu Apr 8 03:40:45 BST 2021


Hi!

On Thu, Apr 8, 2021 at 6:41 AM Ilya Lipnitskiy
<ilya.lipnitskiy at gmail.com> wrote:
>
> On Wed, Apr 7, 2021 at 2:46 AM Sander Vanheule <sander at svanheule.net> wrote:
> >
> > Hi Ilya,
> >
> > On Mon, 2021-04-05 at 22:53 -0700, Ilya Lipnitskiy wrote:
> > > DTS properties that match *-gpios are treated specially.
> > >
> > > Use ngpios instead, as most GPIO drivers upstream do.
> > >
> > > Fixes 5.10 DTS errors such as:
> > >   OF: /palmbus at 300000/gpio at 600: could not find phandle
> > >
> > > Fixes DTC warnings such as:
> > >   Warning (gpios_property): /palmbus at 300000/gpio at 600:ralink,num-
> > > gpios:
> > >   Could not get phandle node for (cell 0)
> > >
> > > Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy at gmail.com>
> > > Cc: Daniel Golle <daniel at makrotopia.org>
> > > ---
> > >
> >
> > [...]
> >
> > > diff --git a/target/linux/ramips/patches-5.10/802-GPIO-MIPS-ralink-
> > > add-gpio-driver-for-ralink-SoC.patch b/target/linux/ramips/patches-
> > > 5.10/802-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch
> > > index 141d29f9401c..c173336924d2 100644
> > > --- a/target/linux/ramips/patches-5.10/802-GPIO-MIPS-ralink-add-gpio-
> > > driver-for-ralink-SoC.patch
> > > +++ b/target/linux/ramips/patches-5.10/802-GPIO-MIPS-ralink-add-gpio-
> > > driver-for-ralink-SoC.patch
> > > @@ -357,7 +357,7 @@ Cc: linux-gpio at vger.kernel.org
> > >  +              return -EINVAL;
> > >  +      }
> > >  +
> > > -+      ngpio = of_get_property(np, "ralink,num-gpios", NULL);
> > > ++      ngpio = of_get_property(np, "ngpios", NULL);
> >
> > I guess you just went for the smallest patch that fixes the errors and
> > warnings?
> Correct, the goal of this patch was just to rename "ralink,num-gpios"
> to "ngpios".
>
> >
> > Based on my recent experience with linux-gpio, I think more things
> > would need to change too, for the driver to be upstream-compatible. But
> > I don't know what your plans are with this driver, so maybe this quick
> > fix is sufficient for OpenWrt.
> I wasn't planning on fixing all issues and upstreaming the driver, but
> may attempt that in the future. Just trying to make a step in the
> right direction here and save people time so they don't see these
> errors/warnings.

This whole driver probably needs a complete rewrite if you want to
upstream it. Multiple gpio nodes should be merged into one, bgpio_init
should be used to replace our current manual register operations,
and this num-gpios is a SoC-specific property, which should be
hard-coded in the driver and distinguished using compatible strings.
 I think current upstream gpio driver for mt7621 is a good start point.

It's on my to-do list but I probably won't find any time for it before
June.

-- 
Regards,
Chuanhong Guo



More information about the openwrt-devel mailing list