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 <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>   # rpi, rpi4
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
This commit is contained in:
Ilias Apalodimas
2026-06-24 18:13:24 -06:00
committed by Tom Rini
parent 0943f107ce
commit d19d9e1c06
+8
View File
@@ -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)
{