@@ -62,6 +62,13 @@ config SYS_FSL_SEC_LE
if FSL_CAAM
+config FSL_CAAM_JR_NTZ_ACCESS
+ bool "Give caam Job Ring access to non-secure world"
+ default n
+ help
+ It is needed when OP-TEE is not used and Freescale CAAM Job Ring linux
+ driver is used.
+
config FSL_CAAM_RNG
bool "Enable Random Number Generator support"
depends on DM_RNG
@@ -673,6 +673,21 @@ static int rng_init(uint8_t sec_idx, ccsr_sec_t *sec)
return ret;
}
+#if CONFIG_IS_ENABLED(FSL_CAAM_JR_NTZ_ACCESS)
+static void jr_setown_non_trusted(ccsr_sec_t *sec)
+{
+ u32 jrown_ns;
+ int i;
+
+ /* Set ownership of job rings to non-TrustZone mode */
+ for (i = 0; i < ARRAY_SIZE(sec->jrliodnr); i++) {
+ jrown_ns = sec_in32(&sec->jrliodnr[i].ms);
+ jrown_ns |= JROWN_NS | JRMID_NS;
+ sec_out32(&sec->jrliodnr[i].ms, jrown_ns);
+ }
+}
+#endif
+
int sec_init_idx(uint8_t sec_idx)
{
int ret = 0;
@@ -761,6 +776,10 @@ int sec_init_idx(uint8_t sec_idx)
#if CONFIG_IS_ENABLED(OF_CONTROL)
init:
#endif
+#if CONFIG_IS_ENABLED(FSL_CAAM_JR_NTZ_ACCESS)
+ jr_setown_non_trusted(sec);
+#endif
+
ret = jr_init(sec_idx, caam);
if (ret < 0) {
printf("SEC%u: initialization failed\n", sec_idx);
@@ -37,6 +37,8 @@
#define JRNSLIODN_MASK 0x0fff0000
#define JRSLIODN_SHIFT 0
#define JRSLIODN_MASK 0x00000fff
+#define JROWN_NS 0x00000008
+#define JRMID_NS 0x00000001
#define JRDID_MS_PRIM_DID BIT(0)
#define JRDID_MS_PRIM_TZ BIT(4)