[PATCH v2 3/4] fdtdec: Introduce fdtdec_setup_ram_size() to determine the memory size

Marek Vasut marek.vasut at mailbox.org
Tue Mar 31 23:43:14 CEST 2026


On 3/31/26 10:01 AM, Ilias Apalodimas wrote:
> We previously added a fdtdec_setup_mem_ram_top() to determine the
> topmost address of the last DRAM bank. Similarly the overall memory
> size must be calculated when U-Boot gets relocated to the actual end of
> all available DRAM.
> 
> Pre-patch:
> U-Boot 2026.04-rc5-00012-g5789f787c8a6-dirty (Mar 31 2026 - 09:13:34 +0300)
> DRAM:  4 GiB (total 8 GiB)
> 
> Post-patch:
> U-Boot 2026.04-rc5-00012-g5789f787c8a6 (Mar 31 2026 - 09:12:59 +0300)
> DRAM:  8 GiB
> 
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> ---
>   include/fdtdec.h | 15 +++++++++++++++
>   lib/fdtdec.c     | 18 ++++++++++++++++++
>   2 files changed, 33 insertions(+)
> 
> diff --git a/include/fdtdec.h b/include/fdtdec.h
> index 26e40c3cdb46..9bccd70bbdb6 100644
> --- a/include/fdtdec.h
> +++ b/include/fdtdec.h
> @@ -965,6 +965,21 @@ int fdtdec_setup_mem_ram_top(void);
>    * invalid
>    */
>   int fdtdec_setup_memory_banksize(void);
> +/**
> + * fdtdec_setup_ram_size() - decode and setup setup gd->ram_size to the sum of
> + *			     all banks
> + *
> + * Decode the /memory 'reg' property to determine the memory available in all
> + * banks and populate the global data ram_size with it.
> + *
> + * This function should be called from a boards board_get_usable_ram_top().

Is the board_get_usable_ram_top() really the right place to call this ?
It feels like it is being conflated with ram_top here too.


More information about the U-Boot mailing list