diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c index ecfb1fb08c..0b4208e721 100644 --- a/arch/riscv/cpu/cpu.c +++ b/arch/riscv/cpu/cpu.c @@ -66,7 +66,7 @@ static inline bool supports_extension(char ext) #endif /* CONFIG_CPU */ } -static int riscv_cpu_probe(void) +static int riscv_cpu_probe(void *ctx, struct event *event) { #ifdef CONFIG_CPU int ret; @@ -79,6 +79,7 @@ static int riscv_cpu_probe(void) return 0; } +EVENT_SPY(EVT_DM_POST_INIT_R, riscv_cpu_probe); /* * This is called on secondary harts just after the IPI is init'd. Currently @@ -95,7 +96,7 @@ int riscv_cpu_setup(void *ctx, struct event *event) { int ret; - ret = riscv_cpu_probe(); + ret = riscv_cpu_probe(ctx, event); if (ret) return ret; @@ -149,12 +150,6 @@ EVENT_SPY(EVT_DM_POST_INIT_F, riscv_cpu_setup); int arch_early_init_r(void) { - int ret; - - ret = riscv_cpu_probe(); - if (ret) - return ret; - if (IS_ENABLED(CONFIG_SYSRESET_SBI)) device_bind_driver(gd->dm_root, "sbi-sysreset", "sbi-sysreset", NULL); diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig index e9b63e5b84..3002c96f0e 100644 --- a/configs/starfive_visionfive2_defconfig +++ b/configs/starfive_visionfive2_defconfig @@ -30,6 +30,7 @@ CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x82000000 CONFIG_SYS_PCI_64BIT=y CONFIG_PCI=y +CONFIG_PCI_INIT_R=y CONFIG_TARGET_STARFIVE_VISIONFIVE2=y CONFIG_SPL_OPENSBI_LOAD_ADDR=0x40000000 CONFIG_ARCH_RV64I=y @@ -43,7 +44,7 @@ CONFIG_SD_BOOT=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 debug rootwait earlycon=sbi" CONFIG_USE_PREBOOT=y -CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr};fdt addr ${fdtcontroladdr};" +CONFIG_PREBOOT="nvme scan; usb start; setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};" CONFIG_DEFAULT_FDT_FILE="starfive/jh7110-starfive-visionfive-2.dtb" CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_BOARDINFO=y @@ -124,4 +125,9 @@ CONFIG_TIMER_EARLY=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_PCI=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_PCI=y +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_OHCI_PCI=y +CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y diff --git a/drivers/core/root.c b/drivers/core/root.c index 6775fb0b65..79d871ab29 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -436,8 +436,10 @@ int dm_init_and_scan(bool pre_reloc_only) return ret; } } - if (CONFIG_IS_ENABLED(DM_EVENT) && !(gd->flags & GD_FLG_RELOC)) { - ret = event_notify_null(EVT_DM_POST_INIT_F); + 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); } diff --git a/include/event.h b/include/event.h index daf44bf8a8..bb38ba98e7 100644 --- a/include/event.h +++ b/include/event.h @@ -24,6 +24,7 @@ enum event_t { /* Events related to driver model */ EVT_DM_POST_INIT_F, + EVT_DM_POST_INIT_R, EVT_DM_PRE_PROBE, EVT_DM_POST_PROBE, EVT_DM_PRE_REMOVE,