[U-Boot] [PATCH 1/2] rockchip: allow DRAM init in SPL and fix ordering

Thomas Hebb tommyhebb at gmail.com
Sun Nov 10 16:25:32 UTC 2019


b7abef2ecbcc ("rockchip: rk3399: Migrate to use common spl board file")
removed SoC-specific code for RK3399's SPL and in the process introduced
two regressions:

 1. It caused the previously-unconditional DRAM initialization in
    board_init_f() to only happen when compiling a configuration that
    did not support TPL, meaning DRAM would never get initialized if TPL
    was supported but disabled.
 2. It reordered the DRAM initialization before rockchip_stimer_init(),
    which as far as I can tell causes RK3399 to lock up completely.

Fix both of these issues in the common code so that we can again boot
RK3399 without a TPL. This fixes custom configurations that have
disabled TPL, and it should also unbreak the "ficus-rk3399",
"rock960-rk3399", and "chromebook_bob" defconfigs, although since I
don't have any of those devices I can't confirm they're broken now.

Signed-off-by: Thomas Hebb <tommyhebb at gmail.com>
---
 arch/arm/mach-rockchip/spl.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
index 92102b39e7..089f0a5258 100644
--- a/arch/arm/mach-rockchip/spl.c
+++ b/arch/arm/mach-rockchip/spl.c
@@ -103,7 +103,7 @@ __weak int arch_cpu_init(void)
 void board_init_f(ulong dummy)
 {
 	int ret;
-#if !defined(CONFIG_SUPPORT_TPL) || defined(CONFIG_SPL_OS_BOOT)
+#if !defined(CONFIG_TPL) || defined(CONFIG_SPL_OS_BOOT)
 	struct udevice *dev;
 #endif
 
@@ -128,20 +128,20 @@ void board_init_f(ulong dummy)
 		hang();
 	}
 	arch_cpu_init();
-#if !defined(CONFIG_SUPPORT_TPL) || defined(CONFIG_SPL_OS_BOOT)
-	debug("\nspl:init dram\n");
-	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
-	if (ret) {
-		printf("DRAM init failed: %d\n", ret);
-		return;
-	}
-#endif
 #if !defined(CONFIG_ROCKCHIP_RK3188)
 	rockchip_stimer_init();
 #endif
 #ifdef CONFIG_SYS_ARCH_TIMER
 	/* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */
 	timer_init();
+#endif
+#if !defined(CONFIG_TPL) || defined(CONFIG_SPL_OS_BOOT)
+	debug("\nspl:init dram\n");
+	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
+	if (ret) {
+		printf("DRAM init failed: %d\n", ret);
+		return;
+	}
 #endif
 	preloader_console_init();
 }
-- 
2.23.0



More information about the U-Boot mailing list