]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
Revert "dm: core: Simplify dm_probe_devices()"
authorSimon Glass <sjg@chromium.org>
Wed, 26 Feb 2025 16:26:14 +0000 (09:26 -0700)
committerTom Rini <trini@konsulko.com>
Tue, 4 Mar 2025 14:22:10 +0000 (08:22 -0600)
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>
common/board_f.c
drivers/core/root.c

index 6c5c3bfab48d7e395df40e46184849ee20462a2f..99616fdac80ab5df3db05e1c6f291c01112ffe24 100644 (file)
@@ -822,13 +822,13 @@ static int initf_dm(void)
 
        bootstage_start(BOOTSTAGE_ID_ACCUM_DM_F, "dm_f");
        ret = dm_init_and_scan(true);
-       bootstage_accum(BOOTSTAGE_ID_ACCUM_DM_F);
        if (ret)
                return ret;
 
        ret = dm_autoprobe();
        if (ret)
                return ret;
+       bootstage_accum(BOOTSTAGE_ID_ACCUM_DM_F);
 
        if (IS_ENABLED(CONFIG_TIMER_EARLY)) {
                ret = dm_timer_init();
index 15b8c83fee989bd812e5f62e1aca6599a38e1f36..e53381e3b32a6e9d0358763a8f58d1ea58e79f66 100644 (file)
@@ -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);