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

Tom Rini trini at konsulko.com
Thu Jun 20 22:16:17 CEST 2024


On Thu, Jun 13, 2024 at 11:59:05AM +0100, Chris Webb wrote:

> 48b3ecbe replumbed the gpio-hog probing to use DM_FLAG_PROBE_AFTER_BIND.
> 
> Unfortunately gpio_post_bind is called after the non-preloc recursive
> dm_probe_devices completes, so setting this flag does not have the intended
> effect and the gpio-hogs never get probed. With instrumentation:
> 
>   [...]
>   CPU:   MediaTek MT7981
>   Model: GL.iNet GL-X3000
>   DRAM:  512 MiB
>   <mtk_pinctrl_mt7981_bind called>
>   <dm_probe_devices called: root root_driver root_driver [+] [ ]>
>   <dm_probe_devices called: clk fixed_clock gpt_dummy20m [ ] [ ]>
>   [...]
>   <dm_probe_devices called: led gpio_led signal-4 [ ] [ ]>
>   Core:  34 devices, 14 uclasses, devicetree: separate
>   MMC:   <gpio_post_bind called>
>   mmc at 11230000: 0
>   [...]
> 
> Probe them directly in gpio_post_bind instead.
> 
> Signed-off-by: Chris Webb <chris at arachsys.com>
> ---
>  drivers/gpio/gpio-uclass.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
> index 4234cd91..1c6e1715 100644
> --- a/drivers/gpio/gpio-uclass.c
> +++ b/drivers/gpio/gpio-uclass.c
> @@ -1539,7 +1539,9 @@ static int gpio_post_bind(struct udevice *dev)
>  				 * since hogs can be essential to the hardware
>  				 * system.
>  				 */
> -				dev_or_flags(child, DM_FLAG_PROBE_AFTER_BIND);
> +				ret = device_probe(child);
> +				if (ret)
> +					return ret;
>  			}
>  		}
>  	}

Adding Marek, as the author of commit 48b3ecbedf82 ("gpio: Get rid of
gpio_hog_probe_all()").

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20240620/37d2b9c6/attachment.sig>


More information about the U-Boot mailing list