boards/esp32s3-xiao: wire up board_spiflash_init()

esp32s3-devkit and esp32s3-eye both call board_spiflash_init() from
their bring-up to register the internal SPI flash MTD partition and
mount its file system; esp32s3-xiao never did, so CONFIG_ESP32S3_SPIFLASH
built but no /dev/... MTD partition or mount ever appeared -- same shape
of gap as the IMU, SD, console and Wi-Fi wiring already fixed for this
board.

Guarded with pm_stay(PM_IDLE_DOMAIN, PM_IDLE) the same way the Wi-Fi
bring-up below it is: flash operations run with the cache disabled and
can't tolerate PM_STANDBY's clock gating either.

Confirmed under QEMU's esp32s3 machine: LittleFS mounts, and a counter
file written to it survives a reboot.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
Assisted-by: Claude:claude-sonnet-5
This commit is contained in:
Felipe Moura 2026-09-15 20:27:38 -03:00 • committed by Xiang Xiao
parent bda2251669
commit 59fa595672
2 changed files with 36 additions and 0 deletions

View file

@ -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 */

View file

@ -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)