[PATCH 3/4] ARM: i.MX8M: fixup op-tee nodes

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Mar 7 01:34:25 PST 2023


barebox PBL will only enable Trust Zone Address Space Controller when it
installs OP-TEE, thus take this as an indication that both barebox and
kernel device tree should be patched with an OP-TEE node.

Users not wishing this to happen may disable CONFIG_PBL_OPTEE.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/mach-imx/imx8m.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/mach-imx/imx8m.c b/arch/arm/mach-imx/imx8m.c
index 7f3856e545c7..b90e5501b82e 100644
--- a/arch/arm/mach-imx/imx8m.c
+++ b/arch/arm/mach-imx/imx8m.c
@@ -2,6 +2,9 @@
 
 #include <init.h>
 #include <common.h>
+#include <asm/optee.h>
+#include <linux/sizes.h>
+#include <mach/tzasc.h>
 #include <io.h>
 #include <asm/syscounter.h>
 #include <asm/system.h>
@@ -70,6 +73,17 @@ static int imx8m_init(const char *cputypestr)
 			pr_info("i.MX ARM Trusted Firmware: %s\n", (char *)&res.a0);
 	}
 
+	if (IS_ENABLED(CONFIG_PBL_OPTEE) && tzc380_is_enabled() &&
+	    !of_find_node_by_path_from(NULL, "/firmware/optee")) {
+		static struct of_optee_fixup_data optee_fixup_data = {
+			.shm_size = SZ_4M,
+			.method = "smc",
+		};
+
+		of_optee_fixup(of_get_root_node(), &optee_fixup_data);
+		of_register_fixup(of_optee_fixup, &optee_fixup_data);
+	}
+
 	return 0;
 }
 
-- 
2.30.2




More information about the barebox mailing list