@@ -20,6 +20,21 @@ extern sys_snode_t soc_node;
2020
2121static void nrf_power_down_cache (void )
2222{
23+ if (IS_ENABLED (CONFIG_DCACHE )) {
24+ /* Flush, disable and power down DCACHE */
25+ sys_cache_data_flush_all ();
26+ sys_cache_data_disable ();
27+ nrf_memconf_ramblock_control_enable_set (NRF_MEMCONF , RAMBLOCK_POWER_ID ,
28+ RAMBLOCK_CONTROL_BIT_DCACHE , false);
29+ }
30+ if (IS_ENABLED (CONFIG_ICACHE )) {
31+ /* Disable and power down ICACHE */
32+ sys_cache_instr_disable ();
33+ nrf_memconf_ramblock_control_enable_set (NRF_MEMCONF , RAMBLOCK_POWER_ID ,
34+ RAMBLOCK_CONTROL_BIT_ICACHE , false);
35+ }
36+
37+ #if 0
2338 static const uint32_t msk =
2439 (IS_ENABLED (CONFIG_DCACHE ) ? BIT (RAMBLOCK_CONTROL_BIT_DCACHE ) : 0 ) |
2540 (IS_ENABLED (CONFIG_ICACHE ) ? BIT (RAMBLOCK_CONTROL_BIT_ICACHE ) : 0 );
@@ -34,27 +49,34 @@ static void nrf_power_down_cache(void)
3449 sys_cache_data_disable ();
3550 sys_cache_instr_disable ();
3651 nrf_memconf_ramblock_control_mask_enable_set (NRF_MEMCONF , RAMBLOCK_POWER_ID , msk , false);
52+ #endif
3753}
3854
3955void nrf_power_up_cache (void )
4056{
57+ #if 0
4158 static const uint32_t msk =
4259 (IS_ENABLED (CONFIG_DCACHE ) ? BIT (RAMBLOCK_CONTROL_BIT_DCACHE ) : 0 ) |
4360 (IS_ENABLED (CONFIG_ICACHE ) ? BIT (RAMBLOCK_CONTROL_BIT_ICACHE ) : 0 );
4461
4562 if (msk == 0 ) {
4663 return ;
4764 }
65+ #endif
4866
49- nrf_memconf_ramblock_control_mask_enable_set (NRF_MEMCONF , RAMBLOCK_POWER_ID , msk , true);
67+ nrf_memconf_ramblock_control_enable_set (NRF_MEMCONF , RAMBLOCK_POWER_ID ,
68+ RAMBLOCK_CONTROL_BIT_ICACHE , true);
5069 sys_cache_instr_enable ();
70+
71+ nrf_memconf_ramblock_control_enable_set (NRF_MEMCONF , RAMBLOCK_POWER_ID ,
72+ RAMBLOCK_CONTROL_BIT_DCACHE , true);
5173 sys_cache_data_enable ();
5274}
5375
5476static void common_suspend (void )
5577{
56- soc_lrcconf_poweron_release (& soc_node , NRF_LRCCONF_POWER_DOMAIN_0 );
5778 nrf_power_down_cache ();
79+ soc_lrcconf_poweron_release (& soc_node , NRF_LRCCONF_POWER_DOMAIN_0 );
5880}
5981
6082static void common_resume (void )
0 commit comments