From a0cc89349fb026d340368ecdccf303756f015b2a Mon Sep 17 00:00:00 2001 From: Tiago Medicci Serrano Date: Tue, 15 Apr 2025 18:37:27 -0300 Subject: [PATCH] boards/xtensa/esp32: Fix the SPI Flash MTD block device number This commit fixes the SPI flash MTD block device number if OTA's partitions are present. In this case, the OTA partitions are registered first and the corresponding MTD block device drivers are assigned with the numbers corresponding to those partitions. Then, the additional SPI flash partition should consider that when registering its own corresponding MTD block device driver. Signed-off-by: Tiago Medicci Serrano --- boards/xtensa/esp32/common/src/esp32_board_spiflash.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/xtensa/esp32/common/src/esp32_board_spiflash.c b/boards/xtensa/esp32/common/src/esp32_board_spiflash.c index 014d1390f5f..54683343a07 100644 --- a/boards/xtensa/esp32/common/src/esp32_board_spiflash.c +++ b/boards/xtensa/esp32/common/src/esp32_board_spiflash.c @@ -429,7 +429,11 @@ static int init_storage_partition(void) return ret; } +#ifdef CONFIG_ESP32_HAVE_OTA_PARTITION + ret = ftl_initialize(nitems(g_ota_partition_table), mtd); +#else ret = ftl_initialize(0, mtd); +#endif if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to initialize the FTL layer: %d\n",