From f8ae54c824553562cb004a701ce84a41a6b0b5a5 Mon Sep 17 00:00:00 2001 From: Silvano di Ninno Date: Tue, 3 Mar 2020 17:32:04 +0100 Subject: [PATCH] TEE-465: arm: imx8: enable fdt overlay support Enable FDT overlay for all the i.MX 8 series. Instead of modifying the FDT like done currently, allow u-boot to apply an overlay instead. Fallback to previous imlementation if overlay fails. Signed-off-by: Silvano di Ninno Reviewed-by: Ye Li (cherry picked from commit 13463bf47b27771976f8b824a20224f599a0518a) (cherry picked from commit 18ae293f8ce2d26bc9c187f97653e26ed00d1a15) --- arch/arm/mach-imx/dt_optee.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm/mach-imx/dt_optee.c b/arch/arm/mach-imx/dt_optee.c index 16c9676291..2678fb2762 100644 --- a/arch/arm/mach-imx/dt_optee.c +++ b/arch/arm/mach-imx/dt_optee.c @@ -24,6 +24,19 @@ int ft_add_optee_node(void *fdt, struct bd_info *bd) if (!rom_pointer[1]) return 0; +#ifdef CONFIG_OF_LIBFDT_OVERLAY + if (rom_pointer[2]) { + debug("OP-TEE: applying overlay on 0x%lx\n",rom_pointer[2]); + ret = fdt_overlay_apply_verbose(fdt, (void*)rom_pointer[2]); + if (ret == 0) { + debug("Overlay applied with success"); + fdt_pack(fdt); + return 0; + } + } + /* Fallback to previous implementation */ +#endif + optee_start = (phys_addr_t)rom_pointer[0]; optee_size = rom_pointer[1] - OPTEE_SHM_SIZE; -- 2.17.1