diff --git a/arch/arm/src/imxrt/hardware/rt117x/imxrt117x_caam.h b/arch/arm/src/imxrt/hardware/rt117x/imxrt117x_caam.h index f34aa85c138..4890d787bf4 100644 --- a/arch/arm/src/imxrt/hardware/rt117x/imxrt117x_caam.h +++ b/arch/arm/src/imxrt/hardware/rt117x/imxrt117x_caam.h @@ -115,6 +115,7 @@ #define CAAM_JRCR_RESET (1 << 0) #define CAAM_JRINT_ERR_HALT_MASK (3 << 2) #define CAAM_JRINT_ERR_HALT_INPROG (1 << 2) +#define CAAM_JRINT_ERR_HALT_DONE (2 << 2) #define CAAM_JRCFG1_IMSK (1 << 0) /* Mask the ring interrupt */ /* RTMCTL, RTSDCTL, RDSTA */ diff --git a/arch/arm/src/imxrt/imxrt_caam.c b/arch/arm/src/imxrt/imxrt_caam.c index dba90f0fbff..ee423c36d56 100644 --- a/arch/arm/src/imxrt/imxrt_caam.c +++ b/arch/arm/src/imxrt/imxrt_caam.c @@ -302,6 +302,24 @@ static int imxrt_caam_ring_init(void) putreg32(CAAM_JRCR_RESET, IMXRT_CAAM_JRCR); + for (timeout = CAAM_TIMEOUT; timeout > 0; timeout--) + { + if ((getreg32(IMXRT_CAAM_JRINT) & CAAM_JRINT_ERR_HALT_MASK) != + CAAM_JRINT_ERR_HALT_INPROG) + { + break; + } + } + + if ((getreg32(IMXRT_CAAM_JRINT) & CAAM_JRINT_ERR_HALT_MASK) != + CAAM_JRINT_ERR_HALT_DONE) + { + _err("ERROR: job ring would not halt\n"); + return -ETIMEDOUT; + } + + putreg32(CAAM_JRCR_RESET, IMXRT_CAAM_JRCR); + for (timeout = CAAM_TIMEOUT; timeout > 0; timeout--) { if ((getreg32(IMXRT_CAAM_JRCR) & CAAM_JRCR_RESET) == 0)