
On 9/22/22 16:13, Quentin Schulz wrote:
[...]
@@ -1503,9 +1480,26 @@ static int gpio_post_bind(struct udevice *dev) &child); if (ret) return ret;
/*
* Make sure gpio-hogs are probed after bind
* since hogs can be essential to the hardware
* system.
*/
dev_or_flags(child, DM_FLAG_PROBE_AFTER_BIND);
/*
* Since gpio-hog is a U_BOOT_DRIVER and not
* a U_BOOT_CLASS, the DM core does not bind
* it and therefore it's up to this driver to
* set the DM_FLAG_PRE_RELOC appropriately.
*/
if (ofnode_pre_reloc(node))
dev_or_flags(child, DM_FLAG_PRE_RELOC);
This second part should be handled by the DM, or you need dm-pre-reloc in your GPIO controller in DT. This would fail e.g. in case your GPIO controller has higher depth of hog subnodes, like:
gpio-controller { something { gpio-hog { u-boot,dm-pre-reloc; }; }; };
Should really be:
gpio-controller { u-boot,dm-pre-reloc; something { u-boot,dm-pre-reloc; gpio-hog { u-boot,dm-pre-reloc; }; }; };
At some point, I had the idea to instead of littering the DT with u-boot,dm-pre-reloc , we could use phandles instead and do something like:
/ { config { u-boot,dm-pre-reloc = <&node1 &node2 ... &gpio_hog ...>; }; } ... gpio-controller { something { gpio_hog: gpio-hog { }; }; };