Commit 574f348eb1c88419f2bb8a39d137cfdc6d28d7b2

Authored by Breno Lima
Committed by Ye Li
1 parent e262b961d0

MLK-17918: imx-common: Ensure CAAM clock is enabled prior getting out_jr_size

Prior calling sec_in32() we have to ensure CAAM clock is enabled, the
function sec_in32() is reading CAAM registers and if CAAM clock is disabled
the system will hang.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit c4da7540e7548f36c6ad90292db7057b828a7956)

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

arch/arm/imx-common/cmd_dek.c
... ... @@ -31,12 +31,12 @@
31 31 int ret = 0;
32 32 u32 jr_size = 4;
33 33  
  34 + hab_caam_clock_enable(1);
  35 +
34 36 u32 out_jr_size = sec_in32(CONFIG_SYS_FSL_JR0_ADDR +
35 37 FSL_CAAM_ORSR_JRa_OFFSET);
36   - if (out_jr_size != jr_size) {
37   - hab_caam_clock_enable(1);
  38 + if (out_jr_size != jr_size)
38 39 sec_init();
39   - }
40 40  
41 41 if (!((len == 128) | (len == 192) | (len == 256))) {
42 42 debug("Invalid DEK size. Valid sizes are 128, 192 and 256b\n");
arch/arm/imx-common/cmd_mfgprot.c
... ... @@ -43,13 +43,14 @@
43 43  
44 44 /* Enable HAB clock */
45 45 u32 jr_size = 4;
  46 +
  47 + hab_caam_clock_enable(1);
  48 +
46 49 u32 out_jr_size = sec_in32(CONFIG_SYS_FSL_JR0_ADDR +
47 50 FSL_CAAM_ORSR_JRa_OFFSET);
48 51  
49   - if (out_jr_size != jr_size) {
50   - hab_caam_clock_enable(1);
  52 + if (out_jr_size != jr_size)
51 53 sec_init();
52   - }
53 54  
54 55 if (strcmp(sel, pubk) == 0) {
55 56 dst_ptr = malloc_cache_aligned(FSL_CAAM_MP_PUBK_BYTES);