Commit 5c156812fb8f49611386585bf760c04bfd5999e7

Authored by Breno Lima
Committed by Ye Li
1 parent 574f348eb1

MLK-17919: imx-common: Avoid hardcoded Job Ring Max size

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)

Showing 2 changed files with 2 additions and 5 deletions Side-by-side Diff

arch/arm/imx-common/cmd_dek.c
... ... @@ -29,13 +29,12 @@
29 29 static int blob_encap_dek(const u8 *src, u8 *dst, u32 len)
30 30 {
31 31 int ret = 0;
32   - u32 jr_size = 4;
33 32  
34 33 hab_caam_clock_enable(1);
35 34  
36 35 u32 out_jr_size = sec_in32(CONFIG_SYS_FSL_JR0_ADDR +
37 36 FSL_CAAM_ORSR_JRa_OFFSET);
38   - if (out_jr_size != jr_size)
  37 + if (out_jr_size != FSL_CAAM_MAX_JR_SIZE)
39 38 sec_init();
40 39  
41 40 if (!((len == 128) | (len == 192) | (len == 256))) {
arch/arm/imx-common/cmd_mfgprot.c
... ... @@ -42,14 +42,12 @@
42 42 sel = argv[1];
43 43  
44 44 /* Enable HAB clock */
45   - u32 jr_size = 4;
46   -
47 45 hab_caam_clock_enable(1);
48 46  
49 47 u32 out_jr_size = sec_in32(CONFIG_SYS_FSL_JR0_ADDR +
50 48 FSL_CAAM_ORSR_JRa_OFFSET);
51 49  
52   - if (out_jr_size != jr_size)
  50 + if (out_jr_size != FSL_CAAM_MAX_JR_SIZE)
53 51 sec_init();
54 52  
55 53 if (strcmp(sel, pubk) == 0) {