[PATCH next RFC 3/5] rockchip: spl/tpl: panic when DRAM init failed
Quentin Schulz
foss+uboot at 0leil.net
Tue Nov 5 18:21:57 CET 2024
From: Quentin Schulz <quentin.schulz at cherry.de>
A failed DRAM init is synonym with a broken board, so let's panic
instead of silently skipping the rest of the xPL stage and making it
fail later in some other code parts.
This also has the benefit of (by default) resetting the CPU which could
help recover the device without human intervention were the DRAM init
issue related to not-100%-reproducibly fail the DRAM init.
Signed-off-by: Quentin Schulz <quentin.schulz at cherry.de>
---
arch/arm/mach-rockchip/spl.c | 7 +++----
arch/arm/mach-rockchip/tpl.c | 6 ++----
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
index f4d29bbdd17e8b57dc0b2fdd90a8600fba6ee866..9b2d7023fb862bf696ad376b6f0b30e834aa41be 100644
--- a/arch/arm/mach-rockchip/spl.c
+++ b/arch/arm/mach-rockchip/spl.c
@@ -112,10 +112,9 @@ void board_init_f(ulong dummy)
#if !defined(CONFIG_TPL) || defined(CONFIG_SPL_RAM)
debug("\nspl:init dram\n");
ret = dram_init();
- if (ret) {
- printf("DRAM init failed: %d\n", ret);
- return;
- }
+ if (ret)
+ panic("DRAM init failed: %d\n", ret);
+
gd->ram_top = gd->ram_base + get_effective_memsize();
gd->ram_top = board_get_usable_ram_top(gd->ram_size);
diff --git a/arch/arm/mach-rockchip/tpl.c b/arch/arm/mach-rockchip/tpl.c
index bbb9329e725af79ea4c4049aa7890a4a143e7df5..5da23913c147cab18377f09b566f28b0bee4e935 100644
--- a/arch/arm/mach-rockchip/tpl.c
+++ b/arch/arm/mach-rockchip/tpl.c
@@ -55,10 +55,8 @@ void board_init_f(ulong dummy)
timer_init();
ret = uclass_get_device(UCLASS_RAM, 0, &dev);
- if (ret) {
- printf("DRAM init failed: %d\n", ret);
- return;
- }
+ if (ret)
+ panic("DRAM init failed: %d\n", ret);
}
int board_return_to_bootrom(struct spl_image_info *spl_image,
--
2.47.0
More information about the U-Boot
mailing list