1414#include "soc/rtc.h"
1515#include "esp_private/rtc_clk.h"
1616#include "esp_attr.h"
17- #include "esp_cpu.h"
1817#include "esp_hw_log.h"
1918#include "esp_rom_sys.h"
2019#include "hal/clk_tree_ll.h"
@@ -183,13 +182,7 @@ static void rtc_clk_cpu_freq_to_xtal(int cpu_freq, int div, bool to_default)
183182 clk_ll_mem_set_divider (mem_divider );
184183 clk_ll_sys_set_divider (sys_divider );
185184 clk_ll_apb_set_divider (apb_divider );
186- #if (!defined(BOOTLOADER_BUILD ) && (CONFIG_FREERTOS_NUMBER_OF_CORES == 2 ))
187- esp_cpu_stall (1 - esp_cpu_get_core_id ());
188- #endif
189185 clk_ll_bus_update ();
190- #if (!defined(BOOTLOADER_BUILD ) && (CONFIG_FREERTOS_NUMBER_OF_CORES == 2 ))
191- esp_cpu_unstall (1 - esp_cpu_get_core_id ());
192- #endif
193186 esp_rom_set_cpu_ticks_per_us (cpu_freq );
194187}
195188
@@ -201,13 +194,7 @@ static void rtc_clk_cpu_freq_to_8m(void)
201194 clk_ll_sys_set_divider (1 );
202195 clk_ll_apb_set_divider (1 );
203196 clk_ll_cpu_set_src (SOC_CPU_CLK_SRC_RC_FAST );
204- #if (!defined(BOOTLOADER_BUILD ) && (CONFIG_FREERTOS_NUMBER_OF_CORES == 2 ))
205- esp_cpu_stall (1 - esp_cpu_get_core_id ());
206- #endif
207197 clk_ll_bus_update ();
208- #if (!defined(BOOTLOADER_BUILD ) && (CONFIG_FREERTOS_NUMBER_OF_CORES == 2 ))
209- esp_cpu_unstall (1 - esp_cpu_get_core_id ());
210- #endif
211198 esp_rom_set_cpu_ticks_per_us (20 );
212199}
213200
@@ -253,22 +240,14 @@ static void rtc_clk_cpu_freq_to_cpll_mhz(int cpu_freq_mhz, hal_utils_clk_div_t *
253240 // Update bit does not control CPU clock sel mux. Therefore, there may be a middle state during the switch (CPU rises)
254241 // Since this is upscaling, we need to configure the frequency division coefficient before switching the clock source.
255242 // Otherwise, an intermediate state will occur, in the intermediate state, the frequency of APB/MEM does not meet the
256- // timing requirements. If there are periperals access that depend on these two clocks at this moment, some exception
243+ // timing requirements. If there are periperals/CPU access that depend on these two clocks at this moment, some exception
257244 // might occur.
258245 clk_ll_cpu_set_divider (div -> integer , div -> numerator , div -> denominator );
259246 clk_ll_mem_set_divider (mem_divider );
260247 clk_ll_sys_set_divider (sys_divider );
261248 clk_ll_apb_set_divider (apb_divider );
262- #if (!defined(BOOTLOADER_BUILD ) && (CONFIG_FREERTOS_NUMBER_OF_CORES == 2 ))
263- // During frequency switching, non-frequency switching cores may have ongoing memory accesses, which may cause access
264- // failures, stalling non-frequency switching cores here can avoid such failures.
265- esp_cpu_stall (1 - esp_cpu_get_core_id ());
266- #endif
267249 clk_ll_bus_update ();
268250 clk_ll_cpu_set_src (SOC_CPU_CLK_SRC_PLL );
269- #if (!defined(BOOTLOADER_BUILD ) && (CONFIG_FREERTOS_NUMBER_OF_CORES == 2 ))
270- esp_cpu_unstall (1 - esp_cpu_get_core_id ());
271- #endif
272251 esp_rom_set_cpu_ticks_per_us (cpu_freq_mhz );
273252}
274253
0 commit comments