2020#include "freertos/task.h"
2121#include "esp_heap_caps.h"
2222#include "riscv/csr.h"
23- #include "soc/cache_reg.h"
2423#include "soc/clic_reg.h"
2524#include "soc/rtc_periph.h"
2625#include "soc/soc_caps.h"
3231
3332#include "esp32p4/rom/ets_sys.h"
3433#include "esp32p4/rom/rtc.h"
35- #include "esp32p4/rom/cache.h"
3634#include "rvsleep-frames.h"
3735
3836#if CONFIG_PM_CHECK_SLEEP_RETENTION_FRAME
@@ -76,7 +74,6 @@ typedef struct {
7674 struct {
7775 RvCoreCriticalSleepFrame * critical_frame [portNUM_PROCESSORS ];
7876 RvCoreNonCriticalSleepFrame * non_critical_frame [portNUM_PROCESSORS ];
79- cpu_domain_dev_sleep_frame_t * cache_config_frame ;
8077 cpu_domain_dev_sleep_frame_t * clic_frame [portNUM_PROCESSORS ];
8178 } retent ;
8279} sleep_cpu_retention_t ;
@@ -107,15 +104,6 @@ static void * cpu_domain_dev_sleep_frame_alloc_and_init(const cpu_domain_dev_reg
107104 return frame ;
108105}
109106
110- static inline void * cpu_domain_cache_config_sleep_frame_alloc_and_init (void )
111- {
112- const static cpu_domain_dev_regs_region_t regions [] = {
113- { .start = CACHE_L1_ICACHE_CTRL_REG , .end = CACHE_L1_BYPASS_CACHE_CONF_REG + 4 },
114- { .start = CACHE_L2_CACHE_CTRL_REG , .end = CACHE_L2_CACHE_BLOCKSIZE_CONF_REG + 4 }
115- };
116- return cpu_domain_dev_sleep_frame_alloc_and_init (regions , sizeof (regions ) / sizeof (regions [0 ]));
117- }
118-
119107static inline void * cpu_domain_clic_sleep_frame_alloc_and_init (uint8_t core_id )
120108{
121109 const static cpu_domain_dev_regs_region_t regions [portNUM_PROCESSORS ][2 ] = {
@@ -146,13 +134,6 @@ static esp_err_t esp_sleep_cpu_retention_init_impl(void)
146134 s_cpu_retention .retent .non_critical_frame [core_id ] = (RvCoreNonCriticalSleepFrame * )frame ;
147135 }
148136 }
149- if (s_cpu_retention .retent .cache_config_frame == NULL ) {
150- void * frame = cpu_domain_cache_config_sleep_frame_alloc_and_init ();
151- if (frame == NULL ) {
152- goto err ;
153- }
154- s_cpu_retention .retent .cache_config_frame = (cpu_domain_dev_sleep_frame_t * )frame ;
155- }
156137 for (uint8_t core_id = 0 ; core_id < portNUM_PROCESSORS ; ++ core_id ) {
157138 if (s_cpu_retention .retent .clic_frame [core_id ] == NULL ) {
158139 void * frame = cpu_domain_clic_sleep_frame_alloc_and_init (core_id );
@@ -186,10 +167,6 @@ static esp_err_t esp_sleep_cpu_retention_deinit_impl(void)
186167 s_cpu_retention .retent .non_critical_frame [core_id ] = NULL ;
187168 }
188169 }
189- if (s_cpu_retention .retent .cache_config_frame ) {
190- heap_caps_free ((void * )s_cpu_retention .retent .cache_config_frame );
191- s_cpu_retention .retent .cache_config_frame = NULL ;
192- }
193170 for (uint8_t core_id = 0 ; core_id < portNUM_PROCESSORS ; ++ core_id ) {
194171 if (s_cpu_retention .retent .clic_frame [core_id ]) {
195172 heap_caps_free ((void * )s_cpu_retention .retent .clic_frame [core_id ]);
@@ -442,7 +419,6 @@ esp_err_t TCM_IRAM_ATTR esp_sleep_cpu_retention(uint32_t (*goto_sleep)(uint32_t,
442419 atomic_store (& s_smp_retention_state [core_id ], SMP_BACKUP_START );
443420#endif
444421 cpu_domain_dev_regs_save (s_cpu_retention .retent .clic_frame [core_id ]);
445- cpu_domain_dev_regs_save (s_cpu_retention .retent .cache_config_frame );
446422 rv_core_noncritical_regs_save ();
447423
448424#if CONFIG_PM_CHECK_SLEEP_RETENTION_FRAME
@@ -468,7 +444,6 @@ esp_err_t TCM_IRAM_ATTR esp_sleep_cpu_retention(uint32_t (*goto_sleep)(uint32_t,
468444#endif
469445
470446 rv_core_noncritical_regs_restore ();
471- cpu_domain_dev_regs_restore (s_cpu_retention .retent .cache_config_frame );
472447 cpu_domain_dev_regs_restore (s_cpu_retention .retent .clic_frame [core_id ]);
473448 restore_mstatus (mstatus );
474449
@@ -495,7 +470,6 @@ bool cpu_domain_pd_allowed(void)
495470 allowed &= (s_cpu_retention .retent .critical_frame [core_id ] != NULL );
496471 allowed &= (s_cpu_retention .retent .non_critical_frame [core_id ] != NULL );
497472 }
498- allowed &= (s_cpu_retention .retent .cache_config_frame != NULL );
499473 for (uint8_t core_id = 0 ; core_id < portNUM_PROCESSORS ; ++ core_id ) {
500474 allowed &= (s_cpu_retention .retent .clic_frame [core_id ] != NULL );
501475 }
0 commit comments