]> git.ipfire.org Git - thirdparty/u-boot.git/commit
stm32mp: Fix handling of OPTEE in the middle of DRAM
authorMarek Vasut <marek.vasut@mailbox.org>
Tue, 18 Nov 2025 23:17:14 +0000 (00:17 +0100)
committerPatrice Chotard <patrice.chotard@foss.st.com>
Tue, 9 Dec 2025 14:24:04 +0000 (15:24 +0100)
commitf0baa0a6685db0b59d8e9860c6cfcb942f74697f
tree61b77bd0a30442426bbe837206427d13f521dc5c
parent0e0a198a68be71148f5ec27ef86796174f91436f
stm32mp: Fix handling of OPTEE in the middle of DRAM

STM32MP13xx may have OPTEE-OS at 0xdd000000 even on systems with 1 GiB
of DRAM at 0xc0000000, which is not the end of DRAM anymore. This puts
the OPTEE-OS in the middle of DRAM. Currently, the code sets RAM top to
0xdd000000 and prevents the DRAM range past OPTEE at 0xe0000000..0xffffffff
from being set as cacheable and from being usable. The code also sets the
area over OPTEE as invalid region in MMU tables, which is not correct.

Adjust the code such, that it only ever sets RAM top just before OPTEE
in case the OPTEE is really at the end of DRAM, mainly to be backward
compatible. Furthermore, adjust the MMU table configuration such, that
the regions over the OPTEE are simply skipped and not reconfigured, and
the regions between end of OPTEE and RAM top are set as cacheable, if
any actually exist.

Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
arch/arm/mach-stm32mp/dram_init.c
arch/arm/mach-stm32mp/stm32mp1/cpu.c