Patchwork [for,mtd-utils,4/4] check the MLC nand type

login
register
mail settings
Submitter Huang Shijie
Date Aug. 20, 2013, 5:58 a.m.
Message ID <1376978317-28010-5-git-send-email-b32955@freescale.com>
Download mbox | patch
Permalink /patch/268371/
State New
Headers show

Comments

Huang Shijie - Aug. 20, 2013, 5:58 a.m.
In the current code, the MTD_NANDFLASH stands for both the SLC and MLC.

In the kernel, the MTD_NANDFLASH only stands for the SLC now,
so in order to keep the logic unchanged, we should also check the MLC nand
by MTD_MLCNANDFLASH.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 lib/libmtd.c        |    3 ++-
 ubi-utils/mtdinfo.c |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

Patch

diff --git a/lib/libmtd.c b/lib/libmtd.c
index 3e8109a..2089373 100644
--- a/lib/libmtd.c
+++ b/lib/libmtd.c
@@ -776,7 +776,8 @@  int mtd_get_dev_info1(libmtd_t desc, int mtd_num, struct mtd_dev_info *mtd)
 
 	mtd->eb_cnt = mtd->size / mtd->eb_size;
 	mtd->type = type_str2int(mtd->type_str);
-	mtd->bb_allowed = !!(mtd->type == MTD_NANDFLASH);
+	mtd->bb_allowed = !!(mtd->type == MTD_NANDFLASH ||
+				mtd->type == MTD_MLCNANDFLASH);
 
 	return 0;
 }
diff --git a/ubi-utils/mtdinfo.c b/ubi-utils/mtdinfo.c
index a9dc675..5ac95aa 100644
--- a/ubi-utils/mtdinfo.c
+++ b/ubi-utils/mtdinfo.c
@@ -315,7 +315,7 @@  static int print_dev_info(libmtd_t libmtd, const struct mtd_info *mtd_info, int
 		printf("Sub-page size:                  %d %s\n",
 		       mtd.subpage_size,
 		       mtd.subpage_size > 1 ? "bytes" : "byte");
-	else if (mtd.type == MTD_NANDFLASH)
+	else if (mtd.type == MTD_NANDFLASH || mtd.type == MTD_MLCNANDFLASH)
 		printf("Sub-page size:                  unknown\n");
 
 	if (mtd.oob_size > 0)