drivers: entropy: Fix MCUX CAAM Entropy

Re-enable the CAAM for entropy
now that the HAL driver has been fixed

Job descriptors must be accessed coherently
between CAAM DMA and core.

The M4 Cores still do not work
because of mpu/cache/kconfig arch complications,
disable caam for M4 cores in DTS

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
diff --git a/drivers/entropy/Kconfig.mcux b/drivers/entropy/Kconfig.mcux
index 8b6bbe9..ab90a22 100644
--- a/drivers/entropy/Kconfig.mcux
+++ b/drivers/entropy/Kconfig.mcux
@@ -32,11 +32,10 @@
 
 config ENTROPY_MCUX_CAAM
 	bool "MCUX CAAM driver"
-	# FIXME: temporarily disabled because this driver hangs
-	# 	 during initialization on rt11xx platforms
-	#default y
+	default y
 	depends on DT_HAS_NXP_IMX_CAAM_ENABLED
 	select ENTROPY_HAS_DRIVER
+	select NOCACHE_MEMORY if ARCH_HAS_NOCACHE_MEMORY_SUPPORT
 	help
 	  This option enables the CAAM driver based on the MCUX
 	  CAAM driver.
diff --git a/drivers/entropy/entropy_mcux_caam.c b/drivers/entropy/entropy_mcux_caam.c
index db4f851b..084b0d3 100644
--- a/drivers/entropy/entropy_mcux_caam.c
+++ b/drivers/entropy/entropy_mcux_caam.c
@@ -17,7 +17,7 @@
 	CAAM_Type *base;
 };
 
-static caam_job_ring_interface_t jrif;
+static caam_job_ring_interface_t jrif __attribute__((__section__(".nocache")));
 
 static int entropy_mcux_caam_get_entropy(const struct device *dev,
 					 uint8_t *buffer,
diff --git a/dts/arm/nxp/nxp_rt1160_cm4.dtsi b/dts/arm/nxp/nxp_rt1160_cm4.dtsi
index 1447277..1d31a96 100644
--- a/dts/arm/nxp/nxp_rt1160_cm4.dtsi
+++ b/dts/arm/nxp/nxp_rt1160_cm4.dtsi
@@ -554,3 +554,8 @@
 		<&iomuxc_gpio_ad_31_gpio9_io30>,
 		<&iomuxc_gpio_ad_32_gpio9_io31>;
 };
+
+/* CAAM currently does not work on M4 because of cache API issues */
+&caam {
+	status = "disabled";
+};
diff --git a/dts/arm/nxp/nxp_rt1170_cm4.dtsi b/dts/arm/nxp/nxp_rt1170_cm4.dtsi
index f61897b..edc37cd 100644
--- a/dts/arm/nxp/nxp_rt1170_cm4.dtsi
+++ b/dts/arm/nxp/nxp_rt1170_cm4.dtsi
@@ -554,3 +554,8 @@
 		<&iomuxc_gpio_ad_31_gpio9_io30>,
 		<&iomuxc_gpio_ad_32_gpio9_io31>;
 };
+
+/* CAAM currently does not work on M4 because of cache API issues */
+&caam {
+	status = "disabled";
+};
diff --git a/tests/drivers/entropy/api/Kconfig.mcux b/tests/drivers/entropy/api/Kconfig.mcux
new file mode 100644
index 0000000..ee8ff5a
--- /dev/null
+++ b/tests/drivers/entropy/api/Kconfig.mcux
@@ -0,0 +1,9 @@
+# Copyright NXP 2022
+# SPDX-License-Identifier: Apache-2.0
+
+if ENTROPY_MCUX_CAAM
+
+config RANDOM_BUFFER_NOCACHED
+	default y if NOCACHE_MEMORY
+
+endif