[PATCH v2 4/4] common: Allow relocations on the top of the last bank

Anshul Dalal anshuld at ti.com
Wed Apr 1 12:25:01 CEST 2026


On Tue, 31 Mar 2026 11:01:14 +0300, Ilias Apalodimas <ilias.apalodimas at linaro.org> wrote:
> diff --git a/common/board_f.c b/common/board_f.c
> index df2b0dc899b..4270f368e65 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -321,6 +323,19 @@ __weak phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
>  		 */
>  		return 0;
>  #endif
> +	if (IS_ENABLED(CONFIG_RELOCATE_LAST_BANK)) {
> +		phys_addr_t old_top = gd->ram_top;
> +
> +		ret = fdtdec_setup_mem_ram_top();
> +		if (ret)
> +			debug("failed to relocate to ram top");

Should we not do an early exit here in case of failure?

> +		ret = fdtdec_setup_ram_size();
> +		if (ret) {
> +			debug("failed to calculate RAM size");
> +			gd->ram_top = old_top;

This should be redundant since fdtdec_setup_mem_ram_top already resets to
old_top in case of failure and fdtdec_setup_ram_size only modifies gd->ram_size.

-- 
Anshul Dalal <anshuld at ti.com>


More information about the U-Boot mailing list