]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mach-k3: use custom enable_cache
authorAnshul Dalal <anshuld@ti.com>
Fri, 17 Oct 2025 13:15:24 +0000 (18:45 +0530)
committerTom Rini <trini@konsulko.com>
Wed, 22 Oct 2025 18:05:52 +0000 (12:05 -0600)
U-Boot's provided enable_caches enforces the following sequence:
icache_enable -> mmu_setup (as part of dcache_enable) -> dcache_enable

Whereas for K3 devices, we would like to add entries to the provided
static array (k3_mem_map) as per gd->bd->bi_dram and then call mmu_setup
to configure the MMU but also create carveouts for TFA/TEE before we
enable caches to prevent speculative accesses to the region. Thus the
following desired sequence:

add dram banks -> mmu_setup -> carveout TFA/TEE -> icache/dcache enable

Therefore this patch adds K3's own implementation of enable_cache for
ARM64, allowing for greater control over the cache enablement sequence.

Reviewed-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Anshul Dalal <anshuld@ti.com>
Tested-by: Wadim Egorov <w.egorov@phytec.de>
arch/arm/mach-k3/common.c

index 5483ac9906cdb27dc34d5e07416423b56d439606..7f2a4e6260ef38e2faea46d0b0140dfc9e431cc4 100644 (file)
@@ -258,6 +258,12 @@ void board_prep_linux(struct bootm_headers *images)
                                 ROUND(images->os.end,
                                       CONFIG_SYS_CACHELINE_SIZE));
 }
+
+void enable_caches(void)
+{
+       icache_enable();
+       dcache_enable();
+}
 #endif
 
 void spl_enable_cache(void)