diff --git a/components/bootloader_support/bootloader_flash/src/bootloader_flash_config_esp32p4.c b/components/bootloader_support/bootloader_flash/src/bootloader_flash_config_esp32p4.c index 78175603084..5457ea23c7f 100644 --- a/components/bootloader_support/bootloader_flash/src/bootloader_flash_config_esp32p4.c +++ b/components/bootloader_support/bootloader_flash/src/bootloader_flash_config_esp32p4.c @@ -23,7 +23,6 @@ #include "hal/cache_hal.h" #include "hal/cache_ll.h" #include "esp_private/bootloader_flash_internal.h" -#include "hal/mspi_iomux_ll.h" void IRAM_ATTR bootloader_flash_update_id(void) { @@ -79,7 +78,7 @@ void IRAM_ATTR bootloader_configure_spi_pins(int drv) { // Configure all Flash pins: clear pull-up/pull-down, set drive strength // SPI CS is external pull-uped so there no need to set internal pull-up - mspi_iomux_flash_pin_cfg_t flash_cfg = { + mspi_ll_flash_pin_cfg_t flash_cfg = { .hys = 0, .ie = 0, .wpu = 0, @@ -87,8 +86,8 @@ void IRAM_ATTR bootloader_configure_spi_pins(int drv) .drv = drv, .reserved = 0 }; - for (mspi_iomux_flash_pin_id_t pin_id = MSPI_IOMUX_FLASH_PIN_ID_CS; pin_id < MSPI_IOMUX_FLASH_PIN_ID_MAX; pin_id++) { - mspi_iomux_ll_set_flash_pin_cfg(pin_id, &flash_cfg); + for (mspi_ll_flash_pin_id_t pin_id = MSPI_LL_PIN_ID_FLASH_CS; pin_id <= MSPI_LL_PIN_ID_FLASH_D; pin_id++) { + mspi_ll_set_flash_pin_cfg(pin_id, &flash_cfg); } } diff --git a/components/esp_hw_support/port/esp32p4/pmu_sleep.c b/components/esp_hw_support/port/esp32p4/pmu_sleep.c index e54715e8a54..d89cbbc0e46 100644 --- a/components/esp_hw_support/port/esp32p4/pmu_sleep.c +++ b/components/esp_hw_support/port/esp32p4/pmu_sleep.c @@ -39,12 +39,12 @@ #include "hal/efuse_hal.h" #if CONFIG_SPIRAM #include "hal/ldo_ll.h" +#include "hal/mspi_ll.h" #endif #if (CONFIG_ESP_REV_MIN_FULL == 300) #include "soc/hp_system_reg.h" #include "hal/mmu_ll.h" -#include "hal/mspi_ll.h" #endif #define HP(state) (PMU_MODE_HP_ ## state) @@ -420,6 +420,7 @@ TCM_IRAM_ATTR uint32_t pmu_sleep_start(uint32_t wakeup_opt, uint32_t reject_opt, _psram_ctrlr_ll_enable_core_clock(PSRAM_CTRLR_LL_MSPI_ID_2, false); _psram_ctrlr_ll_enable_module_clock(PSRAM_CTRLR_LL_MSPI_ID_2, false); } + mspi_ll_hold_all_psram_pins(); #endif rtc_clk_mpll_disable(); } @@ -498,6 +499,7 @@ TCM_IRAM_ATTR bool pmu_sleep_finish(bool dslp) } _psram_ctrlr_ll_select_clk_source(PSRAM_CTRLR_LL_MSPI_ID_2, PSRAM_CLK_SRC_MPLL); _psram_ctrlr_ll_select_clk_source(PSRAM_CTRLR_LL_MSPI_ID_3, PSRAM_CLK_SRC_MPLL); + mspi_ll_unhold_all_psram_pins(); #endif } diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index 1fff95ccfff..a5d7b8d3958 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -126,6 +126,10 @@ #include "hal/gpio_ll.h" #endif +#if SOC_MSPI_HAS_INDEPENT_IOMUX +#include "hal/mspi_ll.h" +#endif + #if SOC_PM_SUPPORT_PMU_CLK_ICG #include "soc/pmu_icg_mapping.h" #endif @@ -920,6 +924,9 @@ static esp_err_t FORCE_IRAM_ATTR esp_sleep_start_safe(uint32_t sleep_flags, uint #if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP if(!(sleep_flags & RTC_SLEEP_PD_VDDSDIO) && (sleep_flags & PMU_SLEEP_PD_TOP)) { +#if SOC_MSPI_HAS_INDEPENT_IOMUX + mspi_ll_hold_all_flash_pins(); +#else // !SOC_MSPI_HAS_INDEPENT_IOMUX #if CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND /* Cache suspend also means SPI bus IDLE, then we can hold SPI CS pin safely */ gpio_ll_hold_en(&GPIO, MSPI_IOMUX_PIN_NUM_CS0); @@ -928,16 +935,14 @@ static esp_err_t FORCE_IRAM_ATTR esp_sleep_start_safe(uint32_t sleep_flags, uint /* Cache suspend also means SPI bus IDLE, then we can hold SPI CS pin safely */ gpio_ll_hold_en(&GPIO, MSPI_IOMUX_PIN_NUM_CS1); #endif +#endif // !SOC_MSPI_HAS_INDEPENT_IOMUX } -#endif - -#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP if (sleep_flags & PMU_SLEEP_PD_TOP) { #if CONFIG_IDF_TARGET_ESP32P4 && (CONFIG_ESP_REV_MIN_FULL == 300) sleep_retention_do_extra_retention(true); #endif } -#endif +#endif // CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP #if SOC_PMU_SUPPORTED #if SOC_PM_CPU_RETENTION_BY_SW && ESP_SLEEP_POWER_DOWN_CPU @@ -968,17 +973,19 @@ static esp_err_t FORCE_IRAM_ATTR esp_sleep_start_safe(uint32_t sleep_flags, uint sleep_retention_do_extra_retention(false); #endif } -#endif -#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP /* Unhold the SPI CS pin */ if(!(sleep_flags & RTC_SLEEP_PD_VDDSDIO) && (sleep_flags & PMU_SLEEP_PD_TOP)) { +#if SOC_MSPI_HAS_INDEPENT_IOMUX + mspi_ll_unhold_all_flash_pins(); +#else // !SOC_MSPI_HAS_INDEPENT_IOMUX #if CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND gpio_ll_hold_dis(&GPIO, MSPI_IOMUX_PIN_NUM_CS0); #endif #if CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND && CONFIG_SPIRAM gpio_ll_hold_dis(&GPIO, MSPI_IOMUX_PIN_NUM_CS1); #endif +#endif // !SOC_MSPI_HAS_INDEPENT_IOMUX } #endif /* Cache Resume 1: Resume cache for continue running*/