[PATCH RFC] gpio: Fix probing of gpio-hogs

Simon Glass sjg at chromium.org
Wed Jul 31 16:38:55 CEST 2024


Hi Chris,

On Wed, 31 Jul 2024 at 04:14, Chris Webb <chris at arachsys.com> wrote:
>
> Hi Simon,
>
>
> Simon Glass <sjg at chromium.org> wrote:
>
> >> Presumably it needs to apply to every mtk soc that uses
> >> mtk_pinctrl_common_probe() as they'll all be affected by this problem.
> >
> > Yes I suppose so.
>
> As well as the mediatek case (patch just sent), I thought I should look
> through the other pinctrl drivers for other examples of this problem you
> explained to me.
>
> Both starfive/pinctrl-starfive.c and mvebu/pinctrl-armada-37xx.c do the
> same thing, calling their gpiochip_register as part of the driver probe
> method. The pinctrl-armada-37xx.c driver also has a bind action:
>
>    static int armada_37xx_pinctrl_bind(struct udevice *dev)
>    {
>            /*
>             * Make sure that the pinctrl driver gets probed after binding
>             * as on A37XX the pinctrl driver is the one that is also
>             * registering the GPIO one during probe, so if its not probed
>             * GPIO-s are not registered as well.
>             */
>            dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
>
>            return 0;
>    }
>
> which presumably wouldn't be needed if the gpiochip were bound at pinctrl
> bind time instead of pinctrl probe time?
>
> Alas I don't have any boards to test on for either of these platforms.

If you have the inclination it is still worth sending a patch. The
maintainer can check it. These sorts of counter-examples can be copied
and soon everyone is making the same mistake!

Regards,
Simon


More information about the U-Boot mailing list