soc: s32ze: clean up cache initialization

Use Zephyr cache API to initialize cache as done for
various platforms. Enabling CACHE_MANAGEMENT by default

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
This commit is contained in:
Dat Nguyen Duy 2024-09-04 00:34:04 +07:00 committed by Anas Nashif
commit 303bc5acb5
2 changed files with 7 additions and 16 deletions

View file

@ -18,6 +18,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
config MAIN_STACK_SIZE
default 1024
config CACHE_MANAGEMENT
default y
if ETH_DRIVER && NET_L2_ETHERNET
# NETC drops TCP/UDP packets with invalid checksum

View file

@ -1,5 +1,5 @@
/*
* Copyright 2022 NXP
* Copyright 2022,2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -9,6 +9,7 @@
#include <zephyr/init.h>
#include <cmsis_core.h>
#include <zephyr/sys/barrier.h>
#include <zephyr/cache.h>
#include <OsIf.h>
@ -27,21 +28,8 @@ void soc_reset_hook(void)
*/
__set_SCTLR(__get_SCTLR() & ~SCTLR_TE_Msk);
if (IS_ENABLED(CONFIG_ICACHE)) {
if (!(__get_SCTLR() & SCTLR_I_Msk)) {
L1C_InvalidateICacheAll();
__set_SCTLR(__get_SCTLR() | SCTLR_I_Msk);
barrier_isync_fence_full();
}
}
if (IS_ENABLED(CONFIG_DCACHE)) {
if (!(__get_SCTLR() & SCTLR_C_Msk)) {
L1C_InvalidateDCacheAll();
__set_SCTLR(__get_SCTLR() | SCTLR_C_Msk);
barrier_dsync_fence_full();
}
}
sys_cache_instr_enable();
sys_cache_data_enable();
}
void soc_early_init_hook(void)