summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSumit Garg <[email protected]>2026-01-27 11:53:40 +0530
committerCasey Connolly <[email protected]>2026-04-27 12:38:44 +0200
commit3f3f832bc986dbaa5cfac21432554b5f65e35f7a (patch)
treea5866ebd8783314d8552cf47fc88d1d6e395a75a
parent3eefe12b4b45fa5eb431246ec6ca55728aa79616 (diff)
mach-snapdragon: of_fixup: Add OP-TEE DT fixup support
Add support for OP-TEE live tree DT fixup support which enables U-Boot OP-TEE driver to be probed. As well as the EFI DT fixup protocol allows the live tree fixup to be carried over to the OS for the OP-TEE driver in the OS to probe as well. Note that this fixup only gets applied if OP-TEE support is detected via checking for OP-TEE message UID. Signed-off-by: Sumit Garg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Casey Connolly <[email protected]>
-rw-r--r--arch/arm/mach-snapdragon/of_fixup.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/arm/mach-snapdragon/of_fixup.c b/arch/arm/mach-snapdragon/of_fixup.c
index 1298b774c1e..374e6262db4 100644
--- a/arch/arm/mach-snapdragon/of_fixup.c
+++ b/arch/arm/mach-snapdragon/of_fixup.c
@@ -28,6 +28,7 @@
#include <linux/errno.h>
#include <linker_lists.h>
#include <stdlib.h>
+#include <tee/optee.h>
#include <time.h>
/**
@@ -228,6 +229,37 @@ static void fixup_usb_nodes(struct device_node *root)
}
}
+static void add_optee_node(struct device_node *root)
+{
+ struct device_node *fw = NULL, *optee = NULL;
+ int ret;
+
+ fw = of_find_node_by_path("/firmware");
+ if (!fw) {
+ log_err("Failed to find /firmware node\n");
+ return;
+ }
+
+ ret = of_add_subnode(fw, "optee", strlen("optee") + 1, &optee);
+ if (ret) {
+ log_err("Failed to add 'optee' subnode: %d\n", ret);
+ return;
+ }
+
+ ret = of_write_prop(optee, "compatible", strlen("linaro,optee-tz") + 1,
+ "linaro,optee-tz");
+ if (ret) {
+ log_err("Failed to add optee 'compatible' property: %d\n", ret);
+ return;
+ }
+
+ ret = of_write_prop(optee, "method", strlen("smc") + 1, "smc");
+ if (ret) {
+ log_err("Failed to add optee 'method' property: %d\n", ret);
+ return;
+ }
+}
+
#define time_call(func, ...) \
do { \
u64 start = timer_get_us(); \
@@ -241,6 +273,9 @@ static int qcom_of_fixup_nodes(void * __maybe_unused ctx, struct event *event)
time_call(fixup_usb_nodes, root);
+ if (IS_ENABLED(CONFIG_OPTEE) && is_optee_smc_api())
+ time_call(add_optee_node, root);
+
return 0;
}