[PATCH v1 2/4] common: move ram_base calculation to independent INITCALL()

Ilias Apalodimas ilias.apalodimas at linaro.org
Fri Apr 10 07:10:28 CEST 2026


Apologies for the late reply

On Sun, 5 Apr 2026 at 07:32, Marek Vasut <marek.vasut at mailbox.org> wrote:
>
> On 4/3/26 11:01 AM, Ilias Apalodimas wrote:
> > 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.
> >
> > Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> > ---
> >   common/board_f.c | 12 +++++++++---
> >   1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/common/board_f.c b/common/board_f.c
> > index 91c569da9682..7df92281c35a 100644
> > --- a/common/board_f.c
> > +++ b/common/board_f.c
> > @@ -329,6 +329,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;
>
> Would it make sense to reset the variable to 0 in case
> CFG_SYS_SDRAM_BASE is not defined ?
>
> Or better yet, how about moving CFG_SYS_SDRAM_BASE to Kconfig with
> default value 0 ?

I did in fact test this. However boards set ram_base to values in
various places, so I didn't include it till we sort out the board mess
first. I'd like to keep it as is unless someone really minds.


Cheers
/Ilias


More information about the U-Boot mailing list