From e9bafae796cacc07e93aa3d7688396b0c81f3bf8 Mon Sep 17 00:00:00 2001 From: Royyan Zahir Date: Sat, 3 Oct 2026 15:02:14 +0400 Subject: [PATCH] arch/arm/imxrt: finish the CAAM job ring reset A JRCR reset only flushes and halts the job ring; a second reset, once JRINT reports the halt done, completes it, as Linux's caam_reset_hw_jr() does. With the single write the ring stayed halted, so the RNG instantiate job never completed and every boot logged "job ring did not answer" before the settle loop's second ring init finished the reset. Signed-off-by: Royyan Zahir --- .../src/imxrt/hardware/rt117x/imxrt117x_caam.h | 1 + arch/arm/src/imxrt/imxrt_caam.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) 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)