mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/4] ARM: i.MX8M: fixup op-tee nodes
Date: Tue,  7 Mar 2023 10:34:25 +0100	[thread overview]
Message-ID: <20230307093426.1551193-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20230307093426.1551193-1-a.fatoum@pengutronix.de>

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@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




  parent reply	other threads:[~2023-03-07  9:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07  9:34 [PATCH 1/4] ARM: i.MX8M: add option to install OP-TEE Ahmad Fatoum
2023-03-07  9:34 ` [PATCH 2/4] drivers: implement of_optee_fixup helper function Ahmad Fatoum
2023-03-07  9:34 ` Ahmad Fatoum [this message]
2023-03-07  9:34 ` [PATCH 4/4] drivers: drop unneeded CONFIG_CRYPTO_HW guard Ahmad Fatoum
2023-03-09 11:04 ` [PATCH 1/4] ARM: i.MX8M: add option to install OP-TEE Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230307093426.1551193-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox