risc-v/esp32c3: Implement MTDIOC_ERASESTATE for SPI Flash driver

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
This commit is contained in:
Gustavo Henrique Nihei 2021-07-16 14:21:57 -03:00 committed by Xiang Xiao
parent 882a0964b3
commit c05feda208
1 changed files with 10 additions and 0 deletions

View File

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