This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit c05feda208efe6c88797a8821f15a93393cb87ea Author: Gustavo Henrique Nihei <gustavo.ni...@espressif.com> AuthorDate: Fri Jul 16 14:21:57 2021 -0300 risc-v/esp32c3: Implement MTDIOC_ERASESTATE for SPI Flash driver Signed-off-by: Gustavo Henrique Nihei <gustavo.ni...@espressif.com> --- arch/risc-v/src/esp32c3/esp32c3_spiflash.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/risc-v/src/esp32c3/esp32c3_spiflash.c b/arch/risc-v/src/esp32c3/esp32c3_spiflash.c index ecd9ad8..24b48a1 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;