Commit 963d1c28 authored by Huang Shijie's avatar Huang Shijie Committed by Brian Norris

mtd: nand: fix the wrong mtd->type for nand chip

Current code sets the mtd->type with MTD_NANDFLASH for both
SLC and MLC. So the jffs2 may supports the MLC nand, but in actually,
the jffs2 should not support the MLC.

This patch uses the nand_is_slc() to check the nand cell type,
and set the mtd->type with the right nand type.

After this patch, the jffs2 only supports the SLC nand.

The side-effect of this patch:
  Before this patch, the ioctl(MEMGETINFO) can only return with the
  MTD_NANDFLASH; but after this patch, the ioctl(MEMGETINFO) will
  return with the MTD_NANDFLASH for SLC, and MTD_MLCNANDFLASH for MLC.

  So the user applictions(such as mtd-utils) should also changes a little
  for this.
Signed-off-by: default avatarHuang Shijie <b32955@freescale.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent e104f1e9
...@@ -3785,7 +3785,7 @@ int nand_scan_tail(struct mtd_info *mtd) ...@@ -3785,7 +3785,7 @@ int nand_scan_tail(struct mtd_info *mtd)
chip->options |= NAND_SUBPAGE_READ; chip->options |= NAND_SUBPAGE_READ;
/* Fill in remaining MTD driver data */ /* Fill in remaining MTD driver data */
mtd->type = MTD_NANDFLASH; mtd->type = nand_is_slc(chip) ? MTD_NANDFLASH : MTD_MLCNANDFLASH;
mtd->flags = (chip->options & NAND_ROM) ? MTD_CAP_ROM : mtd->flags = (chip->options & NAND_ROM) ? MTD_CAP_ROM :
MTD_CAP_NANDFLASH; MTD_CAP_NANDFLASH;
mtd->_erase = nand_erase; mtd->_erase = nand_erase;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment