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

Chris Webb chris at arachsys.com
Mon Jul 29 17:44:33 CEST 2024


Simon Glass <sjg at chromium.org> wrote:

> We cannot probe devices when they are bound since it breaks the
> ordering of driver model.
>
> From your trace it looks like everything is happening after
> relocation. I can't quite see what is actually going wrong. But if you
> look at dm_init_and_scan(), it does the probe at the end, immediately
> after all devices have been bound. So it should do what you want.
>
> Is the GPIO device not being bound? There is something strange here.

Hi Simon, many thanks for your follow up. Yes I wasn't convinced the patch  
was the correct fix (hence the RFC) but posted as it was one of the two  
ways I found to make gpio-hog work, the other being adding a .bind  
function in U_BOOT_DRIVER(mt7981_pinctrl) like

     static int mtk_pinctrl_mt7981_bind(struct udevice *dev)
     {
     	dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
     	return 0;
     }

to force a probe after bind in the parent pinctrl device. I was hoping  
someone with more clue than me might go 'Aha! This is just...'  :)

The device I tested on has been deployed but I can probably get it back  
for a bit and resolder a serial console on to test again if that would be  
helpful. Are there other significant places I should be adding some traces  
that would make the problem clearer?

Is it significant/relevant that the gpio device is a child of the pinctrl  
device in the mt7981 device tree?

I think the gpio device must be getting bound, because otherwise my trace  
in gpio_post_bind() wouldn't get called at all, but perhaps it's bound too  
late somehow?

Best wishes,

Chris.


More information about the U-Boot mailing list