ROM stores the boot params information in a known location
and passes it to SPL. This information needs to be copied
very early during boot or else there is a chance of getting
corrupted by SPL. So move this boot device detection very early
during boot.

Signed-off-by: Lokesh Vutla <lokeshvu...@ti.com>
---
 arch/arm/mach-omap2/am33xx/board.c  | 8 ++++++++
 arch/arm/mach-omap2/boot-common.c   | 7 -------
 arch/arm/mach-omap2/hwinit-common.c | 8 ++++++++
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/am33xx/board.c 
b/arch/arm/mach-omap2/am33xx/board.c
index 5f1bf9ce7c..db757d91fb 100644
--- a/arch/arm/mach-omap2/am33xx/board.c
+++ b/arch/arm/mach-omap2/am33xx/board.c
@@ -333,6 +333,14 @@ void early_system_init(void)
        set_uart_mux_conf();
        setup_early_clocks();
        uart_soft_reset();
+#ifdef CONFIG_SPL_BUILD
+       /*
+        * Save the boot parameters passed from romcode.
+        * We cannot delay the saving further than this,
+        * to prevent overwrites.
+        */
+       save_omap_boot_params();
+#endif
 #ifdef CONFIG_DEBUG_UART_OMAP
        debug_uart_init();
 #endif
diff --git a/arch/arm/mach-omap2/boot-common.c 
b/arch/arm/mach-omap2/boot-common.c
index b77506df83..700e6c2f79 100644
--- a/arch/arm/mach-omap2/boot-common.c
+++ b/arch/arm/mach-omap2/boot-common.c
@@ -195,13 +195,6 @@ u32 spl_boot_mode(const u32 boot_device)
 
 void spl_board_init(void)
 {
-       /*
-        * Save the boot parameters passed from romcode.
-        * We cannot delay the saving further than this,
-        * to prevent overwrites.
-        */
-       save_omap_boot_params();
-
        /* Prepare console output */
        preloader_console_init();
 
diff --git a/arch/arm/mach-omap2/hwinit-common.c 
b/arch/arm/mach-omap2/hwinit-common.c
index 7f6db3cf37..77368ee85f 100644
--- a/arch/arm/mach-omap2/hwinit-common.c
+++ b/arch/arm/mach-omap2/hwinit-common.c
@@ -158,6 +158,14 @@ void early_system_init(void)
        do_io_settings();
 #endif
        setup_early_clocks();
+#ifdef CONFIG_SPL_BUILD
+       /*
+        * Save the boot parameters passed from romcode.
+        * We cannot delay the saving further than this,
+        * to prevent overwrites.
+        */
+       save_omap_boot_params();
+#endif
        do_board_detect();
        vcores_init();
 #ifdef CONFIG_DEBUG_UART_OMAP
-- 
2.13.0

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to