[PATCH] ARM: stm32mp: Fix dram_bank_mmu_setup() for ram_top=0

Patrice CHOTARD patrice.chotard at foss.st.com
Mon Mar 10 09:24:53 CET 2025



On 3/9/25 03:05, Marek Vasut wrote:
> On STM32MP15xx with 1 GiB of DRAM, the gd->ram_top becomes 0,
> because DRAM base 0xc0000000 + DRAM size 0x40000000 leads to
> gd->ram_top overflow which resets it to 0. Handle this special
> case simply by checking for gd->ram_top being zero, and if it
> is, assume there is no addr >= gd->ram_top .
> 
> This fixes boot hang on STM32MP15xx with 1 GiB of DRAM.
> 
> Fixes: 25fb58e88aba ("ARM: stm32mp: Fix dram_bank_mmu_setup() for LMB located above ram_top")
> Signed-off-by: Marek Vasut <marex at denx.de>
> ---
> Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> Cc: Lukasz Majewski <lukma at denx.de>
> Cc: Marek Vasut <marex at denx.de>
> Cc: Patrice Chotard <patrice.chotard at foss.st.com>
> Cc: Patrick Delaunay <patrick.delaunay at foss.st.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Sughosh Ganu <sughosh.ganu at linaro.org>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: u-boot at lists.denx.de
> Cc: uboot-stm32 at st-md-mailman.stormreply.com
> ---
>  arch/arm/mach-stm32mp/stm32mp1/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-stm32mp/stm32mp1/cpu.c b/arch/arm/mach-stm32mp/stm32mp1/cpu.c
> index cb1b84c9af9..d5eaf6711b6 100644
> --- a/arch/arm/mach-stm32mp/stm32mp1/cpu.c
> +++ b/arch/arm/mach-stm32mp/stm32mp1/cpu.c
> @@ -82,7 +82,7 @@ void dram_bank_mmu_setup(int bank)
>  		option = DCACHE_DEFAULT_OPTION;
>  		if (use_lmb &&
>  		    (lmb_is_reserved_flags(i << MMU_SECTION_SHIFT, LMB_NOMAP) ||
> -		    addr >= gd->ram_top)
> +		     (gd->ram_top && addr >= gd->ram_top))
>  		   )
>  			option = 0; /* INVALID ENTRY in TLB */
>  		set_section_dcache(i, option);


Hi Marek

Reviewed-by: Patrice Chotard <patrice.chotard at foss.st.com>

Thanks
Patrice



More information about the U-Boot mailing list