mtd: Add MTDIOC_FLUSH IOCTL like MTDIOC_XIPBASE

since the old design reuse BIOC_FLUSH for
MTD device which make some confusion

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-06-09 21:29:03 +08:00 committed by Gustavo Henrique Nihei
parent 2a7b97c0cd
commit 2e49e1bc5c
4 changed files with 13 additions and 6 deletions

View File

@ -322,9 +322,9 @@ int bl602_ioctl(FAR struct mtd_dev_s *dev, int cmd,
finfo("cmd(0x%x) MTDIOC_XIPBASE not support.\n", cmd);
}
break;
case BIOC_FLUSH:
case MTDIOC_FLUSH:
{
finfo("cmd(0x%x) BIOC_FLUSH.\n", cmd);
finfo("cmd(0x%x) MTDIOC_FLUSH.\n", cmd);
ret = OK;
}
break;

View File

@ -530,13 +530,17 @@ static int ftl_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
cmd = MTDIOC_XIPBASE;
}
#ifdef CONFIG_FTL_WRITEBUFFER
else if (cmd == BIOC_FLUSH)
{
return rwb_flush(&dev->rwb);
}
#ifdef CONFIG_FTL_WRITEBUFFER
rwb_flush(&dev->rwb);
#endif
/* Change the BIOC_FLUSH command to the MTDIOC_FLUSH command. */
cmd = MTDIOC_FLUSH;
}
/* No other block driver ioctl commands are not recognized by this
* driver. Other possible MTD driver ioctl commands are passed through
* to the MTD driver (unchanged).

View File

@ -926,7 +926,7 @@ static int littlefs_sync_block(FAR const struct lfs_config *c)
if (INODE_IS_MTD(drv))
{
ret = MTD_IOCTL(drv->u.i_mtd, BIOC_FLUSH, 0);
ret = MTD_IOCTL(drv->u.i_mtd, MTDIOC_FLUSH, 0);
}
else
{

View File

@ -68,6 +68,9 @@
* OUT: None */
#define MTDIOC_ECCSTATUS _MTDIOC(0x0008) /* IN: Pointer to uint8_t
* OUT: ECC status */
#define MTDIOC_FLUSH _MTDIOC(0x0009) /* IN: None
* OUT: None (ioctl return value provides
* success/failure indication). */
/* Macros to hide implementation */