aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-stm32mp
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@foss.st.com>2023-10-27 16:42:59 +0200
committerPatrice Chotard <patrice.chotard@foss.st.com>2023-11-13 10:55:38 +0100
commit75ba0fd570c850b92dfd43d873bab877b4a1b73b (patch)
treebeb036e56c9531e477ec32a3105e9436a358664f /arch/arm/mach-stm32mp
parentee15c72da261b2d4b27ffcdccc2af8b2797c37fc (diff)
downloadu-boot-75ba0fd570c850b92dfd43d873bab877b4a1b73b.zip
u-boot-75ba0fd570c850b92dfd43d873bab877b4a1b73b.tar.gz
u-boot-75ba0fd570c850b92dfd43d873bab877b4a1b73b.tar.bz2
stm32mp: dram_init: Limit DDR usage under 4GB boundary for STM32MP
Limit DDR usage under 4GB boundary on STM32MP regardless of memory size declared in device tree. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Diffstat (limited to 'arch/arm/mach-stm32mp')
-rw-r--r--arch/arm/mach-stm32mp/dram_init.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/arm/mach-stm32mp/dram_init.c b/arch/arm/mach-stm32mp/dram_init.c
index cb35ed6..fb1208f 100644
--- a/arch/arm/mach-stm32mp/dram_init.c
+++ b/arch/arm/mach-stm32mp/dram_init.c
@@ -52,9 +52,15 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
if (!total_size)
return gd->ram_top;
+ /*
+ * make sure U-Boot uses address space below 4GB boundaries even
+ * if the effective available memory is bigger
+ */
+ gd->ram_top = clamp_val(gd->ram_top, 0, SZ_4G - 1);
+
/* found enough not-reserved memory to relocated U-Boot */
lmb_init(&lmb);
- lmb_add(&lmb, gd->ram_base, get_effective_memsize());
+ lmb_add(&lmb, gd->ram_base, gd->ram_top - gd->ram_base);
boot_fdt_add_mem_rsv_regions(&lmb, (void *)gd->fdt_blob);
/* add 8M for reserved memory for display, fdt, gd,... */
size = ALIGN(SZ_8M + CONFIG_SYS_MALLOC_LEN + total_size, MMU_SECTION_SIZE),