summaryrefslogtreecommitdiff
path: root/drivers/core/root.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-02-26 09:26:14 -0700
committerTom Rini <trini@konsulko.com>2025-03-04 08:22:10 -0600
commitcd48a21dbde69053894bfaefa3870f2054c91801 (patch)
treeced7f7d40b63396d53cdf9cacab2d7deacd9c888 /drivers/core/root.c
parent4164289db882ea50c694a456af623b0ab16495ef (diff)
Revert "dm: core: Simplify dm_probe_devices()"
Unfortunately this change was not safe as some devices are bound before relocation, but we don't want to probe them. It causes 'raise: Signal # 8 caught' on jerry. Move the bootstage timer to after autoprobe in initf_dm() since the trace test does not tolerate any variance. This reverts commit 21dd873572a01d74bfdfceb7a30b056f8ccba187. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/root.c')
-rw-r--r--drivers/core/root.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/core/root.c b/drivers/core/root.c
index 15b8c83fee9..e53381e3b32 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -295,22 +295,29 @@ void *dm_priv_to_rw(void *priv)
* all its children recursively to do the same.
*
* @dev: Device to (maybe) probe
+ * @pre_reloc_only: Probe only devices marked with the DM_FLAG_PRE_RELOC flag
* Return 0 if OK, -ve on error
*/
-static int dm_probe_devices(struct udevice *dev)
+static int dm_probe_devices(struct udevice *dev, bool pre_reloc_only)
{
+ ofnode node = dev_ofnode(dev);
struct udevice *child;
+ int ret;
- if (dev_get_flags(dev) & DM_FLAG_PROBE_AFTER_BIND) {
- int ret;
+ if (pre_reloc_only &&
+ (!ofnode_valid(node) || !ofnode_pre_reloc(node)) &&
+ !(dev->driver->flags & DM_FLAG_PRE_RELOC))
+ goto probe_children;
+ 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);
+ dm_probe_devices(child, pre_reloc_only);
return 0;
}
@@ -319,7 +326,7 @@ int dm_autoprobe(void)
{
int ret;
- ret = dm_probe_devices(gd->dm_root);
+ ret = dm_probe_devices(gd->dm_root, !(gd->flags & GD_FLG_RELOC));
if (ret)
return log_msg_ret("pro", ret);