mtd: nand: spansion S30MLxxxP support

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sun Oct 24 20:59:02 EDT 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=2173bae81e17b710328bc877e7b9ade7f4b90064
Commit:     2173bae81e17b710328bc877e7b9ade7f4b90064
Parent:     12c8eb98de747ebc08404e3719c40abb405994e2
Author:     Brian Norris <norris at broadcom.com>
AuthorDate: Thu Aug 19 08:11:02 2010 -0700
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Sun Oct 24 23:27:11 2010 +0100

    mtd: nand: spansion S30MLxxxP support
    
    Some Spansion chips have a method for determining eraseblock size that
    is incompatible with similar ID chips of other sizes. This implements
    some heuristic detection of these differences.
    
    This patch checks for a 5-byte ID with trailing zeros as well as a
    512-byte page size to ensure that chips are not misdetected as the
    S30MLxxxP ORNAND series.
    
    [Tweaked by Artem a bit]
    
    Signed-off-by: Brian Norris <norris at broadcom.com>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/nand_base.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 0fd22cc..b0f091a 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2900,6 +2900,19 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
 		mtd->writesize = type->pagesize;
 		mtd->oobsize = mtd->writesize / 32;
 		busw = type->options & NAND_BUSWIDTH_16;
+
+		/*
+		 * Check for Spansion/AMD ID + repeating 5th, 6th byte since
+		 * some Spansion chips have erasesize that conflicts with size
+		 * listed in nand_ids table
+		 * Data sheet (5 byte ID): Spansion S30ML-P ORNAND (p.39)
+		 */
+		if (*maf_id == NAND_MFR_AMD && id_data[4] != 0x00 &&
+				id_data[5] == 0x00 && id_data[6] == 0x00 &&
+				id_data[7] == 0x00 && mtd->writesize == 512) {
+			mtd->erasesize = 128 * 1024;
+			mtd->erasesize <<= ((id_data[3] & 0x03) << 1);
+		}
 	}
 
 	/* Try to identify manufacturer */



More information about the linux-mtd-cvs mailing list