dm: Emit the arch_cpu_init_dm() even only before relocation
authorSimon Glass <sjg@chromium.org>
Thu, 4 May 2023 22:50:45 +0000 (16:50 -0600)
committerBin Meng <bmeng@tinylab.org>
Thu, 11 May 2023 02:25:29 +0000 (10:25 +0800)
The original function was only called once, before relocation. The new
one is called again after relocation. This was not the intent of the
original call. Fix this by renaming and updating the calling logic.

With this, chromebook_link64 makes it through SPL.

Fixes: 7fe32b3442f0 ("event: Convert arch_cpu_init_dm() to use events")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
18 files changed:
arch/arm/mach-imx/imx8/cpu.c
arch/arm/mach-imx/imx8m/soc.c
arch/arm/mach-imx/imx8ulp/soc.c
arch/arm/mach-imx/imx9/soc.c
arch/arm/mach-omap2/am33xx/board.c
arch/arm/mach-omap2/hwinit-common.c
arch/mips/mach-pic32/cpu.c
arch/nios2/cpu/cpu.c
arch/riscv/cpu/cpu.c
arch/x86/cpu/baytrail/cpu.c
arch/x86/cpu/broadwell/cpu.c
arch/x86/cpu/ivybridge/cpu.c
arch/x86/cpu/quark/quark.c
arch/x86/lib/fsp2/fsp_init.c
doc/develop/event.rst
drivers/core/root.c
drivers/cpu/microblaze_cpu.c
include/event.h

index be1f4ed..99772f6 100644 (file)
@@ -89,7 +89,7 @@ static int imx8_init_mu(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT, imx8_init_mu);
+EVENT_SPY(EVT_DM_POST_INIT_F, imx8_init_mu);
 
 #if defined(CONFIG_ARCH_MISC_INIT)
 int arch_misc_init(void)
index 4705e6c..5a4f835 100644 (file)
@@ -549,7 +549,7 @@ static int imx8m_check_clock(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT, imx8m_check_clock);
+EVENT_SPY(EVT_DM_POST_INIT_F, imx8m_check_clock);
 
 static void imx8m_setup_snvs(void)
 {
index 8424332..81eae02 100644 (file)
@@ -808,7 +808,7 @@ static int imx8ulp_evt_dm_post_init(void *ctx, struct event *event)
 {
        return imx8ulp_dm_post_init();
 }
-EVENT_SPY(EVT_DM_POST_INIT, imx8ulp_evt_dm_post_init);
+EVENT_SPY(EVT_DM_POST_INIT_F, imx8ulp_evt_dm_post_init);
 
 #if defined(CONFIG_SPL_BUILD)
 __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
index a16e22e..252663a 100644 (file)
@@ -262,7 +262,7 @@ int imx9_probe_mu(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT, imx9_probe_mu);
+EVENT_SPY(EVT_DM_POST_INIT_F, imx9_probe_mu);
 
 int timer_init(void)
 {
index a52d04d..ecc0a59 100644 (file)
@@ -535,4 +535,4 @@ static int am33xx_dm_post_init(void *ctx, struct event *event)
 #endif
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT, am33xx_dm_post_init);
+EVENT_SPY(EVT_DM_POST_INIT_F, am33xx_dm_post_init);
index c4a8eab..7715333 100644 (file)
@@ -246,7 +246,7 @@ static int omap2_system_init(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT, omap2_system_init);
+EVENT_SPY(EVT_DM_POST_INIT_F, omap2_system_init);
 
 /*
  * Routine: wait_for_command_complete
index de449e3..ec3c250 100644 (file)
@@ -102,7 +102,7 @@ static int pic32_flash_prefetch(void *ctx, struct event *event)
        prefetch_init();
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT, pic32_flash_prefetch);
+EVENT_SPY(EVT_DM_POST_INIT_F, pic32_flash_prefetch);
 
 /* Un-gate DDR2 modules (gated by default) */
 static void ddr2_pmd_ungate(void)
index 8554450..da167f4 100644 (file)
@@ -80,7 +80,7 @@ static int nios_cpu_setup(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT, nios_cpu_setup);
+EVENT_SPY(EVT_DM_POST_INIT_F, nios_cpu_setup);
 
 static int altera_nios2_get_desc(const struct udevice *dev, char *buf,
                                 int size)
index e1ed4ec..ecfb1fb 100644 (file)
@@ -145,7 +145,7 @@ int riscv_cpu_setup(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT, riscv_cpu_setup);
+EVENT_SPY(EVT_DM_POST_INIT_F, riscv_cpu_setup);
 
 int arch_early_init_r(void)
 {
index 4fb6a48..4a7b4f6 100644 (file)
@@ -64,7 +64,7 @@ static int baytrail_uart_init(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT, baytrail_uart_init);
+EVENT_SPY(EVT_DM_POST_INIT_F, baytrail_uart_init);
 
 static void set_max_freq(void)
 {
index 7877961..f30aebf 100644 (file)
@@ -40,7 +40,7 @@ static int broadwell_init_cpu(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT, broadwell_init_cpu);
+EVENT_SPY(EVT_DM_POST_INIT_F, broadwell_init_cpu);
 
 void set_max_freq(void)
 {
index cffc5d5..c988d7f 100644 (file)
@@ -86,7 +86,7 @@ static int ivybridge_cpu_init(void *ctx, struct event *ev)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT, ivybridge_cpu_init);
+EVENT_SPY(EVT_DM_POST_INIT_F, ivybridge_cpu_init);
 
 #define PCH_EHCI0_TEMP_BAR0 0xe8000000
 #define PCH_EHCI1_TEMP_BAR0 0xe8000400
index 0a1fbb3..1be8e38 100644 (file)
@@ -263,7 +263,7 @@ static int quark_init_pcie(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT, quark_init_pcie);
+EVENT_SPY(EVT_DM_POST_INIT_F, quark_init_pcie);
 
 int checkcpu(void)
 {
index b15926e..afec7d0 100644 (file)
@@ -42,7 +42,7 @@ int fsp_setup_pinctrl(void *ctx, struct event *event)
 
        return ret;
 }
-EVENT_SPY(EVT_DM_POST_INIT, fsp_setup_pinctrl);
+EVENT_SPY(EVT_DM_POST_INIT_F, fsp_setup_pinctrl);
 
 #if !defined(CONFIG_TPL_BUILD)
 binman_sym_declare(ulong, intel_fsp_m, image_pos);
index e60cbf6..1c1c9ef 100644 (file)
@@ -11,7 +11,7 @@ block device is probed.
 Rather than using weak functions and direct calls across subsystemss, it is
 often easier to use an event.
 
-An event consists of a type (e.g. EVT_DM_POST_INIT) and some optional data,
+An event consists of a type (e.g. EVT_DM_POST_INIT_F) and some optional data,
 in `union event_data`. An event spy can be created to watch for events of a
 particular type. When the event is created, it is sent to each spy in turn.
 
@@ -26,9 +26,9 @@ To declare a spy, use something like this::
         /* do something */
         return 0;
     }
-    EVENT_SPY(EVT_DM_POST_INIT, snow_setup_cpus);
+    EVENT_SPY(EVT_DM_POST_INIT_F, snow_setup_cpus);
 
-Your function is called when EVT_DM_POST_INIT is emitted, i.e. after driver
+Your function is called when EVT_DM_POST_INIT_F is emitted, i.e. after driver
 model is inited (in SPL, or in U-Boot proper before and after relocation).
 
 
index c4fb485..6775fb0 100644 (file)
@@ -436,8 +436,8 @@ int dm_init_and_scan(bool pre_reloc_only)
                        return ret;
                }
        }
-       if (CONFIG_IS_ENABLED(DM_EVENT)) {
-               ret = event_notify_null(EVT_DM_POST_INIT);
+       if (CONFIG_IS_ENABLED(DM_EVENT) && !(gd->flags & GD_FLG_RELOC)) {
+               ret = event_notify_null(EVT_DM_POST_INIT_F);
                if (ret)
                        return log_msg_ret("ev", ret);
        }
index b9d0792..c97a89f 100644 (file)
@@ -29,7 +29,7 @@ static int microblaze_cpu_probe_all(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT, microblaze_cpu_probe_all);
+EVENT_SPY(EVT_DM_POST_INIT_F, microblaze_cpu_probe_all);
 
 static void microblaze_set_cpuinfo_pvr(struct microblaze_cpuinfo *ci)
 {
index e4580b6..fe41080 100644 (file)
@@ -22,7 +22,7 @@ enum event_t {
        EVT_TEST,
 
        /* Events related to driver model */
-       EVT_DM_POST_INIT,
+       EVT_DM_POST_INIT_F,
        EVT_DM_PRE_PROBE,
        EVT_DM_POST_PROBE,
        EVT_DM_PRE_REMOVE,