From: Anshul Dalal Date: Fri, 17 Oct 2025 13:15:32 +0000 (+0530) Subject: mach-k3: add carveouts for TFA and optee X-Git-Tag: v2026.01-rc1~11^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f5285f0e640c3e9b40420ba3b11358446646b11;p=pandora-u-boot.git mach-k3: add carveouts for TFA and optee K3 platforms have reserved memory regions for TFA and OPTEE which should be unmapped for U-Boot. While other "no-map" memory regions like the memory pools for remote cores should not be unmapped to allow U-Boot to load firmware during remoteproc. Therefore this patch adds the necessary fdt fixups to properly set the load address for TFA/OPTEE and unmaps both by mmu_unmap_reserved_mem. Reviewed-by: Dhruva Gole Signed-off-by: Anshul Dalal Tested-by: Wadim Egorov --- diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c index f734f10b605..7c06764af82 100644 --- a/arch/arm/mach-k3/common.c +++ b/arch/arm/mach-k3/common.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT 0x00000001 @@ -263,6 +264,7 @@ void board_prep_linux(struct bootm_headers *images) void enable_caches(void) { + void *fdt = (void *)gd->fdt_blob; int ret; ret = mem_map_from_dram_banks(K3_MEM_MAP_FIRST_BANK_IDX, K3_MEM_MAP_LEN, @@ -273,6 +275,30 @@ void enable_caches(void) mmu_setup(); + if (CONFIG_K3_ATF_LOAD_ADDR >= CFG_SYS_SDRAM_BASE) { + ret = fdt_fixup_reserved(fdt, "tfa", CONFIG_K3_ATF_LOAD_ADDR, + 0x80000); + if (ret) + printf("%s: Failed to perform tfa fixups (%s)\n", + __func__, fdt_strerror(ret)); + ret = mmu_unmap_reserved_mem("tfa", true); + if (ret) + printf("%s: Failed to unmap tfa reserved mem (%d)\n", + __func__, ret); + } + + if (CONFIG_K3_OPTEE_LOAD_ADDR >= CFG_SYS_SDRAM_BASE) { + ret = fdt_fixup_reserved(fdt, "optee", + CONFIG_K3_OPTEE_LOAD_ADDR, 0x1800000); + if (ret) + printf("%s: Failed to perform optee fixups (%s)\n", + __func__, fdt_strerror(ret)); + ret = mmu_unmap_reserved_mem("optee", true); + if (ret) + printf("%s: Failed to unmap optee reserved mem (%d)\n", + __func__, ret); + } + icache_enable(); dcache_enable(); }