diff --git a/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3-xiao.h b/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3-xiao.h index 1413c4ac227..3b9d3c9caba 100644 --- a/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3-xiao.h +++ b/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3-xiao.h @@ -115,5 +115,23 @@ int board_lsm6ds3trc_initialize(int devno, int busno); int esp_openeth_initialize(void); #endif +/**************************************************************************** + * Name: board_spiflash_init + * + * Description: + * Initialize the SPI flash MTD partition and mount the file system + * selected by CONFIG_ESP32S3_SPIFLASH_FS on it. Implemented by the + * shared ESP32-S3 board code in + * boards/xtensa/esp32s3/common/src/esp32s3_board_spiflash.c. + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_ESP32S3_SPIFLASH +int board_spiflash_init(void); +#endif + #endif /* __ASSEMBLY__ */ #endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_XIAO_SRC_ESP32S3_XIAO_H */ diff --git a/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3_bringup.c b/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3_bringup.c index 6dc222264d9..53c669687eb 100644 --- a/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3_bringup.c +++ b/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3_bringup.c @@ -114,6 +114,24 @@ int esp32s3_bringup(void) } #endif +#ifdef CONFIG_ESP32S3_SPIFLASH +# ifdef CONFIG_PM + /* Flash ops run with the cache disabled; same PM guard as Wi-Fi below. */ + + pm_stay(PM_IDLE_DOMAIN, PM_IDLE); +# endif + + ret = board_spiflash_init(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SPI flash: %d\n", ret); + } + +# ifdef CONFIG_PM + pm_relax(PM_IDLE_DOMAIN, PM_IDLE); +# endif +#endif + #ifdef CONFIG_DEV_GPIO ret = esp32s3_gpio_init(); if (ret < 0)