Skip to content

Commit cd48a21

Browse files
sjg20trini
authored andcommitted
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 21dd873. Signed-off-by: Simon Glass <[email protected]>
1 parent 4164289 commit cd48a21

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

common/board_f.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -822,13 +822,13 @@ static int initf_dm(void)
822822

823823
bootstage_start(BOOTSTAGE_ID_ACCUM_DM_F, "dm_f");
824824
ret = dm_init_and_scan(true);
825-
bootstage_accum(BOOTSTAGE_ID_ACCUM_DM_F);
826825
if (ret)
827826
return ret;
828827

829828
ret = dm_autoprobe();
830829
if (ret)
831830
return ret;
831+
bootstage_accum(BOOTSTAGE_ID_ACCUM_DM_F);
832832

833833
if (IS_ENABLED(CONFIG_TIMER_EARLY)) {
834834
ret = dm_timer_init();

drivers/core/root.c

+12-5
Original file line numberDiff line numberDiff line change
@@ -295,22 +295,29 @@ void *dm_priv_to_rw(void *priv)
295295
* all its children recursively to do the same.
296296
*
297297
* @dev: Device to (maybe) probe
298+
* @pre_reloc_only: Probe only devices marked with the DM_FLAG_PRE_RELOC flag
298299
* Return 0 if OK, -ve on error
299300
*/
300-
static int dm_probe_devices(struct udevice *dev)
301+
static int dm_probe_devices(struct udevice *dev, bool pre_reloc_only)
301302
{
303+
ofnode node = dev_ofnode(dev);
302304
struct udevice *child;
305+
int ret;
303306

304-
if (dev_get_flags(dev) & DM_FLAG_PROBE_AFTER_BIND) {
305-
int ret;
307+
if (pre_reloc_only &&
308+
(!ofnode_valid(node) || !ofnode_pre_reloc(node)) &&
309+
!(dev->driver->flags & DM_FLAG_PRE_RELOC))
310+
goto probe_children;
306311

312+
if (dev_get_flags(dev) & DM_FLAG_PROBE_AFTER_BIND) {
307313
ret = device_probe(dev);
308314
if (ret)
309315
return ret;
310316
}
311317

318+
probe_children:
312319
list_for_each_entry(child, &dev->child_head, sibling_node)
313-
dm_probe_devices(child);
320+
dm_probe_devices(child, pre_reloc_only);
314321

315322
return 0;
316323
}
@@ -319,7 +326,7 @@ int dm_autoprobe(void)
319326
{
320327
int ret;
321328

322-
ret = dm_probe_devices(gd->dm_root);
329+
ret = dm_probe_devices(gd->dm_root, !(gd->flags & GD_FLG_RELOC));
323330
if (ret)
324331
return log_msg_ret("pro", ret);
325332

0 commit comments

Comments
 (0)