Skip to content

Commit 303bc5a

Browse files
Dat-NguyenDuynashif
authored andcommitted
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 <[email protected]>
1 parent 20e28d2 commit 303bc5a

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

soc/nxp/s32/s32ze/Kconfig.defconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
1818
config MAIN_STACK_SIZE
1919
default 1024
2020

21+
config CACHE_MANAGEMENT
22+
default y
23+
2124
if ETH_DRIVER && NET_L2_ETHERNET
2225

2326
# NETC drops TCP/UDP packets with invalid checksum

soc/nxp/s32/s32ze/soc.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 NXP
2+
* Copyright 2022,2024 NXP
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -9,6 +9,7 @@
99
#include <zephyr/init.h>
1010
#include <cmsis_core.h>
1111
#include <zephyr/sys/barrier.h>
12+
#include <zephyr/cache.h>
1213

1314
#include <OsIf.h>
1415

@@ -27,21 +28,8 @@ void soc_reset_hook(void)
2728
*/
2829
__set_SCTLR(__get_SCTLR() & ~SCTLR_TE_Msk);
2930

30-
if (IS_ENABLED(CONFIG_ICACHE)) {
31-
if (!(__get_SCTLR() & SCTLR_I_Msk)) {
32-
L1C_InvalidateICacheAll();
33-
__set_SCTLR(__get_SCTLR() | SCTLR_I_Msk);
34-
barrier_isync_fence_full();
35-
}
36-
}
37-
38-
if (IS_ENABLED(CONFIG_DCACHE)) {
39-
if (!(__get_SCTLR() & SCTLR_C_Msk)) {
40-
L1C_InvalidateDCacheAll();
41-
__set_SCTLR(__get_SCTLR() | SCTLR_C_Msk);
42-
barrier_dsync_fence_full();
43-
}
44-
}
31+
sys_cache_instr_enable();
32+
sys_cache_data_enable();
4533
}
4634

4735
void soc_early_init_hook(void)

0 commit comments

Comments
 (0)