AM62 SIP has 512MB RAM. But the top of the RAM is reserved for TF-A and OPTEE. U-Boot relocating there would cause overwriting of these reserved regions. Fix this by limit U-Boot to first 64MB of RAM for all boards with 512MB.
Signed-off-by: Vignesh Raghavendra <vigne...@ti.com> Signed-off-by: Nitin Yadav <n-ya...@ti.com> --- board/ti/am62x/evm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c index ad93908840..ad3e415592 100644 --- a/board/ti/am62x/evm.c +++ b/board/ti/am62x/evm.c @@ -18,6 +18,7 @@ #include <asm/io.h> #include <asm/arch/hardware.h> #include <dm/uclass.h> +#include <linux/sizes.h> DECLARE_GLOBAL_DATA_PTR; @@ -59,6 +60,16 @@ int dram_init_banksize(void) return fdtdec_setup_memory_banksize(); } +phys_size_t get_effective_memsize(void) +{ + /* + * Just below 512MB are TF-A and OPTEE reserve regions, thus + * SPL/U-Boot RAM has to start below that. Leave 64MB space for + * all reserved memories. + */ + return gd->ram_size == SZ_512M ? SZ_512M - SZ_64M : gd->ram_size; +} + #if defined(CONFIG_SPL_BUILD) static int video_setup(void) { -- 2.25.1