drivers/mtd: add MTDIOC_ISBAD ioctl

add an ioctl item MTDIOC_ISBAD
used for flashtool command to check bad blocks

Signed-off-by: zhengyu9 <zhengyu9@xiaomi.com>
This commit is contained in:
zhengyu9
2024-08-23 16:40:33 +08:00
committed by Alan C. Assis
parent 37381a9e7d
commit 491ce83508
3 changed files with 21 additions and 0 deletions
+11
View File
@@ -85,6 +85,9 @@
* OUT: None
* Resets the device to the power-on
* default condition */
#define MTDIOC_ISBAD _MTDIOC(0x000e) /* IN: Erase block number
* OUT: 0=A good block
* 1=A bad block */
/* Macros to hide implementation */
@@ -158,6 +161,14 @@ struct mtd_erase_s
uint32_t nblocks; /* Number of blocks to be erased */
};
/* This structure store the bad block information of a block */
struct mtd_bad_block_s
{
off_t block_num;
int bad_flag;
};
/* This structure defines the interface to a simple memory technology device.
* It will likely need to be extended in the future to support more complex
* devices.