soc: arm: nxp_s32: s32k1: use HAL to init code cache
Use the HAL cache driver to initialize the Code Cache.
Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
diff --git a/soc/arm/nxp_s32/s32k1/soc.c b/soc/arm/nxp_s32/s32k1/soc.c
index 175b6fe..50cff14 100644
--- a/soc/arm/nxp_s32/s32k1/soc.c
+++ b/soc/arm/nxp_s32/s32k1/soc.c
@@ -15,6 +15,10 @@
#include <cmsis_core.h>
#include <OsIf.h>
+#if defined(CONFIG_HAS_MCUX_CACHE)
+#include <fsl_cache.h>
+#endif
+
#if defined(CONFIG_WDOG_INIT)
#define WDOG_UPDATE_KEY 0xD928C520U
@@ -64,17 +68,7 @@
#endif /* !CONFIG_ARM_MPU */
#if defined(CONFIG_HAS_MCUX_CACHE) && defined(CONFIG_NXP_S32_ENABLE_CODE_CACHE)
- /* Invalidate all ways */
- IP_LMEM->PCCCR |= LMEM_PCCCR_INVW1_MASK | LMEM_PCCCR_INVW0_MASK;
- IP_LMEM->PCCCR |= LMEM_PCCCR_GO_MASK;
-
- /* Wait until the command completes */
- while (IP_LMEM->PCCCR & LMEM_PCCCR_GO_MASK) {
- ;
- }
-
- /* Enable cache */
- IP_LMEM->PCCCR |= (LMEM_PCCCR_ENCACHE_MASK);
+ L1CACHE_EnableCodeCache();
barrier_isync_fence_full();
#endif
diff --git a/west.yml b/west.yml
index a15c617..b721d93 100644
--- a/west.yml
+++ b/west.yml
@@ -193,7 +193,7 @@
groups:
- hal
- name: hal_nxp
- revision: d0c424e1c6ef0acac3099a07280a46a24951a47a
+ revision: 1b2f3608ab0d5f2cf2a4c2973ae9f6353fb43e72
path: modules/hal/nxp
groups:
- hal