Skip to content

Commit e2d3a35

Browse files
computersforpeaceDavid Woodhouse
authored andcommitted
mtd: nand: detect Samsung K9GBG08U0A, K9GAG08U0F ID
Datasheets for the following Samsung NAND parts (both MLC and SLC) describe extensions to the Samsung 6-byte extended ID decoding table: K9GBG08U0A (MLC, 6-byte ID) K9GAG08U0F (MLC, 6-byte ID) K9FAG08U0M (SLC, 6-byte ID) The table found in K9GAG08U0F, p.44, contains a superset of the information found in other previous datasheets. This patch adds support for all of these chips, with 512B and 640B OOB sizes. It also changes the detection pattern such that this table applies to all Samsung 6-byte ID NAND, not just MLC. This is safe, according to the NAND parameter data I have collected: Note that nand_base.c does not yet support the bad block marker scheme defined for these chips (i.e., scan 1st and last page for BB markers). Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent 73ca392 commit e2d3a35

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

drivers/mtd/nand/nand_base.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,19 +2983,18 @@ 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 K9GBG08U0M (p.40)
2986+
* New style (6 byte ID): Samsung K9GAG08U0F (p.44)
29872987
* Hynix MLC (6 byte ID): Hynix H27UBG8T2B (p.22)
29882988
*
29892989
* Check for ID length, cell type, and Hynix/Samsung ID to decide what
29902990
* to do.
29912991
*/
2992-
if (id_len == 6 && id_data[0] == NAND_MFR_SAMSUNG &&
2993-
(chip->cellinfo & NAND_CI_CELLTYPE_MSK)) {
2992+
if (id_len == 6 && id_data[0] == NAND_MFR_SAMSUNG) {
29942993
/* Calc pagesize */
29952994
mtd->writesize = 2048 << (extid & 0x03);
29962995
extid >>= 2;
29972996
/* Calc oobsize */
2998-
switch (extid & 0x03) {
2997+
switch (((extid >> 2) & 0x04) | (extid & 0x03)) {
29992998
case 1:
30002999
mtd->oobsize = 128;
30013000
break;
@@ -3005,9 +3004,16 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip,
30053004
case 3:
30063005
mtd->oobsize = 400;
30073006
break;
3008-
default:
3007+
case 4:
30093008
mtd->oobsize = 436;
30103009
break;
3010+
case 5:
3011+
mtd->oobsize = 512;
3012+
break;
3013+
case 6:
3014+
default: /* Other cases are "reserved" (unknown) */
3015+
mtd->oobsize = 640;
3016+
break;
30113017
}
30123018
extid >>= 2;
30133019
/* Calc blocksize */

0 commit comments

Comments
 (0)