forked from espressif/esp-idf
mspi: turn down freq to fix crash when sleep
This commit is contained in:
@@ -746,7 +746,7 @@ esp_err_t IRAM_ATTR bootloader_flash_reset_chip(void)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bootloader_flash_is_octal_mode_enabled(void)
|
bool IRAM_ATTR bootloader_flash_is_octal_mode_enabled(void)
|
||||||
{
|
{
|
||||||
#if SOC_SPI_MEM_SUPPORT_OPI_MODE
|
#if SOC_SPI_MEM_SUPPORT_OPI_MODE
|
||||||
return efuse_ll_get_flash_type();
|
return efuse_ll_get_flash_type();
|
||||||
|
@@ -72,6 +72,7 @@
|
|||||||
#include "esp_private/gpio.h"
|
#include "esp_private/gpio.h"
|
||||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
#elif CONFIG_IDF_TARGET_ESP32S3
|
||||||
#include "esp32s3/rom/rtc.h"
|
#include "esp32s3/rom/rtc.h"
|
||||||
|
#include "esp_private/mspi_timing_tuning.h"
|
||||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||||
#include "esp32c3/rom/rtc.h"
|
#include "esp32c3/rom/rtc.h"
|
||||||
#elif CONFIG_IDF_TARGET_ESP32H4
|
#elif CONFIG_IDF_TARGET_ESP32H4
|
||||||
@@ -461,6 +462,11 @@ static uint32_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags, esp_sleep_mode_t mo
|
|||||||
pd_flags &= ~RTC_SLEEP_PD_INT_8M;
|
pd_flags &= ~RTC_SLEEP_PD_INT_8M;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Turn down mspi clock speed
|
||||||
|
#if SOC_SPI_MEM_SUPPORT_TIME_TUNING
|
||||||
|
mspi_timing_change_speed_mode_cache_safe(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set mspi clock to a low-power one.
|
// Set mspi clock to a low-power one.
|
||||||
#if SOC_MEMSPI_CLOCK_IS_INDEPENDENT
|
#if SOC_MEMSPI_CLOCK_IS_INDEPENDENT
|
||||||
spi_flash_set_clock_src(MSPI_CLK_SRC_ROM_DEFAULT);
|
spi_flash_set_clock_src(MSPI_CLK_SRC_ROM_DEFAULT);
|
||||||
@@ -639,6 +645,11 @@ static uint32_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags, esp_sleep_mode_t mo
|
|||||||
spi_flash_set_clock_src(MSPI_CLK_SRC_DEFAULT);
|
spi_flash_set_clock_src(MSPI_CLK_SRC_DEFAULT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Speed up mspi clock freq
|
||||||
|
#if SOC_SPI_MEM_SUPPORT_TIME_TUNING
|
||||||
|
mspi_timing_change_speed_mode_cache_safe(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!deep_sleep) {
|
if (!deep_sleep) {
|
||||||
s_config.ccount_ticks_record = esp_cpu_get_cycle_count();
|
s_config.ccount_ticks_record = esp_cpu_get_cycle_count();
|
||||||
misc_modules_wake_prepare();
|
misc_modules_wake_prepare();
|
||||||
|
Reference in New Issue
Block a user