[RFC 1/2] rockchip: sdram: Allow board/soc specific RAM bank logic

Chris Morgan macroalpha82 at gmail.com
Sat Mar 30 06:05:14 CET 2024


From: Chris Morgan <macromorgan at hotmail.com>

Allow individual boards or SoCs to alter the RAM bank addition logic
by defining a __weak function that these boards can then override
if needed. In the event this function fails, fallback to the default
detection logic.

Signed-off-by: Chris Morgan <macromorgan at hotmail.com>
---
 arch/arm/mach-rockchip/sdram.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/mach-rockchip/sdram.c b/arch/arm/mach-rockchip/sdram.c
index 0d9a0aef6f..53aa19feca 100644
--- a/arch/arm/mach-rockchip/sdram.c
+++ b/arch/arm/mach-rockchip/sdram.c
@@ -35,11 +35,18 @@ struct tos_parameter_t {
 	s64 reserve[8];
 };
 
+__weak int rk_get_ram_banks(void)
+{
+	return -EINVAL;
+}
+
 int dram_init_banksize(void)
 {
 	size_t ram_top = (unsigned long)(gd->ram_size + CFG_SYS_SDRAM_BASE);
 	size_t top = min((unsigned long)ram_top, (unsigned long)(gd->ram_top));
 
+	if (!rk_get_ram_banks())
+		return 0;
 #ifdef CONFIG_ARM64
 	/* Reserve 0x200000 for ATF bl31 */
 	gd->bd->bi_dram[0].start = 0x200000;
-- 
2.34.1



More information about the U-Boot mailing list