mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
spi_flash: Add auto-suspend mode for ESP32-S2
Uses HW auto_wait_idle, HW auto_suspend and SW resume
This commit is contained in:
parent
afef16c2e9
commit
60e58eaddb
@ -173,6 +173,9 @@ bool esp_flash_chip_driver_initialized(const esp_flash_t *chip)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPI_FLASH_AUTO_SUSPEND
|
||||
spi_flash_ll_auto_suspend_init(spi_flash_ll_get_hw(SPI_HOST), val);
|
||||
#endif
|
||||
esp_err_t IRAM_ATTR esp_flash_init(esp_flash_t *chip)
|
||||
{
|
||||
// Chip init flow
|
||||
|
@ -255,6 +255,10 @@ esp_err_t esp_flash_init_default_chip(void)
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPI_FLASH_AUTO_SUSPEND
|
||||
spi_flash_hal_setup_auto_suspend_mode(default_chip.host);
|
||||
#endif
|
||||
|
||||
// ROM TODO: account for non-standard default pins in efuse
|
||||
// ROM TODO: to account for chips which are slow to power on, maybe keep probing in a loop here
|
||||
err = esp_flash_init(&default_chip);
|
||||
|
@ -35,6 +35,7 @@
|
||||
.configure_host_io_mode = spi_flash_hal_configure_host_io_mode, \
|
||||
.poll_cmd_done = spi_flash_hal_poll_cmd_done, \
|
||||
.flush_cache = memspi_host_flush_cache, \
|
||||
.check_suspend = memspi_host_cb_check_suspend, \
|
||||
}
|
||||
|
||||
/// configuration for the memspi host
|
||||
@ -176,3 +177,11 @@ int memspi_host_read_data_slicer(spi_flash_host_inst_t *host, uint32_t address,
|
||||
* @return Length that can actually be written in one `program_page` call in `spi_flash_host_driver_t`.
|
||||
*/
|
||||
int memspi_host_write_data_slicer(spi_flash_host_inst_t *host, uint32_t address, uint32_t len, uint32_t *align_address, uint32_t page_size);
|
||||
|
||||
/**
|
||||
* @brief Check the suspend status and resume a suspended operation.
|
||||
*
|
||||
* @param host The driver context.
|
||||
*
|
||||
*/
|
||||
void memspi_host_cb_check_suspend(spi_flash_host_inst_t *host);
|
||||
|
@ -61,6 +61,7 @@ static const spi_flash_host_driver_t esp_flash_gpspi_host = {
|
||||
.configure_host_io_mode = spi_flash_hal_gpspi_configure_host_io_mode,
|
||||
.poll_cmd_done = spi_flash_hal_gpspi_poll_cmd_done,
|
||||
.flush_cache = NULL,
|
||||
.check_suspend = memspi_host_cb_check_suspend,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -67,12 +67,16 @@ static inline IRAM_ATTR bool on_spi1_check_yield(spi1_app_func_arg_t* ctx);
|
||||
|
||||
IRAM_ATTR static void cache_enable(void* arg)
|
||||
{
|
||||
#ifndef CONFIG_SPI_FLASH_AUTO_SUSPEND
|
||||
g_flash_guard_default_ops.end();
|
||||
#endif
|
||||
}
|
||||
|
||||
IRAM_ATTR static void cache_disable(void* arg)
|
||||
{
|
||||
#ifndef CONFIG_SPI_FLASH_AUTO_SUSPEND
|
||||
g_flash_guard_default_ops.start();
|
||||
#endif
|
||||
}
|
||||
|
||||
static IRAM_ATTR esp_err_t spi_start(void *arg)
|
||||
|
Loading…
x
Reference in New Issue
Block a user