File tree Expand file tree Collapse file tree 4 files changed +74
-0
lines changed
Expand file tree Collapse file tree 4 files changed +74
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ zephyr_library_sources_ifdef(CONFIG_CACHE_ANDES cache_andes.c)
1212zephyr_library_sources_ifdef(CONFIG_CACHE_ASPEED cache_aspeed.c)
1313zephyr_library_sources_ifdef(CONFIG_CACHE_BFLB_L1C cache_bflb_l1c.c)
1414zephyr_library_sources_ifdef(CONFIG_CACHE_NRF_CACHE cache_nrf.c)
15+ zephyr_library_sources_ifdef(CONFIG_CACHE_NXP_LMEM_CACHE cache_nxp_lmem_cache.c)
1516zephyr_library_sources_ifdef(CONFIG_CACHE_NXP_XCACHE cache_nxp_xcache.c)
1617zephyr_library_sources_ifdef(CONFIG_CACHE_STM32 cache_stm32.c)
1718# zephyr-keep-sorted-stop
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ source "drivers/cache/Kconfig.andes"
2323source "drivers/cache/Kconfig.aspeed"
2424source "drivers/cache/Kconfig.bflb"
2525source "drivers/cache/Kconfig.nrf"
26+ source "drivers/cache/Kconfig.nxp_lmem_cache"
2627source "drivers/cache/Kconfig.nxp_xcache"
2728source "drivers/cache/Kconfig.stm32"
2829# zephyr-keep-sorted-stop
Original file line number Diff line number Diff line change 1+ # Copyright 2025 NXP
2+ # SPDX-License-Identifier: Apache-2.0
3+
4+ config CACHE_NXP_LMEM_CACHE
5+ bool "NXP LMEM cache driver"
6+ default y
7+ select CACHE_HAS_DRIVER
8+ depends on HAS_MCUX_LMEM_CACHE
9+ help
10+ This option enables the LMEM cache driver for NXP SOCs.
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2025 NXP
3+ *
4+ * SPDX-License-Identifier: Apache-2.0
5+ */
6+
7+ #include <zephyr/kernel.h>
8+ #include <zephyr/drivers/cache.h>
9+ #include <zephyr/logging/log.h>
10+ #include <fsl_cache.h>
11+
12+ void cache_instr_enable (void )
13+ {
14+ L1CACHE_EnableCodeCache ();
15+ }
16+
17+ void cache_instr_disable (void )
18+ {
19+ L1CACHE_DisableCodeCache ();
20+ }
21+
22+ int cache_instr_flush_all (void )
23+ {
24+ L1CACHE_CleanCodeCache ();
25+
26+ return 0 ;
27+ }
28+
29+ int cache_instr_invd_all (void )
30+ {
31+ L1CACHE_InvalidateCodeCache ();
32+
33+ return 0 ;
34+ }
35+
36+ int cache_instr_flush_and_invd_all (void )
37+ {
38+ L1CACHE_CleanInvalidateCodeCache ();
39+
40+ return 0 ;
41+ }
42+
43+ int cache_instr_flush_range (void * addr , size_t size )
44+ {
45+ L1CACHE_CleanCodeCacheByRange ((uint32_t )addr , (uint32_t )size );
46+
47+ return 0 ;
48+ }
49+
50+ int cache_instr_invd_range (void * addr , size_t size )
51+ {
52+ L1CACHE_InvalidateCodeCacheByRange ((uint32_t )addr , (uint32_t )size );
53+
54+ return 0 ;
55+ }
56+
57+ int cache_instr_flush_and_invd_range (void * addr , size_t size )
58+ {
59+ L1CACHE_CleanInvalidateCodeCacheByRange ((uint32_t )addr , (uint32_t )size );
60+
61+ return 0 ;
62+ }
You can’t perform that action at this time.
0 commit comments