]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
imx: imx8ulp: start the ELE RNG at boot
authorPeng Fan <peng.fan@nxp.com>
Thu, 15 Jun 2023 10:09:14 +0000 (18:09 +0800)
committerStefano Babic <sbabic@denx.de>
Thu, 13 Jul 2023 09:29:40 +0000 (11:29 +0200)
On the imx8ulp A1 SoC, the ELE RNG needs to be manually started.

Signed-off-by: Clement Faure <clement.faure@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
arch/arm/include/asm/mach-imx/ele_api.h
board/freescale/imx8ulp_evk/spl.c
drivers/misc/imx_ele/ele_api.c

index 053a23f030b4a5b9c93a00a8361f54ddbc733166..cfd4ecebb626d29ff7fa12787fa8ef4a9ba1f43f 100644 (file)
@@ -149,4 +149,5 @@ int ele_get_fw_status(u32 *status, u32 *response);
 int ele_release_m33_trout(void);
 int ele_write_secure_fuse(ulong signed_msg_blk, u32 *response);
 int ele_return_lifecycle_update(ulong signed_msg_blk, u32 *response);
+int ele_start_rng(void);
 #endif
index b7c6ff092b13ce92fb3b1dfecfdf1384e3bbf241..66d0f68cc62de59997015199a80ec2a9849ef1e3 100644 (file)
@@ -123,6 +123,16 @@ void spl_board_init(void)
        ret = ele_release_caam(0x7, &res);
        if (ret)
                printf("ele release caam failed %d, 0x%x\n", ret, res);
+
+       /*
+        * RNG start only available on the A1 soc revision.
+        * Check some JTAG register for the SoC revision.
+        */
+       if (!is_soc_rev(CHIP_REV_1_0)) {
+               ret = ele_start_rng();
+               if (ret)
+                       printf("Fail to start RNG: %d\n", ret);
+       }
 }
 
 void board_init_f(ulong dummy)
index 8a14cf6aa922c79847db6a75239c0a0f6a25707f..0c017734a4969ad0a5bb766c82c29a1cde62e295 100644 (file)
@@ -503,6 +503,31 @@ int ele_get_events(u32 *events, u32 *events_cnt, u32 *response)
        return ret;
 }
 
+int ele_start_rng(void)
+{
+       struct udevice *dev = gd->arch.ele_dev;
+       int size = sizeof(struct ele_msg);
+       struct ele_msg msg;
+       int ret;
+
+       if (!dev) {
+               printf("ele dev is not initialized\n");
+               return -ENODEV;
+       }
+
+       msg.version = ELE_VERSION;
+       msg.tag = ELE_CMD_TAG;
+       msg.size = 1;
+       msg.command = ELE_START_RNG;
+
+       ret = misc_call(dev, false, &msg, size, &msg, size);
+       if (ret)
+               printf("Error: %s: ret %d, response 0x%x\n",
+                      __func__, ret, msg.data[0]);
+
+       return ret;
+}
+
 int ele_write_secure_fuse(ulong signed_msg_blk, u32 *response)
 {
        struct udevice *dev = gd->arch.ele_dev;