From b4814811f5ef22f334629f3c94ec4c54c8c4c4b5 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 1 May 2023 02:23:52 +0800 Subject: [PATCH] mtd/nand: Implement MTDIOC_ERASESECTORS ioctl Signed-off-by: Xiang Xiao --- drivers/mtd/mtd_nand.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/mtd/mtd_nand.c b/drivers/mtd/mtd_nand.c index c7ed735802..74f03ee9c4 100644 --- a/drivers/mtd/mtd_nand.c +++ b/drivers/mtd/mtd_nand.c @@ -798,6 +798,13 @@ static int nand_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg) } break; + case MTDIOC_ERASESECTORS: + { + FAR struct mtd_erase_s *erase = (FAR struct mtd_erase_s *)arg; + ret = nand_erase(dev, erase->startblock, erase->nblocks); + } + break; + default: ret = -ENOTTY; /* Bad command */ break;