@@ -184,7 +184,8 @@ int main(int argc, char *argv[])
eb_start = start / mtd.eb_size;
- isNAND = mtd.type == MTD_NANDFLASH ? 1 : 0;
+ isNAND = (mtd.type == MTD_NANDFLASH || mtd.type == MTD_MLCNANDFLASH)
+ ? 1 : 0;
if (jffs2) {
cleanmarker.magic = cpu_to_je16 (JFFS2_MAGIC_BITMASK);
@@ -272,6 +273,12 @@ int main(int argc, char *argv[])
/* write cleanmarker */
if (isNAND) {
+ if (mtd.type == MTD_MLCNANDFLASH) {
+ sys_errmsg("%s: we can't write the cleanmarker "
+ "for the MLC nand.", mtd_device);
+ continue;
+ }
+
if (mtd_write_oob(mtd_desc, &mtd, fd, (uint64_t)offset + clmpos, clmlen, &cleanmarker) != 0) {
sys_errmsg("%s: MTD writeoob failure", mtd_device);
continue;
Now, the MTD_NANDFLASH stands for SLC nand, and the MTD_MLCNANDFLASH stands for the MLC nand. This patch checks the right nand type for the MLC and SLC nand. And if it is a MLC nand, we do not write cleanmarker for it, only print out a message to warn the user. Signed-off-by: Huang Shijie <b32955@freescale.com> --- flash_erase.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)