summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlias Apalodimas <[email protected]>2026-06-17 10:48:20 +0300
committerTom Rini <[email protected]>2026-06-24 18:13:24 -0600
commit15b35e4289e11f1ab201701dfb6dc0232b30be48 (patch)
tree6a55baad0cf73449040a3723b4c29be018fcf6eb
parent1174c99ab421168221be372bd83a4143bf5f167d (diff)
common: move ram_base calculation to independent INITCALL()
Currently, ram_base is calculated within setup_dest_addr(). However, upcoming patches that enable U-Boot relocation to the highest DRAM bank require ram_base to be initialized earlier. The default dram_init_banksize() definition relies on ram_base to calculate the start of the first bank. But following patches will move that function to execute immediately before setup_dest_addr(). So let's split the ram_base initialization in its own INITCALL. Reviewed-by: Simon Glass <[email protected]> Tested-by: Anshul Dalal <[email protected]> Tested-by: Michal Simek <[email protected]> # Versal Gen 2 Vek385 Reviewed-by: Marek Vasut <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]> Tested-by: Christophe Leroy (CS GROUP) <[email protected]>
-rw-r--r--common/board_f.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/common/board_f.c b/common/board_f.c
index a3abec35271..e169ed93091 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -328,6 +328,14 @@ __weak int arch_setup_dest_addr(void)
return 0;
}
+static int setup_ram_base(void)
+{
+#ifdef CFG_SYS_SDRAM_BASE
+ gd->ram_base = CFG_SYS_SDRAM_BASE;
+#endif
+ return 0;
+}
+
static int setup_dest_addr(void)
{
int ret;
@@ -350,9 +358,6 @@ static int setup_dest_addr(void)
*/
gd->ram_size -= CONFIG_SYS_MEM_TOP_HIDE;
#endif
-#ifdef CFG_SYS_SDRAM_BASE
- gd->ram_base = CFG_SYS_SDRAM_BASE;
-#endif
gd->ram_top = gd->ram_base + get_effective_memsize();
gd->ram_top = board_get_usable_ram_top(gd->mon_len);
gd->relocaddr = gd->ram_top;
@@ -977,6 +982,7 @@ static void initcall_run_f(void)
* - monitor code
* - board info struct
*/
+ INITCALL(setup_ram_base);
INITCALL(setup_dest_addr);
#if CONFIG_IS_ENABLED(OF_BOARD_FIXUP) && \
!CONFIG_IS_ENABLED(OF_INITIAL_DTB_READONLY)