mtd: add new slc nand type
authorYi Zeng <yi.zeng@amlogic.com>
Thu, 26 Apr 2018 05:43:12 +0000 (13:43 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Mon, 7 May 2018 08:32:16 +0000 (01:32 -0700)
PD#165148: mtd: add new slc nand type

add the MFR id, flash id and factory bad block
management of Dosilicon & ATO into our code.

Change-Id: If00e026460c6c3f5d354832bef9ba95a0733fdf3
Signed-off-by: Yi Zeng <yi.zeng@amlogic.com>
drivers/amlogic/mtd/nand_flash.c
drivers/amlogic/mtd/rsv_manage.c
include/linux/mtd/nand.h

index 67d4918..ea923e6 100644 (file)
@@ -210,6 +210,71 @@ struct aml_nand_flash_dev aml_nand_flash_ids[] = {
                0,
                (NAND_TIMING_MODE5 | NAND_ECC_BCH8_MODE)},
 
+       {"Dosilicon NAND FMND1GXXX3D 3.3V 1Gb",
+               {NAND_MFR_DOSILICON, 0xf1, 0x80, 0x95},
+               2048,
+               128,
+               0x20000,
+               64,
+               1,
+               20,
+               15,
+               0,
+               0,
+               (NAND_TIMING_MODE5 | NAND_ECC_BCH8_MODE)},
+
+       {"Dosilicon NAND FMND1GXXX3D 1.8V 1Gb",
+               {NAND_MFR_DOSILICON, 0xa1, 0x80, 0x15},
+               2048,
+               128,
+               0x20000,
+               64,
+               1,
+               30,
+               15,
+               0,
+               0,
+               (NAND_TIMING_MODE5 | NAND_ECC_BCH8_MODE)},
+
+       {"Dosilicon NAND FMND2GXXX3D 3.3V 2Gb",
+               {NAND_MFR_DOSILICON, 0xda, 0x90, 0x95, 0x46},
+               2048,
+               256,
+               0x20000,
+               64,
+               1,
+               20,
+               15,
+               0,
+               0,
+               (NAND_TIMING_MODE5 | NAND_ECC_BCH8_MODE)},
+
+       {"Dosilicon NAND FMND2GXXX3D 1.8V 2Gb",
+               {NAND_MFR_DOSILICON, 0xaa, 0x90, 0x15, 0x46},
+               2048,
+               256,
+               0x20000,
+               64,
+               1,
+               30,
+               15,
+               0,
+               0,
+               (NAND_TIMING_MODE5 | NAND_ECC_BCH8_MODE)},
+
+       {"ATO NAND AFND1G08U3 1Gb",
+               {NAND_MFR_ATO, 0xf1, 0x00, 0x1d},
+               2048,
+               128,
+               0x20000,
+               64,
+               1,
+               20,
+               15,
+               0,
+               0,
+               (NAND_TIMING_MODE5 | NAND_ECC_BCH8_MODE)},
+
        {"A revision NAND 1GiB sF1G-A",
                {NAND_MFR_AMD, 0xf1, 0x80, 0x1d, 0x01, 0xf1},
                2048,
index 25a9f62..d7d3d6d 100644 (file)
@@ -308,6 +308,18 @@ int aml_nand_scan_shipped_bbt(struct mtd_info *mtd)
                        }
                }
 
+               if (aml_chip->mfr_type  == NAND_MFR_DOSILICON ||
+                   aml_chip->mfr_type  == NAND_MFR_ATO) {
+                       if (col0_oob != 0xFF) {
+                               pr_info("factory Bad blk:%llx blk=%d chip=%d\n",
+                                      (uint64_t)addr, start_blk, i);
+                       aml_chip->nand_bbt_info->nand_bbt[bad_blk_cnt++] =
+                               start_blk|0x8000;
+                       aml_chip->block_status[start_blk] = NAND_FACTORY_BAD;
+                               break;
+                       }
+               }
+
                if (aml_chip->mfr_type  == 0xef) {
                        if (col0_oob != 0xFF) {
                                pr_info("factory Bad blk:%llx blk=%d chip=%d\n",
index df3e627..838e109 100644 (file)
@@ -928,6 +928,7 @@ static inline void nand_set_controller_data(struct nand_chip *chip, void *priv)
 #define NAND_MFR_SANDISK       0x45
 #define NAND_MFR_INTEL         0x89
 #define NAND_MFR_ATO           0x9b
+#define NAND_MFR_DOSILICON     0xf8
 
 /* add extra flash manufacturer ID Codes */
 #if defined(CONFIG_AMLOGIC_NAND) || defined(CONFIG_AMLOGIC_M8B_NAND)