aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_base.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2012-09-24 23:40:54 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-09-29 10:58:15 -0400
commit73ca392f7d4a175dcf7b56a3c35efc92a55a5473 (patch)
tree0eb2d8ebab3bb62714cb0123b03f90246aaeabdf /drivers/mtd/nand/nand_base.c
parentb9e48534d8f4eb17d531f54d2cb3b9138db13ccb (diff)
mtd: nand: decode Hynix MLC, 6-byte ID length
Hynix has introduced a new ID decoding scheme for their newer MLC, some of which don't support ONFI. The following devices all follow the pattern given in the datasheet for Hynix H27UBG8T2B, p.22: Hynix H27UAG8T2A Hynix H27UBG8T2A Hynix H27UBG8T2B 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>
Diffstat (limited to 'drivers/mtd/nand/nand_base.c')
-rw-r--r--drivers/mtd/nand/nand_base.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 5365ad569f5a..304765140634 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2984,8 +2984,10 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip,
2984 * Field definitions are in the following datasheets: 2984 * Field definitions are in the following datasheets:
2985 * Old style (4,5 byte ID): Samsung K9GAG08U0M (p.32) 2985 * 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 K9GBG08U0M (p.40)
2987 * Hynix MLC (6 byte ID): Hynix H27UBG8T2B (p.22)
2987 * 2988 *
2988 * Check for ID length + Samsung ID to decide what to do. 2989 * Check for ID length, cell type, and Hynix/Samsung ID to decide what
2990 * to do.
2989 */ 2991 */
2990 if (id_len == 6 && id_data[0] == NAND_MFR_SAMSUNG && 2992 if (id_len == 6 && id_data[0] == NAND_MFR_SAMSUNG &&
2991 (chip->cellinfo & NAND_CI_CELLTYPE_MSK)) { 2993 (chip->cellinfo & NAND_CI_CELLTYPE_MSK)) {
@@ -3012,6 +3014,47 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip,
3012 mtd->erasesize = (128 * 1024) << 3014 mtd->erasesize = (128 * 1024) <<
3013 (((extid >> 1) & 0x04) | (extid & 0x03)); 3015 (((extid >> 1) & 0x04) | (extid & 0x03));
3014 *busw = 0; 3016 *busw = 0;
3017 } else if (id_len == 6 && id_data[0] == NAND_MFR_HYNIX &&
3018 (chip->cellinfo & NAND_CI_CELLTYPE_MSK)) {
3019 unsigned int tmp;
3020
3021 /* Calc pagesize */
3022 mtd->writesize = 2048 << (extid & 0x03);
3023 extid >>= 2;
3024 /* Calc oobsize */
3025 switch (((extid >> 2) & 0x04) | (extid & 0x03)) {
3026 case 0:
3027 mtd->oobsize = 128;
3028 break;
3029 case 1:
3030 mtd->oobsize = 224;
3031 break;
3032 case 2:
3033 mtd->oobsize = 448;
3034 break;
3035 case 3:
3036 mtd->oobsize = 64;
3037 break;
3038 case 4:
3039 mtd->oobsize = 32;
3040 break;
3041 case 5:
3042 mtd->oobsize = 16;
3043 break;
3044 default:
3045 mtd->oobsize = 640;
3046 break;
3047 }
3048 extid >>= 2;
3049 /* Calc blocksize */
3050 tmp = ((extid >> 1) & 0x04) | (extid & 0x03);
3051 if (tmp < 0x03)
3052 mtd->erasesize = (128 * 1024) << tmp;
3053 else if (tmp == 0x03)
3054 mtd->erasesize = 768 * 1024;
3055 else
3056 mtd->erasesize = (64 * 1024) << tmp;
3057 *busw = 0;
3015 } else { 3058 } else {
3016 /* Calc pagesize */ 3059 /* Calc pagesize */
3017 mtd->writesize = 1024 << (extid & 0x03); 3060 mtd->writesize = 1024 << (extid & 0x03);