4
4
* SPDX-License-Identifier: Apache-2.0
5
5
*/
6
6
#include <zephyr/kernel.h>
7
+ #include <zephyr/cache.h>
7
8
#include <zephyr/pm/pm.h>
8
9
#include <soc.h>
9
10
#include <zephyr/init.h>
13
14
#include <stm32wbaxx_ll_bus.h>
14
15
#include <stm32wbaxx_ll_cortex.h>
15
16
#include <stm32wbaxx_ll_pwr.h>
16
- #include <stm32wbaxx_ll_icache.h>
17
17
#include <stm32wbaxx_ll_rcc.h>
18
18
#include <stm32wbaxx_ll_system.h>
19
19
#include <clock_control/clock_stm32_ll_common.h>
@@ -28,22 +28,6 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL);
28
28
29
29
void stm32_power_init (void );
30
30
31
- static void disable_cache (void )
32
- {
33
- /* Disabling ICACHE */
34
- LL_ICACHE_Disable ();
35
- while (LL_ICACHE_IsEnabled () == 1U ) {
36
- }
37
-
38
- /* Wait until ICACHE_SR.BUSYF is cleared */
39
- while (LL_ICACHE_IsActiveFlag_BUSY () == 1U ) {
40
- }
41
-
42
- /* Wait until ICACHE_SR.BSYENDF is set */
43
- while (LL_ICACHE_IsActiveFlag_BSYEND () == 0U ) {
44
- }
45
- }
46
-
47
31
static void set_mode_stop (uint8_t substate_id )
48
32
{
49
33
@@ -53,7 +37,7 @@ static void set_mode_stop(uint8_t substate_id)
53
37
/* Erratum 2.2.15:
54
38
* Disabling ICACHE is required before entering stop mode
55
39
*/
56
- disable_cache ();
40
+ sys_cache_instr_disable ();
57
41
58
42
#ifdef CONFIG_BT_STM32WBA
59
43
scm_setwaitstates (LP );
@@ -108,7 +92,7 @@ static void set_mode_suspend_to_ram(void)
108
92
LL_PWR_ClearFlag_WU ();
109
93
LL_RCC_ClearResetFlags ();
110
94
111
- disable_cache ();
95
+ sys_cache_instr_disable ();
112
96
113
97
/* Select standby mode */
114
98
LL_PWR_SetPowerMode (LL_PWR_MODE_STANDBY );
@@ -161,10 +145,7 @@ void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id)
161
145
/* Erratum 2.2.15:
162
146
* Enable ICACHE when exiting stop mode
163
147
*/
164
- LL_ICACHE_SetMode (LL_ICACHE_1WAY );
165
- LL_ICACHE_Enable ();
166
- while (LL_ICACHE_IsEnabled () == 0U ) {
167
- }
148
+ sys_cache_instr_enable ();
168
149
169
150
LL_LPM_DisableSleepOnExit ();
170
151
LL_LPM_EnableSleep ();
0 commit comments