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@xxxxxxxxxxxxxx> --- arch/arm/mach-imx/imx8m.c | 3 +-- drivers/tee/optee/of.c | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-imx/imx8m.c b/arch/arm/mach-imx/imx8m.c index 6f8574199113..03d6e7f64cde 100644 --- a/arch/arm/mach-imx/imx8m.c +++ b/arch/arm/mach-imx/imx8m.c @@ -67,8 +67,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 = CONFIG_OPTEE_SHM_SIZE, .method = "smc", diff --git a/drivers/tee/optee/of.c b/drivers/tee/optee/of.c index cdf650592e90..2ff1f01964c8 100644 --- a/drivers/tee/optee/of.c +++ b/drivers/tee/optee/of.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(NULL, optee_of_path)) + return 0; + + node = of_create_node(root, optee_of_path); if (!node) return -ENOMEM; -- 2.39.2