summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Felsch <m.felsch@pengutronix.de>2024-01-16 18:07:38 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-01-19 09:00:16 +0100
commitfab23c06660bf89b5e08f3f8f1e53d9fd908e550 (patch)
tree11f078bc2d4064ac2b06d3d39e668bc1a5def4f4
parentf58f1d227c159cd188f420e4a84298db10398b85 (diff)
downloadbarebox-fab23c06660b.tar.gz
barebox-fab23c06660b.tar.xz
ARM: i.MX8M: fix optee of-fixup logic
The current code checks only if "/firmware/optee" exist on the builtin dtb and applys the fixup if not found and if found nothing is done. If a builtin dts contains the node but an external don't the fixup won't be applied. Also if the external dts does have a node + the reserved memory region nodes but the barebox builtin dts don't we do add additional reserved memory nodes which may conflict due to different name scheme: <name> vs. <name>@<addr>. Move the "/firmware/optee" check into the of_optee_fixup() so the check is done on the correct dtb root nodes. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20240116170738.209954-19-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/mach-imx/imx8m.c3
-rw-r--r--drivers/tee/optee/of_fixup.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/arch/arm/mach-imx/imx8m.c b/arch/arm/mach-imx/imx8m.c
index 9a1e52df3a..ed0fe38a3b 100644
--- a/arch/arm/mach-imx/imx8m.c
+++ b/arch/arm/mach-imx/imx8m.c
@@ -68,8 +68,7 @@ static int imx8m_init(const char *cputypestr)
imx_set_reset_reason(src + IMX7_SRC_SRSR, imx7_reset_reasons);
pr_info("%s unique ID: %llx\n", cputypestr, imx8m_uid());
- if (IS_ENABLED(CONFIG_PBL_OPTEE) && tzc380_is_enabled() &&
- !of_find_node_by_path_from(NULL, "/firmware/optee")) {
+ if (IS_ENABLED(CONFIG_PBL_OPTEE) && tzc380_is_enabled()) {
static struct of_optee_fixup_data optee_fixup_data = {
.shm_size = OPTEE_SHM_SIZE,
.method = "smc",
diff --git a/drivers/tee/optee/of_fixup.c b/drivers/tee/optee/of_fixup.c
index cdf650592e..e4d3c5f9b0 100644
--- a/drivers/tee/optee/of_fixup.c
+++ b/drivers/tee/optee/of_fixup.c
@@ -9,12 +9,16 @@
int of_optee_fixup(struct device_node *root, void *_data)
{
struct of_optee_fixup_data *fixup_data = _data;
+ const char *optee_of_path = "/firmware/optee";
struct resource res = {};
struct device_node *node;
u64 optee_membase;
int ret;
- node = of_create_node(root, "/firmware/optee");
+ if (of_find_node_by_path_from(root, optee_of_path))
+ return 0;
+
+ node = of_create_node(root, optee_of_path);
if (!node)
return -ENOMEM;