summaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
authorQuentin Schulz <quentin.schulz@theobroma-systems.com>2022-09-22 18:53:25 +0300
committerTom Rini <trini@konsulko.com>2023-01-12 22:06:16 +0300
commit942918f2acd3634dee7813f7b9f801ffd54d9f2e (patch)
treea935fbb2114983cab7d2da1246380c0863b13296 /drivers/core
parentd0ba0ca45a49d6a062d0bc94b3380ea9b9616284 (diff)
downloadu-boot-942918f2acd3634dee7813f7b9f801ffd54d9f2e.tar.xz
dm: fix probing of all devices that have u-boot, dm-pre-reloc in SPL/TPL
Currently, dm_probe_devices checks that the flags of the device contains DM_FLAG_PRE_RELOC. However DM_FLAG_PRE_RELOC is a driver - and not a device - flag. This means that the check in pre_reloc_only mode would always fail. Instead, what was aimed to be checked is that either the driver of the device has the flag set, or that the device has the u-boot,dm-pre-reloc Device Tree property set. So let's fix the check to allow u-boot,dm-pre-reloc devices to be probed. Cc: Quentin Schulz <foss+uboot@0leil.net> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/root.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/core/root.c b/drivers/core/root.c
index f24ddfa521..c4fb48548b 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -363,20 +363,22 @@ void *dm_priv_to_rw(void *priv)
static int dm_probe_devices(struct udevice *dev, bool pre_reloc_only)
{
- u32 mask = DM_FLAG_PROBE_AFTER_BIND;
- u32 flags = dev_get_flags(dev);
+ ofnode node = dev_ofnode(dev);
struct udevice *child;
int ret;
- if (pre_reloc_only)
- mask |= DM_FLAG_PRE_RELOC;
+ if (pre_reloc_only &&
+ (!ofnode_valid(node) || !ofnode_pre_reloc(node)) &&
+ !(dev->driver->flags & DM_FLAG_PRE_RELOC))
+ goto probe_children;
- if ((flags & mask) == mask) {
+ if (dev_get_flags(dev) & DM_FLAG_PROBE_AFTER_BIND) {
ret = device_probe(dev);
if (ret)
return ret;
}
+probe_children:
list_for_each_entry(child, &dev->child_head, sibling_node)
dm_probe_devices(child, pre_reloc_only);