Merge branch 'master_sh/gen4/mmcfix' of https://source.denx.de/u-boot/custodians...
[platform/kernel/u-boot.git] / common / board_r.c
index 98653de..6b4180b 100644 (file)
@@ -155,7 +155,7 @@ static int initr_reloc_global_data(void)
         * The fdt_blob needs to be moved to new relocation address
         * incase of FDT blob is embedded with in image
         */
-       if (CONFIG_IS_ENABLED(OF_EMBED) && CONFIG_IS_ENABLED(NEEDS_MANUAL_RELOC))
+       if (IS_ENABLED(CONFIG_OF_EMBED) && IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC))
                gd->fdt_blob += gd->reloc_off;
 
 #ifdef CONFIG_EFI_LOADER
@@ -346,7 +346,7 @@ static int initr_flash(void)
         * NOTE: Maybe we should add some schedule()? XXX
         */
        if (env_get_yesno("flashchecksum") == 1) {
-               const uchar *flash_base = (const uchar *)CONFIG_SYS_FLASH_BASE;
+               const uchar *flash_base = (const uchar *)CFG_SYS_FLASH_BASE;
 
                printf("  CRC: %08X", crc32(0,
                                            flash_base,
@@ -356,8 +356,8 @@ static int initr_flash(void)
        putc('\n');
 
        /* update start of FLASH memory    */
-#ifdef CONFIG_SYS_FLASH_BASE
-       bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
+#ifdef CFG_SYS_FLASH_BASE
+       bd->bi_flashstart = CFG_SYS_FLASH_BASE;
 #endif
        /* size of FLASH memory (final value) */
        bd->bi_flashsize = flash_size;
@@ -370,7 +370,7 @@ static int initr_flash(void)
 #if defined(CONFIG_OXC) || defined(CONFIG_RMU)
        /* flash mapped at end of memory map */
        bd->bi_flashoffset = CONFIG_TEXT_BASE + flash_size;
-#elif CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE
+#elif CONFIG_SYS_MONITOR_BASE == CFG_SYS_FLASH_BASE
        bd->bi_flashoffset = monitor_flash_len; /* reserved area for monitor */
 #endif
        return 0;
@@ -452,8 +452,8 @@ static int initr_env(void)
                env_set_hex("fdtcontroladdr",
                            (unsigned long)map_to_sysmem(gd->fdt_blob));
 
-       #if (CONFIG_IS_ENABLED(SAVE_PREV_BL_INITRAMFS_START_ADDR) || \
-                                               CONFIG_IS_ENABLED(SAVE_PREV_BL_FDT_ADDR))
+       #if (IS_ENABLED(CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR) || \
+                                               IS_ENABLED(CONFIG_SAVE_PREV_BL_FDT_ADDR))
                save_prev_bl_data();
        #endif
 
@@ -533,7 +533,7 @@ static int initr_ide(void)
 }
 #endif
 
-#if defined(CONFIG_PRAM)
+#if defined(CFG_PRAM)
 /*
  * Export available size of memory for Linux, taking into account the
  * protected RAM at top of memory
@@ -543,7 +543,7 @@ int initr_mem(void)
        ulong pram = 0;
        char memsz[32];
 
-       pram = env_get_ulong("pram", 10, CONFIG_PRAM);
+       pram = env_get_ulong("pram", 10, CFG_PRAM);
        sprintf(memsz, "%ldk", (long int)((gd->ram_size / 1024) - pram));
        env_set("mem", memsz);
 
@@ -569,6 +569,13 @@ static int dm_announce(void)
                        printf("Warning: Unexpected devicetree source (not from a prior stage)");
                        printf("Warning: U-Boot may not function properly\n");
                }
+               if (IS_ENABLED(CONFIG_OF_TAG_MIGRATE) &&
+                   (gd->flags & GD_FLG_OF_TAG_MIGRATE))
+                       /*
+                        * U-Boot will silently fail to work after 2023.07 if
+                        * there are old tags present
+                        */
+                       printf("Warning: Device tree includes old 'u-boot,dm-' tags: please fix by 2023.07!\n");
        }
 
        return 0;
@@ -579,6 +586,9 @@ static int run_main_loop(void)
 #ifdef CONFIG_SANDBOX
        sandbox_main_loop_init();
 #endif
+
+       event_notify_null(EVT_MAIN_LOOP);
+
        /* main_loop() can return to retry autoboot, if so just run it again */
        for (;;)
                main_loop();
@@ -606,7 +616,7 @@ static init_fnc_t init_sequence_r[] = {
         */
 #endif
        initr_reloc_global_data,
-#if CONFIG_IS_ENABLED(NEEDS_MANUAL_RELOC) && CONFIG_IS_ENABLED(EVENT)
+#if IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC) && CONFIG_IS_ENABLED(EVENT)
        event_manual_reloc,
 #endif
 #if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
@@ -614,7 +624,6 @@ static init_fnc_t init_sequence_r[] = {
 #endif
        initr_barrier,
        initr_malloc,
-       cyclic_init,
        log_init,
        initr_bootstage,        /* Needs malloc() but has its own timer */
 #if defined(CONFIG_CONSOLE_RECORD)
@@ -692,7 +701,7 @@ static init_fnc_t init_sequence_r[] = {
        /* initialize higher level parts of CPU like time base and timers */
        cpu_init_r,
 #endif
-#ifdef CONFIG_EFI_SETUP_EARLY
+#ifdef CONFIG_EFI_LOADER
        efi_init_early,
 #endif
 #ifdef CONFIG_CMD_NAND
@@ -754,9 +763,6 @@ static init_fnc_t init_sequence_r[] = {
        initr_status_led,
 #endif
        /* PPC has a udelay(20) here dating from 2002. Why? */
-#if defined(CONFIG_GPIO_HOG)
-       gpio_hog_probe_all,
-#endif
 #ifdef CONFIG_BOARD_LATE_INIT
        board_late_init,
 #endif
@@ -789,7 +795,7 @@ static init_fnc_t init_sequence_r[] = {
         */
        last_stage_init,
 #endif
-#if defined(CONFIG_PRAM)
+#if defined(CFG_PRAM)
        initr_mem,
 #endif
        run_main_loop,
@@ -798,6 +804,15 @@ static init_fnc_t init_sequence_r[] = {
 void board_init_r(gd_t *new_gd, ulong dest_addr)
 {
        /*
+        * The pre-relocation drivers may be using memory that has now gone
+        * away. Mark serial as unavailable - this will fall back to the debug
+        * UART if available.
+        *
+        * Do the same with log drivers since the memory may not be available.
+        */
+       gd->flags &= ~(GD_FLG_SERIAL_READY | GD_FLG_LOG_READY);
+
+       /*
         * Set up the new global data pointer. So far only x86 does this
         * here.
         * TODO(sjg@chromium.org): Consider doing this for all archs, or