Skip to contentSkip to conversation

board: verdin-am62: fix missing memory fixup call

PATCH In review Stefan Eichenberger 3 participants 3 messages Mar 3, 2025 – Mar 4, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board: verdin-am62: fix missing memory fixup call

From: Stefan Eichenberger <[email protected]>

The commit bc07851897bd ("board: ti: Pull redundant DDR functions to a common location and Fixup DDR size when ECC is enabled") broke DRAM support for the Verdin AM62. This was partially fixed with commit 3f866c47b582 ("board: verdin-am62: add dram_init_banksize"). However, because fixup_memory_node was not called, the Linux kernel was started with the wrong memory size on modules with less memory available. This resulted in boot failures. Fix this issue by calling fixup_memory_node in the board file.

spl_perform_fixups will be called in the SPL and now sets the correct memory size in the device tree of U-Boot by calling fixup_memory_node. U-Boot will then adjust the memory sizes of Linux during bootm/booti in fdt_fixup_memory_banks. This chain ensures that U-Boot and Linux only use RAM that is actually available.

Fixes 3f866c47b582 ("board: verdin-am62: add dram_init_banksize")
Fixes bc07851897bd ("board: ti: Pull redundant DDR functions to a common location and Fixup DDR size when ECC is enabled")
---
 board/toradex/verdin-am62/verdin-am62.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
board/toradex/verdin-am62/verdin-am62.c +11 -0
index b80b39b6767..a1c471111a0 100644
@@ -15,6 +15,7 @@
 #include <init.h>
 #include <k3-ddrss.h>
 #include <spl.h>
+#include <asm/arch/k3-ddr.h>
 
 #include "../common/tdx-cfg-block.h"
 
@@ -43,6 +44,9 @@ int dram_init_banksize(void)
 	if (ret)
 		printf("Error setting up memory banksize. %d\n", ret);
 
+	/* Use the detected RAM size, we only support 1 bank right now. */
+	gd->bd->bi_dram[0].size = gd->ram_size;
+
 	return ret;
 }
 
@@ -108,6 +112,13 @@ int board_late_init(void)
 #define CORE_VOLTAGE			0x80000000
 #define MCU_CTRL_LFXOSC_32K_BYPASS_VAL	BIT(4)
 
+#if IS_ENABLED(CONFIG_XPL_BUILD)
+void spl_perform_fixups(struct spl_image_info *spl_image)
+{
+	fixup_memory_node(spl_image);
+}
+#endif
+
 #ifdef CONFIG_SPL_BOARD_INIT
 void spl_board_init(void)
 {
Signature · 1 line
2.45.2
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Stefan Eichenberger

From: Stefan Eichenberger <[email protected]>

The commit bc07851897bd ("board: ti: Pull redundant DDR functions to a common location and Fixup DDR size when ECC is enabled") broke DRAM support for the Verdin AM62. This was partially fixed with commit 3f866c47b582 ("board: verdin-am62: add dram_init_banksize"). However, because fixup_memory_node was not called, the Linux kernel was started with the wrong memory size on modules with less memory available. This resulted in boot failures. Fix this issue by calling fixup_memory_node in the board file.

spl_perform_fixups will be called in the SPL and now sets the correct memory size in the device tree of U-Boot by calling fixup_memory_node. U-Boot will then adjust the memory sizes of Linux during bootm/booti in fdt_fixup_memory_banks. This chain ensures that U-Boot and Linux only use RAM that is actually available.

Quoted 3 lines
Fixes 3f866c47b582 ("board: verdin-am62: add dram_init_banksize")
Fixes bc07851897bd ("board: ti: Pull redundant DDR functions to a common location and Fixup DDR size when ECC is enabled")

Tom: this is needed in master, this fixes a regression, preventing Linux to boot, in v2025.04.

Thanks
Francesco

#2 lore raw
In reply to Stefan Eichenberger
Quoted 10 lines · Stefan Eichenberger

The commit bc07851897bd ("board: ti: Pull redundant DDR functions to a common location and Fixup DDR size when ECC is enabled") broke DRAM support for the Verdin AM62. This was partially fixed with commit 3f866c47b582 ("board: verdin-am62: add dram_init_banksize"). However, because fixup_memory_node was not called, the Linux kernel was started with the wrong memory size on modules with less memory available. This resulted in boot failures. Fix this issue by calling fixup_memory_node in the board file.

[...]

Applied to u-boot/master, thanks!

Signature · 1 line
Tom