MLK-17919: imx-common: Avoid hardcoded Job Ring Max size
authorBreno Lima <breno.lima@nxp.com>
Fri, 23 Mar 2018 20:25:15 +0000 (17:25 -0300)
committerYe Li <ye.li@nxp.com>
Mon, 2 Apr 2018 02:41:35 +0000 (19:41 -0700)
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@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit b81379d3d2228760cc061a56c3c610b4e9fa9783)

arch/arm/imx-common/cmd_dek.c
arch/arm/imx-common/cmd_mfgprot.c

index bbbd110..bda7b43 100644 (file)
@@ -29,13 +29,12 @@ DECLARE_GLOBAL_DATA_PTR;
 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))) {
index 2873b5f..de846ab 100644 (file)
@@ -42,14 +42,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) {