board: ti: am62x: Avoid overwriting reserve mem for AM62 SIP

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 256MB of RAM for all boards
with 512MB.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
This commit is contained in:
Vignesh Raghavendra 2023-09-22 19:46:47 +05:30 committed by Udit Kumar
parent 8a25b4e318
commit 64c0d9e010
1 changed files with 12 additions and 0 deletions

View File

@ -23,6 +23,8 @@
#include <asm/gpio.h>
#include <cpu_func.h>
#include <linux/sizes.h>
#include "../common/board_detect.h"
DECLARE_GLOBAL_DATA_PTR;
@ -86,6 +88,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 256MB space for
* all reserved memories.
*/
return gd->ram_size == SZ_512M ? SZ_256M : gd->ram_size;
}
#if defined(CONFIG_SPL_BUILD)
static int video_setup(void)
{