linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: Fix Spansion sparearea size detection
@ 2015-11-26  6:25 Nikolay Martynov
  2015-11-30 20:35 ` Brian Norris
  0 siblings, 1 reply; 7+ messages in thread
From: Nikolay Martynov @ 2015-11-26  6:25 UTC (permalink / raw)
  To: linux-mtd; +Cc: dwmw2, computersforpeace, Nikolay Martynov

According to datasheet S34ML02G2 and S34ML04G2 have
larger sparea area size than was detected.

Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
---
 drivers/mtd/nand/nand_base.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ceb68ca..2c01f9e 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3415,6 +3415,7 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip,
 	/*
 	 * Field definitions are in the following datasheets:
 	 * Old style (4,5 byte ID): Samsung K9GAG08U0M (p.32)
+	 *                          Spansion S34ML02G2 (p.33)
 	 * New Samsung (6 byte ID): Samsung K9GAG08U0F (p.44)
 	 * Hynix MLC   (6 byte ID): Hynix H27UBG8T2B (p.22)
 	 *
@@ -3512,6 +3513,14 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip,
 		*busw = (extid & 0x01) ? NAND_BUSWIDTH_16 : 0;
 
 		/*
+		 * Spansion S34ML0[24]G2 have oobsize twice as large
+		 * as S34ML01G2 encoded in the same bit. We
+		 * differentiate them by their ID length
+		 */
+		if (id_len == 5 && id_data[0] == NAND_MFR_AMD)
+			mtd->oobsize *= 2;
+
+		/*
 		 * Toshiba 24nm raw SLC (i.e., not BENAND) have 32B OOB per
 		 * 512B page. For Toshiba SLC, we decode the 5th/6th byte as
 		 * follows:
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-12-01  1:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-26  6:25 [PATCH] mtd: nand: Fix Spansion sparearea size detection Nikolay Martynov
2015-11-30 20:35 ` Brian Norris
2015-11-30 23:59   ` Nikolay Martynov
2015-12-01  0:09     ` Brian Norris
2015-12-01  0:19       ` Nikolay Martynov
2015-12-01  1:05         ` Brian Norris
2015-12-01  1:20           ` Nikolay Martynov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).