From 59fa5956724e6f1dea7cec603b6374ec0e4d700c Mon Sep 17 00:00:00 2001 From: Felipe Moura Date: Tue, 15 Sep 2026 20:27:38 -0300 Subject: [PATCH] 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 Assisted-by: Claude:claude-sonnet-5 --- .../esp32s3/esp32s3-xiao/src/esp32s3-xiao.h | 18 ++++++++++++++++++ .../esp32s3/esp32s3-xiao/src/esp32s3_bringup.c | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) 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)