From d19d9e1c064b6c782959d1da7bddf1e9da1c55d4 Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Wed, 17 Jun 2026 10:48:22 +0300 Subject: [PATCH] rpi: Add a local get_effective_memsize() We are about to change the place we call dram_init_banksize(). The goal is to have all the information we need to pick a proper relocation address in gd->dram[]. However, the RPI boards, and specifically the tested rpi4, seems to hang if we relocate anywhere above the address returned from bcm2835_mbox_call_prop(). So store that address and return it on get_effective_memsize() which is used to calculate ram_top. Reviewed-by: Simon Glass Tested-by: Simon Glass # rpi, rpi4 Signed-off-by: Ilias Apalodimas Tested-by: Christophe Leroy (CS GROUP) --- board/raspberrypi/rpi/rpi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 885c660a289..1da5df92351 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -39,6 +39,8 @@ DECLARE_GLOBAL_DATA_PTR; */ unsigned long __section(".data") fw_dtb_pointer; +static phys_addr_t discovered_ram_size; + /* TODO(sjg@chromium.org): Move these to the msg.c file */ struct msg_get_arm_mem { struct bcm2835_mbox_hdr hdr; @@ -335,10 +337,16 @@ int dram_init(void) * the u-boot's memory setup. */ gd->ram_size &= ~MMU_SECTION_SIZE; + discovered_ram_size = gd->ram_size; return 0; } +phys_size_t get_effective_memsize(void) +{ + return discovered_ram_size; +} + #ifdef CONFIG_OF_BOARD int dram_init_banksize(void) {