[PATCH] dm: core: allow DM_POST_INIT_F notification for TIMER_EARLY

Chanho Park chanho61.park at samsung.com
Tue Aug 8 09:35:37 CEST 2023


Since the Patch 55171aedda88, VisionFive2 booting has been broken [1].
VisionFive2 board requires to enable CONFIG_TIMER_EARLY but booting went
to panic from initr_dm_devices due to lack of a timer device.

- Error logs
initcall sequence 00000000fffd8d38 failed at call 00000000402185e4
(err=-19)

We can reproduce it on Qemu Sifive HiFive Unleashed emulation[2] after
enabling CONFIG_TIMER_EARLY manually.

[1]: https://lists.denx.de/pipermail/u-boot/2023-June/521220.html
[2]: https://www.qemu.org/docs/master/system/riscv/sifive_u.html#running-u-boot
Fixes: 55171aedda88 ("dm: Emit the arch_cpu_init_dm() even only before relocation")
Cc: Simon Glass <sjg at chromium.org>
Cc: Bin Meng <bmeng.cn at gmail.com>
Signed-off-by: Chanho Park <chanho61.park at samsung.com>
---
 drivers/core/root.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/core/root.c b/drivers/core/root.c
index 6775fb0b6575..e939da484b2a 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -436,7 +436,8 @@ int dm_init_and_scan(bool pre_reloc_only)
 			return ret;
 		}
 	}
-	if (CONFIG_IS_ENABLED(DM_EVENT) && !(gd->flags & GD_FLG_RELOC)) {
+	if (CONFIG_IS_ENABLED(DM_EVENT) &&
+	    (!(gd->flags & GD_FLG_RELOC) || CONFIG_IS_ENABLED(TIMER_EARLY))) {
 		ret = event_notify_null(EVT_DM_POST_INIT_F);
 		if (ret)
 			return log_msg_ret("ev", ret);
-- 
2.39.2



More information about the U-Boot mailing list