[PATCH 06/37] imx: Avoid hardcoded Job Ring Max size

Peng Fan (OSS) peng.fan at oss.nxp.com
Thu Mar 25 10:30:05 CET 2021


From: Breno Lima <breno.lima at nxp.com>

Prior instantiating RNG we have to ensure if the CAAM job rings are
available. Avoid hardcoded job ring max size and use the definition at
fsl_sec.h

Signed-off-by: Breno Lima <breno.lima at nxp.com>
Reviewed-by: Ye Li <ye.li at nxp.com>
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 arch/arm/mach-imx/cmd_dek.c     | 3 +--
 arch/arm/mach-imx/cmd_mfgprot.c | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-imx/cmd_dek.c b/arch/arm/mach-imx/cmd_dek.c
index 9a965576c7..bd380429c0 100644
--- a/arch/arm/mach-imx/cmd_dek.c
+++ b/arch/arm/mach-imx/cmd_dek.c
@@ -26,13 +26,12 @@
 static int blob_encap_dek(const u8 *src, u8 *dst, u32 len)
 {
 	int ret = 0;
-	u32 jr_size = 4;
 
 	hab_caam_clock_enable(1);
 
 	u32 out_jr_size = sec_in32(CONFIG_SYS_FSL_JR0_ADDR +
 				   FSL_CAAM_ORSR_JRa_OFFSET);
-	if (out_jr_size != jr_size)
+	if (out_jr_size != FSL_CAAM_MAX_JR_SIZE)
 		sec_init();
 
 	if (!((len == 128) | (len == 192) | (len == 256))) {
diff --git a/arch/arm/mach-imx/cmd_mfgprot.c b/arch/arm/mach-imx/cmd_mfgprot.c
index dd506a16e8..1430f61909 100644
--- a/arch/arm/mach-imx/cmd_mfgprot.c
+++ b/arch/arm/mach-imx/cmd_mfgprot.c
@@ -41,14 +41,12 @@ static int do_mfgprot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	sel = argv[1];
 
 	/* Enable HAB clock */
-	u32 jr_size = 4;
-
 	hab_caam_clock_enable(1);
 
 	u32 out_jr_size = sec_in32(CONFIG_SYS_FSL_JR0_ADDR +
 				   FSL_CAAM_ORSR_JRa_OFFSET);
 
-	if (out_jr_size != jr_size)
+	if (out_jr_size != FSL_CAAM_MAX_JR_SIZE)
 		sec_init();
 
 	if (strcmp(sel, pubk) == 0) {
-- 
2.25.1



More information about the U-Boot mailing list