Skip to content

Commit af451af

Browse files
computersforpeacededekind
authored andcommitted
mtd: nand: fix Samsung SLC NAND identification regression
A combination of the following two commits caused a regression in 3.7-rc1 when identifying some Samsung NAND, so that some previously working NAND were no longer detected properly: commit e3b88bd mtd: nand: add generic READ ID length calculation functions commit e2d3a35 mtd: nand: detect Samsung K9GBG08U0A, K9GAG08U0F ID Particularly, a regression was seen on Samsung K9F2G08U0B, with the following full 8-byte READ ID string: ec da 10 95 44 00 ec da The basic problem is that Samsung manufactures both SLC and MLC NAND that use a non-standard decoding table for deriving information from their IDs. I have heuristically determined that all the chips that use the new table have ID strings which wrap around after the 6th byte. Unfortunately, I overlooked the fact that some older Samsung SLC (which use a different decoding table) have "5 byte ID strings" which also wrap around after the 6th byte. This patch re-introduces a distinction between these old and new Samsung NAND by checking that the 6th byte is non-zero, allowing both old and new Samsung NAND to be detected properly. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Tested-by: Brian Norris <computersforpeace@gmail.com> Reported-by: Marek Vasut <marex@denx.de> Tested-by: Marek Vasut <marex@denx.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
1 parent 5ffd341 commit af451af

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/mtd/nand/nand_base.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,13 +2983,14 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip,
29832983
/*
29842984
* Field definitions are in the following datasheets:
29852985
* Old style (4,5 byte ID): Samsung K9GAG08U0M (p.32)
2986-
* New style (6 byte ID): Samsung K9GAG08U0F (p.44)
2986+
* New Samsung (6 byte ID): Samsung K9GAG08U0F (p.44)
29872987
* Hynix MLC (6 byte ID): Hynix H27UBG8T2B (p.22)
29882988
*
2989-
* Check for ID length, cell type, and Hynix/Samsung ID to decide what
2990-
* to do.
2989+
* Check for ID length, non-zero 6th byte, cell type, and Hynix/Samsung
2990+
* ID to decide what to do.
29912991
*/
2992-
if (id_len == 6 && id_data[0] == NAND_MFR_SAMSUNG) {
2992+
if (id_len == 6 && id_data[0] == NAND_MFR_SAMSUNG &&
2993+
id_data[5] != 0x00) {
29932994
/* Calc pagesize */
29942995
mtd->writesize = 2048 << (extid & 0x03);
29952996
extid >>= 2;

0 commit comments

Comments
 (0)