Hi Chanho, On Tue, 8 Aug 2023 at 01:35, Chanho Park <chanho61.p...@samsung.com> wrote: > > 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 <s...@chromium.org> > Cc: Bin Meng <bmeng...@gmail.com> > Signed-off-by: Chanho Park <chanho61.p...@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 >
It looks like you need a new notification. The correct fix would be to add a new EVT_DM_POST_INIT_R event and emit that after relocation, e.g. if (CONFIG_IS_ENABLED(DM_EVENT) { ret = event_notify_null(gd->flags & GD_FLG_RELOC ? EVT_DM_POST_INIT_R : EVT_DM_POST_INIT_F); if (ret) return log_msg_ret("ev", ret); } Regards, Simon