diff --git a/arch/risc-v/src/esp32c3/esp32c3_spiflash.c b/arch/risc-v/src/esp32c3/esp32c3_spiflash.c index ecd9ad86c95..24b48a1e875 100644 --- a/arch/risc-v/src/esp32c3/esp32c3_spiflash.c +++ b/arch/risc-v/src/esp32c3/esp32c3_spiflash.c @@ -74,6 +74,7 @@ #define SPI_FLASH_BLK_SIZE 256 #define SPI_FLASH_ERASE_SIZE 4096 +#define SPI_FLASH_ERASED_STATE (0xff) #define SPI_FLASH_SIZE (4 * 1024 * 1024) #define ESP32C3_MTD_OFFSET CONFIG_ESP32C3_MTD_OFFSET @@ -875,6 +876,15 @@ static int esp32c3_ioctl(struct mtd_dev_s *dev, int cmd, } break; + case MTDIOC_ERASESTATE: + { + FAR uint8_t *result = (FAR uint8_t *)arg; + *result = SPI_FLASH_ERASED_STATE; + + ret = OK; + } + break; + default: ret = -ENOTTY; break;