diff options
author | Huang Shijie <b32955@freescale.com> | 2013-09-25 02:58:21 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:06:05 -0400 |
commit | 152ef4df2ace44d69ced98fa09c45cbb393d306e (patch) | |
tree | 1605a8968e8be669447ee72725f385fd63241ffe | |
parent | bec630b7f3266091e05ee3e28155da9ea4e0199a (diff) |
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: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index e9fa2e9687e3..ec1db1e19c05 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -3796,7 +3796,7 @@ int nand_scan_tail(struct mtd_info *mtd) | |||
3796 | chip->options |= NAND_SUBPAGE_READ; | 3796 | chip->options |= NAND_SUBPAGE_READ; |
3797 | 3797 | ||
3798 | /* Fill in remaining MTD driver data */ | 3798 | /* Fill in remaining MTD driver data */ |
3799 | mtd->type = MTD_NANDFLASH; | 3799 | mtd->type = nand_is_slc(chip) ? MTD_NANDFLASH : MTD_MLCNANDFLASH; |
3800 | mtd->flags = (chip->options & NAND_ROM) ? MTD_CAP_ROM : | 3800 | mtd->flags = (chip->options & NAND_ROM) ? MTD_CAP_ROM : |
3801 | MTD_CAP_NANDFLASH; | 3801 | MTD_CAP_NANDFLASH; |
3802 | mtd->_erase = nand_erase; | 3802 | mtd->_erase = nand_erase; |