summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx
diff options
context:
space:
mode:
authorBreno Lima <breno.lima@nxp.com>2021-03-25 17:30:04 +0800
committerStefano Babic <sbabic@denx.de>2021-04-08 09:18:29 +0200
commit6d7b27033726fe32583ced72f144c288699eed04 (patch)
tree3839019c653c1ba24e0acf5446a58e46df343229 /arch/arm/mach-imx
parent8c497e148c0676977a1ef392595fd5b790e59ee4 (diff)
downloadu-boot-6d7b27033726fe32583ced72f144c288699eed04.tar.gz
u-boot-6d7b27033726fe32583ced72f144c288699eed04.tar.bz2
u-boot-6d7b27033726fe32583ced72f144c288699eed04.zip
imx: 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> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r--arch/arm/mach-imx/cmd_dek.c6
-rw-r--r--arch/arm/mach-imx/cmd_mfgprot.c7
2 files changed, 7 insertions, 6 deletions
diff --git a/arch/arm/mach-imx/cmd_dek.c b/arch/arm/mach-imx/cmd_dek.c
index 5bf92cbecf..9a965576c7 100644
--- a/arch/arm/mach-imx/cmd_dek.c
+++ b/arch/arm/mach-imx/cmd_dek.c
@@ -28,12 +28,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) {
- hab_caam_clock_enable(1);
+ if (out_jr_size != jr_size)
sec_init();
- }
if (!((len == 128) | (len == 192) | (len == 256))) {
debug("Invalid DEK size. Valid sizes are 128, 192 and 256b\n");
diff --git a/arch/arm/mach-imx/cmd_mfgprot.c b/arch/arm/mach-imx/cmd_mfgprot.c
index 6e567027c0..dd506a16e8 100644
--- a/arch/arm/mach-imx/cmd_mfgprot.c
+++ b/arch/arm/mach-imx/cmd_mfgprot.c
@@ -42,13 +42,14 @@ static int do_mfgprot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
/* 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) {
- hab_caam_clock_enable(1);
+ if (out_jr_size != jr_size)
sec_init();
- }
if (strcmp(sel, pubk) == 0) {
dst_ptr = malloc_cache_aligned(FSL_CAAM_MP_PUBK_BYTES);