Skip to content

Commit

Permalink
soc: arm: nxp_s32: s32k1: use HAL to init code cache
Browse files Browse the repository at this point in the history
Use the HAL cache driver to initialize the Code Cache.

Signed-off-by: Manuel Argüelles <[email protected]>
  • Loading branch information
manuargue committed Dec 7, 2023
1 parent b85d42a commit c6c2bc3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
16 changes: 5 additions & 11 deletions soc/arm/nxp_s32/s32k1/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -64,17 +68,7 @@ static int soc_init(void)
#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

Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ manifest:
groups:
- hal
- name: hal_nxp
revision: d0c424e1c6ef0acac3099a07280a46a24951a47a
revision: 1b2f3608ab0d5f2cf2a4c2973ae9f6353fb43e72
path: modules/hal/nxp
groups:
- hal
Expand Down

0 comments on commit c6c2bc3

Please sign in to comment.