[PATCH] ARM: i.MX93: ele: start TRNG on i.MX93 rev a1

Sascha Hauer s.hauer at pengutronix.de
Mon Mar 11 01:06:24 PDT 2024


On i.MX93 a0 the TRNG seems to be started automatically. On rev a1 it's
not and OP-TEE panics with "Cannot retrieve random data from ELE". Start
the TRNG to let OP-TEE startup successfully.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/mach-imx/ele.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/mach-imx/ele.c b/arch/arm/mach-imx/ele.c
index ab3958cbd3..f8093fc694 100644
--- a/arch/arm/mach-imx/ele.c
+++ b/arch/arm/mach-imx/ele.c
@@ -165,6 +165,23 @@ int ele_get_info(struct ele_get_info_data *info)
 	return ret;
 }
 
+static int ele_get_start_trng(void)
+{
+        struct ele_msg msg = {
+		.version = ELE_VERSION,
+		.tag = ELE_CMD_TAG,
+		.size = 1,
+		.command = ELE_START_RNG,
+	};
+	int ret;
+
+	ret = ele_call(&msg);
+	if (ret)
+		pr_err("Could not start TRNG, response 0x%x\n", msg.data[0]);
+
+	return ret;
+}
+
 int imx93_ele_load_fw(void *bl33)
 {
 	struct ele_get_info_data info = {};
@@ -204,6 +221,9 @@ int imx93_ele_load_fw(void *bl33)
 		pr_err("Could not start ELE firmware: ret %d, response 0x%x\n",
 			ret, msg.data[0]);
 
+	if (rev == 0xa1)
+		ele_get_start_trng();
+
 	return 0;
 }
 
-- 
2.39.2




More information about the barebox mailing list