diff --git a/components/esp_hw_support/clk_utils.c b/components/esp_hw_support/clk_utils.c index 99eabf816ef..efd3939cbdd 100644 --- a/components/esp_hw_support/clk_utils.c +++ b/components/esp_hw_support/clk_utils.c @@ -11,7 +11,6 @@ #include "sdkconfig.h" #include "esp_check.h" #include "esp_log.h" -#include "soc/soc_caps.h" #include "soc/rtc.h" #include "hal/mspi_ll.h" #include "hal/clk_tree_ll.h" @@ -36,7 +35,7 @@ void esp_clk_utils_mspi_speed_mode_sync_before_cpu_freq_switching(uint32_t targe if (target_cpu_src_freq <= clk_ll_xtal_load_freq_mhz()) { mspi_timing_change_speed_mode_cache_safe(true); } -#elif SOC_SPI_MEM_PSRAM_FREQ_AXI_CONSTRAINED && CONFIG_SPIRAM +#elif MSPI_TIMING_LL_PSRAM_FREQ_AXI_CONSTRAINED && CONFIG_SPIRAM /* On chips with AXI bus, currently there is a restriction that AXI frequency (usually equals to a portion of CPU * frequency) needs to be greater than or equal to MSPI PSRAM frequency to avoid writing MSPI FIFO overflow. */ @@ -58,7 +57,7 @@ void esp_clk_utils_mspi_speed_mode_sync_after_cpu_freq_switching(uint32_t target if (target_cpu_src_freq > clk_ll_xtal_load_freq_mhz()) { mspi_timing_change_speed_mode_cache_safe(false); } -#elif SOC_SPI_MEM_PSRAM_FREQ_AXI_CONSTRAINED && CONFIG_SPIRAM +#elif MSPI_TIMING_LL_PSRAM_FREQ_AXI_CONSTRAINED && CONFIG_SPIRAM /* On chips with AXI bus, currently there is a restriction that AXI frequency (usually equals to a portion of CPU * frequency) needs to be greater than or equal to MSPI PSRAM frequency to avoid writing MSPI FIFO overflow. */ diff --git a/components/hal/esp32c5/include/hal/mspi_ll.h b/components/hal/esp32c5/include/hal/mspi_ll.h index fad19a7f5cd..80f29b3d06f 100644 --- a/components/hal/esp32c5/include/hal/mspi_ll.h +++ b/components/hal/esp32c5/include/hal/mspi_ll.h @@ -38,6 +38,9 @@ extern "C" { #define MSPI_LL_CORE_CLOCK_120_MHZ 120 #define MSPI_TIMING_LL_CORE_CLOCK_MHZ_DEFAULT MSPI_LL_CORE_CLOCK_80_MHZ +// PSRAM frequency should be constrained by AXI frequency to avoid FIFO underflow. +#define MSPI_TIMING_LL_PSRAM_FREQ_AXI_CONSTRAINED 1 + /*--------------------------------------------------------------- MSPI ---------------------------------------------------------------*/ diff --git a/components/hal/esp32c61/include/hal/mspi_ll.h b/components/hal/esp32c61/include/hal/mspi_ll.h index ec615ceabad..0c46ef0c75a 100644 --- a/components/hal/esp32c61/include/hal/mspi_ll.h +++ b/components/hal/esp32c61/include/hal/mspi_ll.h @@ -38,6 +38,9 @@ extern "C" { #define MSPI_LL_CORE_CLOCK_120_MHZ 120 #define MSPI_TIMING_LL_CORE_CLOCK_MHZ_DEFAULT MSPI_LL_CORE_CLOCK_80_MHZ +// PSRAM frequency should be constrained by AXI frequency to avoid FIFO underflow. +#define MSPI_TIMING_LL_PSRAM_FREQ_AXI_CONSTRAINED 1 + /************************** MSPI pll clock configurations **************************/ /* diff --git a/components/hal/esp32h21/include/hal/mspi_ll.h b/components/hal/esp32h21/include/hal/mspi_ll.h index 43282a85c4a..1bcf9d630e7 100644 --- a/components/hal/esp32h21/include/hal/mspi_ll.h +++ b/components/hal/esp32h21/include/hal/mspi_ll.h @@ -26,6 +26,9 @@ #include "hal/misc.h" #include "hal/assert.h" +// PSRAM frequency should be constrained by AXI frequency to avoid FIFO underflow. +#define MSPI_TIMING_LL_PSRAM_FREQ_AXI_CONSTRAINED 1 + #ifdef __cplusplus extern "C" { #endif diff --git a/components/hal/esp32p4/include/hal/mspi_ll.h b/components/hal/esp32p4/include/hal/mspi_ll.h index 90cff55e5e2..d2fcf8a4ac6 100644 --- a/components/hal/esp32p4/include/hal/mspi_ll.h +++ b/components/hal/esp32p4/include/hal/mspi_ll.h @@ -48,6 +48,9 @@ extern "C" { #define MSPI_TIMING_LL_MSPI_ID_0 0 #define MSPI_TIMING_LL_MSPI_ID_1 1 +// PSRAM frequency should be constrained by AXI frequency to avoid FIFO underflow. +#define MSPI_TIMING_LL_PSRAM_FREQ_AXI_CONSTRAINED 1 + #define MSPI_TIMING_LL_HP_FLASH_CORE_CLK_DIV 4 #define MSPI_TIMING_LL_LP_FLASH_CORE_CLK_DIV 6 #define MSPI_TIMING_LL_FLASH_FDUMMY_RIN_SUPPORTED 1 diff --git a/components/soc/esp32c5/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c5/include/soc/Kconfig.soc_caps.in index 98b59ff1919..e004717e063 100644 --- a/components/soc/esp32c5/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c5/include/soc/Kconfig.soc_caps.in @@ -1255,10 +1255,6 @@ config SOC_SPI_MEM_SUPPORT_TSUS_TRES_SEPERATE_CTR bool default y -config SOC_SPI_MEM_PSRAM_FREQ_AXI_CONSTRAINED - bool - default y - config SOC_SPI_MEM_FLASH_SUPPORT_HPM bool default y diff --git a/components/soc/esp32c5/include/soc/soc_caps.h b/components/soc/esp32c5/include/soc/soc_caps.h index e095b692f4f..9d160fc0556 100644 --- a/components/soc/esp32c5/include/soc/soc_caps.h +++ b/components/soc/esp32c5/include/soc/soc_caps.h @@ -483,7 +483,6 @@ #define SOC_SPI_MEM_SUPPORT_CACHE_32BIT_ADDR_MAP (1) #define SOC_SPI_MEM_SUPPORT_TIMING_TUNING (1) #define SOC_SPI_MEM_SUPPORT_TSUS_TRES_SEPERATE_CTR (1) -#define SOC_SPI_MEM_PSRAM_FREQ_AXI_CONSTRAINED (1) #define SOC_SPI_MEM_FLASH_SUPPORT_HPM (1) /*!< Support High Performance Mode */ #define SOC_MEMSPI_TIMING_TUNING_BY_MSPI_DELAY (1) diff --git a/components/soc/esp32c61/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c61/include/soc/Kconfig.soc_caps.in index c7d3b9cafb4..e62104569c6 100644 --- a/components/soc/esp32c61/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c61/include/soc/Kconfig.soc_caps.in @@ -863,10 +863,6 @@ config SOC_SPI_MEM_SUPPORT_TSUS_TRES_SEPERATE_CTR bool default y -config SOC_SPI_MEM_PSRAM_FREQ_AXI_CONSTRAINED - bool - default y - config SOC_SPI_MEM_FLASH_SUPPORT_HPM bool default y diff --git a/components/soc/esp32c61/include/soc/soc_caps.h b/components/soc/esp32c61/include/soc/soc_caps.h index 9ed0e4a5816..2762908b932 100644 --- a/components/soc/esp32c61/include/soc/soc_caps.h +++ b/components/soc/esp32c61/include/soc/soc_caps.h @@ -349,7 +349,6 @@ #define SOC_SPI_MEM_SUPPORT_WRAP (1) #define SOC_SPI_MEM_SUPPORT_TIMING_TUNING (1) #define SOC_SPI_MEM_SUPPORT_TSUS_TRES_SEPERATE_CTR (1) -#define SOC_SPI_MEM_PSRAM_FREQ_AXI_CONSTRAINED (1) #define SOC_SPI_MEM_FLASH_SUPPORT_HPM (1) /*!< Support High Performance Mode */ #define SOC_SPI_MEM_SUPPORT_CACHE_32BIT_ADDR_MAP (1) #define SOC_MEMSPI_TIMING_TUNING_BY_MSPI_DELAY (1) diff --git a/components/soc/esp32h4/include/soc/Kconfig.soc_caps.in b/components/soc/esp32h4/include/soc/Kconfig.soc_caps.in index 65f56d2b858..030635659bf 100644 --- a/components/soc/esp32h4/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32h4/include/soc/Kconfig.soc_caps.in @@ -267,10 +267,6 @@ config SOC_SPI_MEM_SUPPORT_WRAP bool default y -config SOC_SPI_MEM_PSRAM_FREQ_AXI_CONSTRAINED - bool - default y - config SOC_MEMSPI_SRC_FREQ_64M_SUPPORTED bool default y diff --git a/components/soc/esp32h4/include/soc/soc_caps.h b/components/soc/esp32h4/include/soc/soc_caps.h index 89c15fb6be7..f1804e25188 100644 --- a/components/soc/esp32h4/include/soc/soc_caps.h +++ b/components/soc/esp32h4/include/soc/soc_caps.h @@ -414,7 +414,6 @@ #define SOC_SPI_MEM_SUPPORT_SW_SUSPEND (1) #define SOC_SPI_MEM_SUPPORT_CHECK_SUS (1) #define SOC_SPI_MEM_SUPPORT_WRAP (1) -#define SOC_SPI_MEM_PSRAM_FREQ_AXI_CONSTRAINED (1) #define SOC_MEMSPI_SRC_FREQ_64M_SUPPORTED 1 #define SOC_MEMSPI_SRC_FREQ_32M_SUPPORTED 1 diff --git a/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in b/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in index 23287ee0711..ee43361272b 100644 --- a/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in @@ -1691,10 +1691,6 @@ config SOC_SPI_MEM_SUPPORT_CACHE_32BIT_ADDR_MAP bool default y -config SOC_SPI_MEM_PSRAM_FREQ_AXI_CONSTRAINED - bool - default y - config SOC_SPI_MEM_SUPPORT_TSUS_TRES_SEPERATE_CTR bool default y diff --git a/components/soc/esp32p4/include/soc/soc_caps.h b/components/soc/esp32p4/include/soc/soc_caps.h index 3a455bda3ee..b42233c1731 100644 --- a/components/soc/esp32p4/include/soc/soc_caps.h +++ b/components/soc/esp32p4/include/soc/soc_caps.h @@ -618,7 +618,6 @@ #define SOC_MEMSPI_TIMING_TUNING_BY_DQS (1) #define SOC_MEMSPI_TIMING_TUNING_BY_FLASH_DELAY (1) #define SOC_SPI_MEM_SUPPORT_CACHE_32BIT_ADDR_MAP (1) -#define SOC_SPI_MEM_PSRAM_FREQ_AXI_CONSTRAINED (1) #define SOC_SPI_MEM_SUPPORT_TSUS_TRES_SEPERATE_CTR (1) #define SOC_SPI_PERIPH_SUPPORT_CONTROL_DUMMY_OUT (1) diff --git a/components/spi_flash/esp_flash_spi_init.c b/components/spi_flash/esp_flash_spi_init.c index 0e46bcde479..c2785110b2f 100644 --- a/components/spi_flash/esp_flash_spi_init.c +++ b/components/spi_flash/esp_flash_spi_init.c @@ -146,7 +146,7 @@ esp_flash_t *esp_flash_default_chip = NULL; // 1. Frequency limit workaround is enabled (CONFIG_SPI_FLASH_FREQ_LIMIT_C5_240MHZ) // 2. Flash frequency requires timing tuning (80MHz or 120MHz, i.e., > 40MHz) // 3. CPU frequency reduction will trigger MSPI timing tuning to enter low speed mode -// This happens when: SOC_SPI_MEM_PSRAM_FREQ_AXI_CONSTRAINED && CONFIG_SPIRAM && +// This happens when: MSPI_TIMING_LL_PSRAM_FREQ_AXI_CONSTRAINED && CONFIG_SPIRAM && // (target_cpu_freq < CONFIG_SPIRAM_SPEED) // Note: The runtime check for CPU freq < PSRAM speed is done in clk_utils.c, // which calls mspi_timing_change_speed_mode_cache_safe(true) to enter low speed mode.