mtd: nand: consolidate redundant flash-based BBT flags
authorBrian Norris <computersforpeace@gmail.com>
Tue, 31 May 2011 23:31:22 +0000 (16:31 -0700)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Sun, 11 Sep 2011 12:01:56 +0000 (15:01 +0300)
This patch works with the following three flags from two headers (nand.h
and bbm.h):
  (1) NAND_USE_FLASH_BBT (nand.h)
  (2) NAND_USE_FLASH_BBT_NO_OOB (nand.h)
  (3) NAND_BBT_NO_OOB (bbm.h)

These flags are all related and interdependent, yet they were in
different headers. Flag (2) is simply the combination of (1) and (3) and
can be eliminated.

This patch accomplishes the following:
  * eliminate NAND_USE_FLASH_BBT_NO_OOB (i.e., flag (2))
  * move NAND_USE_FLASH_BBT (i.e., flag (1)) to bbm.h

It's important to note that because (1) and (3) are now both found in
bbm.h, they should NOT be used in the "nand_chip.options" field.

I removed a small section from the mtdnand DocBook because it referes to
NAND_USE_FLASH_BBT in nand.h, which has been moved to bbm.h.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
33 files changed:
Documentation/DocBook/mtdnand.tmpl
arch/arm/mach-davinci/board-da830-evm.c
arch/arm/mach-davinci/board-da850-evm.c
arch/arm/mach-davinci/board-dm355-evm.c
arch/arm/mach-davinci/board-dm355-leopard.c
arch/arm/mach-davinci/board-dm365-evm.c
arch/arm/mach-davinci/board-dm644x-evm.c
arch/arm/mach-davinci/board-mityomapl138.c
arch/arm/mach-davinci/board-neuros-osd2.c
arch/arm/mach-davinci/board-tnetv107x-evm.c
arch/arm/mach-davinci/include/mach/nand.h
arch/arm/mach-orion5x/ts78xx-setup.c
arch/cris/arch-v32/drivers/mach-a3/nandflash.c
arch/cris/arch-v32/drivers/mach-fs/nandflash.c
drivers/mtd/nand/atmel_nand.c
drivers/mtd/nand/autcpu12.c
drivers/mtd/nand/bcm_umi_nand.c
drivers/mtd/nand/cafe_nand.c
drivers/mtd/nand/cs553x_nand.c
drivers/mtd/nand/davinci_nand.c
drivers/mtd/nand/denali.c
drivers/mtd/nand/diskonchip.c
drivers/mtd/nand/fsl_elbc_nand.c
drivers/mtd/nand/mpc5121_nfc.c
drivers/mtd/nand/mxc_nand.c
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/nand_bbt.c
drivers/mtd/nand/nandsim.c
drivers/mtd/nand/pasemi_nand.c
drivers/mtd/nand/plat_nand.c
drivers/mtd/nand/s3c2410.c
include/linux/mtd/bbm.h
include/linux/mtd/nand.h

index 17910e2052addefcc2a581fa810991fde2545820..05cc83ea8ef7d9b490293b849276d28c5c33ea68 100644 (file)
@@ -572,7 +572,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip)
                        </para>
                        <para>
                                The simplest way to activate the FLASH based bad block table support 
-                               is to set the option NAND_USE_FLASH_BBT in the option field of
+                               is to set the option NAND_USE_FLASH_BBT in the bbt_option field of
                                the nand chip structure before calling nand_scan(). For AG-AND
                                chips is this done by default.
                                This activates the default FLASH based bad block table functionality 
@@ -1158,9 +1158,6 @@ in this page</entry>
                These constants are defined in nand.h. They are ored together to describe
                the functionality.
                <programlisting>
-/* Use a flash based bad block table. This option is parsed by the
- * default bad block table function (nand_default_bbt). */
-#define NAND_USE_FLASH_BBT     0x00010000
 /* The hw ecc generator provides a syndrome instead a ecc value on read 
  * This can only work if we have the ecc bytes directly behind the 
  * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */
index 84fd78684868f7112bd441df1577b18c734656d0..a790c1b363ff806e84d70fdb0b18ae723b04c957 100644 (file)
@@ -377,7 +377,7 @@ static struct davinci_nand_pdata da830_evm_nand_pdata = {
        .nr_parts       = ARRAY_SIZE(da830_evm_nand_partitions),
        .ecc_mode       = NAND_ECC_HW,
        .ecc_bits       = 4,
-       .options        = NAND_USE_FLASH_BBT,
+       .bbt_options    = NAND_USE_FLASH_BBT,
        .bbt_td         = &da830_evm_nand_bbt_main_descr,
        .bbt_md         = &da830_evm_nand_bbt_mirror_descr,
        .timing         = &da830_evm_nandflash_timing,
index bd5394537c88d8f305c9bda5a00cf57214263c12..de27111d1b27a1625978188755d41d962dc34fa3 100644 (file)
@@ -225,7 +225,7 @@ static struct davinci_nand_pdata da850_evm_nandflash_data = {
        .nr_parts       = ARRAY_SIZE(da850_evm_nandflash_partition),
        .ecc_mode       = NAND_ECC_HW,
        .ecc_bits       = 4,
-       .options        = NAND_USE_FLASH_BBT,
+       .bbt_options    = NAND_USE_FLASH_BBT,
        .timing         = &da850_evm_nandflash_timing,
 };
 
index 241a6bd67408fc4d5bc895c0c0c48cae48b1ac2c..fd2de2c0338bc4aabebb1d1ceb0cfc99265b4f82 100644 (file)
@@ -77,7 +77,7 @@ static struct davinci_nand_pdata davinci_nand_data = {
        .parts                  = davinci_nand_partitions,
        .nr_parts               = ARRAY_SIZE(davinci_nand_partitions),
        .ecc_mode               = NAND_ECC_HW,
-       .options                = NAND_USE_FLASH_BBT,
+       .bbt_options            = NAND_USE_FLASH_BBT,
        .ecc_bits               = 4,
 };
 
index bee284ca7fd6103a5622bd33b6c9f471c3c7fc73..cfbd897e661103b06dbfe9dc4a23bd47653b5dc5 100644 (file)
@@ -74,7 +74,7 @@ static struct davinci_nand_pdata davinci_nand_data = {
        .parts                  = davinci_nand_partitions,
        .nr_parts               = ARRAY_SIZE(davinci_nand_partitions),
        .ecc_mode               = NAND_ECC_HW_SYNDROME,
-       .options                = NAND_USE_FLASH_BBT,
+       .bbt_options            = NAND_USE_FLASH_BBT,
 };
 
 static struct resource davinci_nand_resources[] = {
index 9818f214d4f0c15b445c16e4eab0dbf6f4731893..e66116ddea4f65478c190d7d401bf33bf16dded2 100644 (file)
@@ -139,7 +139,7 @@ static struct davinci_nand_pdata davinci_nand_data = {
        .parts                  = davinci_nand_partitions,
        .nr_parts               = ARRAY_SIZE(davinci_nand_partitions),
        .ecc_mode               = NAND_ECC_HW,
-       .options                = NAND_USE_FLASH_BBT,
+       .bbt_options            = NAND_USE_FLASH_BBT,
        .ecc_bits               = 4,
 };
 
index 95607a191e03ea5d88ce88f6d51836bc54c390e7..dde204933c9e6fd68a997b42fb785bbf8d04815d 100644 (file)
@@ -150,7 +150,7 @@ static struct davinci_nand_pdata davinci_evm_nandflash_data = {
        .parts          = davinci_evm_nandflash_partition,
        .nr_parts       = ARRAY_SIZE(davinci_evm_nandflash_partition),
        .ecc_mode       = NAND_ECC_HW,
-       .options        = NAND_USE_FLASH_BBT,
+       .bbt_options    = NAND_USE_FLASH_BBT,
        .timing         = &davinci_evm_nandflash_timing,
 };
 
index c278226627ad01368e232ed9ab4b53399ebe2812..ef7ba494493dab5f338c69a98bb446a0e375d818 100644 (file)
@@ -396,7 +396,8 @@ static struct davinci_nand_pdata mityomapl138_nandflash_data = {
        .parts          = mityomapl138_nandflash_partition,
        .nr_parts       = ARRAY_SIZE(mityomapl138_nandflash_partition),
        .ecc_mode       = NAND_ECC_HW,
-       .options        = NAND_USE_FLASH_BBT | NAND_BUSWIDTH_16,
+       .bbt_options    = NAND_USE_FLASH_BBT,
+       .options        = NAND_BUSWIDTH_16,
        .ecc_bits       = 1, /* 4 bit mode is not supported with 16 bit NAND */
 };
 
index d60a80028ba3c23c6b7a6f78943c6dbc7b968d55..1989768973a78eaacace7a2005939f932026e74b 100644 (file)
@@ -87,7 +87,7 @@ static struct davinci_nand_pdata davinci_ntosd2_nandflash_data = {
        .parts          = davinci_ntosd2_nandflash_partition,
        .nr_parts       = ARRAY_SIZE(davinci_ntosd2_nandflash_partition),
        .ecc_mode       = NAND_ECC_HW,
-       .options        = NAND_USE_FLASH_BBT,
+       .bbt_options    = NAND_USE_FLASH_BBT,
 };
 
 static struct resource davinci_ntosd2_nandflash_resource[] = {
index 78289206568217341aae532579ab84038602996b..046f8e00938e950c7d9df947dcbb6561e6fc9a2a 100644 (file)
@@ -144,7 +144,7 @@ static struct davinci_nand_pdata nand_config = {
        .parts          = nand_partitions,
        .nr_parts       = ARRAY_SIZE(nand_partitions),
        .ecc_mode       = NAND_ECC_HW,
-       .options        = NAND_USE_FLASH_BBT,
+       .bbt_options    = NAND_USE_FLASH_BBT,
        .ecc_bits       = 1,
 };
 
index 025151049f0517a103c4efb96ee86d465c3fff19..2c506f905cb81b1d80cd506e3efc96039c3d3ced 100644 (file)
@@ -74,8 +74,10 @@ struct davinci_nand_pdata {          /* platform_data */
        nand_ecc_modes_t        ecc_mode;
        u8                      ecc_bits;
 
-       /* e.g. NAND_BUSWIDTH_16 or NAND_USE_FLASH_BBT */
+       /* e.g. NAND_BUSWIDTH_16 */
        unsigned                options;
+       /* e.g. NAND_USE_FLASH_BBT */
+       unsigned                bbt_options;
 
        /* Main and mirror bbt descriptor overrides */
        struct nand_bbt_descr   *bbt_td;
index 6b7b54116f3048f82a75d0c2dcbed66fc9b46ecc..e5ca57ce6e50692daabe941d5721194b8de45497 100644 (file)
@@ -275,7 +275,7 @@ static struct platform_nand_data ts78xx_ts_nand_data = {
                .partitions             = ts78xx_ts_nand_parts,
                .nr_partitions          = ARRAY_SIZE(ts78xx_ts_nand_parts),
                .chip_delay             = 15,
-               .options                = NAND_USE_FLASH_BBT,
+               .bbt_options            = NAND_USE_FLASH_BBT,
        },
        .ctrl   = {
                /*
index f58f2c1c529526f0521448dcbe53eda6c795085e..fdd11c12b7590d773b7f2f2ad3252553bcd599bc 100644 (file)
@@ -163,7 +163,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
        this->ecc.mode = NAND_ECC_SOFT;
 
        /* Enable the following for a flash based bad block table */
-       /* this->options = NAND_USE_FLASH_BBT; */
+       /* this->bbt_options = NAND_USE_FLASH_BBT; */
 
        /* Scan to find existence of the device */
        if (nand_scan(crisv32_mtd, 1)) {
index d5b0cc9f976bbf15637679dbedd78f4cd57d8fc2..3368177bdd3b5627f359d10904546cee112eab21 100644 (file)
@@ -154,7 +154,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
        this->ecc.mode = NAND_ECC_SOFT;
 
        /* Enable the following for a flash based bad block table */
-       /* this->options = NAND_USE_FLASH_BBT; */
+       /* this->bbt_options = NAND_USE_FLASH_BBT; */
 
        /* Scan to find existence of the device */
        if (nand_scan(crisv32_mtd, 1)) {
index 55da20ccc7a8996f0d80be785b91452e35dd8225..78d551622e11bb21798c18a39254fcf8a8403910 100644 (file)
@@ -583,7 +583,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
 
        if (on_flash_bbt) {
                printk(KERN_INFO "atmel_nand: Use On Flash BBT\n");
-               nand_chip->options |= NAND_USE_FLASH_BBT;
+               nand_chip->bbt_options |= NAND_USE_FLASH_BBT;
        }
 
        if (!cpu_has_dma())
index eddc9a2249859efe157dac13f8042da3afaf26e6..adf934df8958d96432ec3ceaa93f44497729ebbc 100644 (file)
@@ -172,9 +172,9 @@ static int __init autcpu12_init(void)
 
        /* Enable the following for a flash based bad block table */
        /*
-          this->options = NAND_USE_FLASH_BBT;
+          this->bbt_options = NAND_USE_FLASH_BBT;
         */
-       this->options = NAND_USE_FLASH_BBT;
+       this->bbt_options = NAND_USE_FLASH_BBT;
 
        /* Scan to find existence of the device */
        if (nand_scan(autcpu12_mtd, 1)) {
index 8c569e454dc5b52248fa98017e0d1071f6700f64..974d9bc8e48ebebe134274e6ed221a6dac1123ba 100644 (file)
@@ -474,7 +474,7 @@ static int __devinit bcm_umi_nand_probe(struct platform_device *pdev)
 
 #if NAND_ECC_BCH
        if (board_mtd->writesize > 512) {
-               if (this->options & NAND_USE_FLASH_BBT)
+               if (this->bbt_options & NAND_USE_FLASH_BBT)
                        largepage_bbt.options = NAND_BBT_SCAN2NDPAGE;
                this->badblock_pattern = &largepage_bbt;
        }
index 87ebb4e5b0c3b97949050ec10ff2a62b081c9bac..7dd7d844d2cf25353167d6a0a97ebd08b14abae5 100644 (file)
@@ -686,7 +686,8 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev,
        cafe->nand.chip_delay = 0;
 
        /* Enable the following for a flash based bad block table */
-       cafe->nand.options = NAND_USE_FLASH_BBT | NAND_NO_AUTOINCR | NAND_OWN_BUFFERS;
+       cafe->nand.bbt_options = NAND_USE_FLASH_BBT;
+       cafe->nand.options = NAND_NO_AUTOINCR | NAND_OWN_BUFFERS;
 
        if (skipbbt) {
                cafe->nand.options |= NAND_SKIP_BBTSCAN;
index f59ad1f2d5dbe7e23fa10a7762332ff2ee44e3cb..05adedd8c20c4a68db45eaa10097283b233d139b 100644 (file)
@@ -239,7 +239,8 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
        this->ecc.correct  = nand_correct_data;
 
        /* Enable the following for a flash based bad block table */
-       this->options = NAND_USE_FLASH_BBT | NAND_NO_AUTOINCR;
+       this->bbt_options = NAND_USE_FLASH_BBT;
+       this->options = NAND_NO_AUTOINCR;
 
        /* Scan to find existence of the device */
        if (nand_scan(new_mtd, 1)) {
index 1f34951ae1a7426f0344a7327c56a5b1105c7bc8..69f70195ff35c0a689f3cb83334abc5afa8bef9c 100644 (file)
@@ -581,7 +581,9 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
        info->chip.chip_delay   = 0;
        info->chip.select_chip  = nand_davinci_select_chip;
 
-       /* options such as NAND_USE_FLASH_BBT or 16-bit widths */
+       /* options such as NAND_USE_FLASH_BBT */
+       info->chip.bbt_options  = pdata->bbt_options;
+       /* options such as 16-bit widths */
        info->chip.options      = pdata->options;
        info->chip.bbt_td       = pdata->bbt_td;
        info->chip.bbt_md       = pdata->bbt_md;
index d5276218945fe296cb1c1b8c29cb8f21929dfb42..dbb6fbae7d2583cf1fcdf4380607b8fcde11c759 100644 (file)
@@ -1577,7 +1577,8 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
        denali->nand.bbt_md = &bbt_mirror_descr;
 
        /* skip the scan for now until we have OOB read and write support */
-       denali->nand.options |= NAND_USE_FLASH_BBT | NAND_SKIP_BBTSCAN;
+       denali->nand.bbt_options |= NAND_USE_FLASH_BBT;
+       denali->nand.options |= NAND_SKIP_BBTSCAN;
        denali->nand.ecc.mode = NAND_ECC_HW_SYNDROME;
 
        /* Denali Controller only support 15bit and 8bit ECC in MRST,
index 7837728d02ff4c15987d6275d593d3464b6cf073..f70bc73e7948043ecf72e00fd8a286169901fac8 100644 (file)
@@ -1652,7 +1652,7 @@ static int __init doc_probe(unsigned long physadr)
        nand->ecc.mode          = NAND_ECC_HW_SYNDROME;
        nand->ecc.size          = 512;
        nand->ecc.bytes         = 6;
-       nand->options           = NAND_USE_FLASH_BBT;
+       nand->bbt_options       = NAND_USE_FLASH_BBT;
 
        doc->physadr            = physadr;
        doc->virtadr            = virtadr;
index 33d8aad8bba5a47b2c0135acf4132454bab12eea..bff4791d73c3bc27c5ce129e357ba1ce729f2751 100644 (file)
@@ -791,8 +791,8 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
        chip->bbt_md = &bbt_mirror_descr;
 
        /* set up nand options */
-       chip->options = NAND_NO_READRDY | NAND_NO_AUTOINCR |
-                       NAND_USE_FLASH_BBT;
+       chip->options = NAND_NO_READRDY | NAND_NO_AUTOINCR;
+       chip->bbt_options = NAND_USE_FLASH_BBT;
 
        chip->controller = &elbc_fcm_ctrl->controller;
        chip->priv = priv;
index eb1fbac63eb6015ce2804d7e676698c4b51cd3ed..0ac64b54bd67dcb88acd03823356d7a8373e9c97 100644 (file)
@@ -735,7 +735,8 @@ static int __devinit mpc5121_nfc_probe(struct platform_device *op)
        chip->write_buf = mpc5121_nfc_write_buf;
        chip->verify_buf = mpc5121_nfc_verify_buf;
        chip->select_chip = mpc5121_nfc_select_chip;
-       chip->options = NAND_NO_AUTOINCR | NAND_USE_FLASH_BBT;
+       chip->options = NAND_NO_AUTOINCR;
+       chip->bbt_options = NAND_USE_FLASH_BBT;
        chip->ecc.mode = NAND_ECC_SOFT;
 
        /* Support external chip-select logic on ADS5121 board */
index 90df34c4d26cae887454de88099fa6c672c6b88d..ed68fde3d1be0ebd1f9b98036390479b94e729d4 100644 (file)
@@ -1179,7 +1179,7 @@ static int __init mxcnd_probe(struct platform_device *pdev)
                this->bbt_td = &bbt_main_descr;
                this->bbt_md = &bbt_mirror_descr;
                /* update flash based bbt */
-               this->options |= NAND_USE_FLASH_BBT;
+               this->bbt_options |= NAND_USE_FLASH_BBT;
        }
 
        init_completion(&host->op_completion);
index 3a9a8fc6a36c6e695e1fa2c1d93d190aa3278c50..d39dffe71de4160fbe0a139912c9d7e92bd06382 100644 (file)
@@ -405,7 +405,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
                chip->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1);
 
        /* Do we have a flash based bad block table ? */
-       if (chip->options & NAND_USE_FLASH_BBT)
+       if (chip->bbt_options & NAND_USE_FLASH_BBT)
                ret = nand_update_bbt(mtd, ofs);
        else {
                nand_get_device(chip, mtd, FL_WRITING);
index 5df01d8efd928b52ee9d9f75e229a74bde30fe59..66f93e2ac16b7217facf44378b4d00e19fb99ce9 100644 (file)
@@ -36,9 +36,9 @@
  * The table is marked in the OOB area with an ident pattern and a version
  * number which indicates which of both tables is more up to date. If the NAND
  * controller needs the complete OOB area for the ECC information then the
- * option NAND_USE_FLASH_BBT_NO_OOB should be used: it moves the ident pattern
- * and the version byte into the data area and the OOB area will remain
- * untouched.
+ * option NAND_BBT_NO_OOB should be used (along with NAND_USE_FLASH_BBT, of
+ * course): it moves the ident pattern and the version byte into the data area
+ * and the OOB area will remain untouched.
  *
  * The table uses 2 bits per block
  * 11b:                block is good
@@ -1082,16 +1082,16 @@ static void verify_bbt_descr(struct mtd_info *mtd, struct nand_bbt_descr *bd)
        pattern_len = bd->len;
        bits = bd->options & NAND_BBT_NRBITS_MSK;
 
-       BUG_ON((this->options & NAND_USE_FLASH_BBT_NO_OOB) &&
-                       !(this->options & NAND_USE_FLASH_BBT));
+       BUG_ON((this->bbt_options & NAND_BBT_NO_OOB) &&
+                       !(this->bbt_options & NAND_USE_FLASH_BBT));
        BUG_ON(!bits);
 
        if (bd->options & NAND_BBT_VERSION)
                pattern_len++;
 
        if (bd->options & NAND_BBT_NO_OOB) {
-               BUG_ON(!(this->options & NAND_USE_FLASH_BBT));
-               BUG_ON(!(this->options & NAND_USE_FLASH_BBT_NO_OOB));
+               BUG_ON(!(this->bbt_options & NAND_USE_FLASH_BBT));
+               BUG_ON(!(this->bbt_options & NAND_BBT_NO_OOB));
                BUG_ON(bd->offs);
                if (bd->options & NAND_BBT_VERSION)
                        BUG_ON(bd->veroffs != bd->len);
@@ -1357,15 +1357,15 @@ int nand_default_bbt(struct mtd_info *mtd)
                        this->bbt_td = &bbt_main_descr;
                        this->bbt_md = &bbt_mirror_descr;
                }
-               this->options |= NAND_USE_FLASH_BBT;
+               this->bbt_options |= NAND_USE_FLASH_BBT;
                return nand_scan_bbt(mtd, &agand_flashbased);
        }
 
        /* Is a flash based bad block table requested ? */
-       if (this->options & NAND_USE_FLASH_BBT) {
+       if (this->bbt_options & NAND_USE_FLASH_BBT) {
                /* Use the default pattern descriptors */
                if (!this->bbt_td) {
-                       if (this->options & NAND_USE_FLASH_BBT_NO_OOB) {
+                       if (this->bbt_options & NAND_BBT_NO_OOB) {
                                this->bbt_td = &bbt_main_no_bbt_descr;
                                this->bbt_md = &bbt_mirror_no_bbt_descr;
                        } else {
index 357e8c5252a8c38df3d8ba3885a7fc948b34303c..1856c42c62c4e5c14052f6508e2b077e8f948fbc 100644 (file)
@@ -2273,9 +2273,9 @@ static int __init ns_init_module(void)
 
        switch (bbt) {
        case 2:
-                chip->options |= NAND_USE_FLASH_BBT_NO_OOB;
+                chip->bbt_options |= NAND_BBT_NO_OOB;
        case 1:
-                chip->options |= NAND_USE_FLASH_BBT;
+                chip->bbt_options |= NAND_USE_FLASH_BBT;
        case 0:
                break;
        default:
index b1aa41b8a4eb6cd0d660d7c38eef8d1be00c0190..1c17f091e16b71a5792b01b1e40aa880f6f72324 100644 (file)
@@ -155,7 +155,8 @@ static int __devinit pasemi_nand_probe(struct platform_device *ofdev)
        chip->ecc.mode = NAND_ECC_SOFT;
 
        /* Enable the following for a flash based bad block table */
-       chip->options = NAND_USE_FLASH_BBT | NAND_NO_AUTOINCR;
+       chip->options = NAND_NO_AUTOINCR;
+       chip->bbt_options = NAND_USE_FLASH_BBT;
 
        /* Scan to find existence of the device */
        if (nand_scan(pasemi_nand_mtd, 1)) {
index 633c04bf76f6c158aa4029ab83dc6a3d7f3ddca9..ccdb16ec81430028eff5d6ba363d5a317d9fba5a 100644 (file)
@@ -79,6 +79,7 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
        data->chip.read_buf = pdata->ctrl.read_buf;
        data->chip.chip_delay = pdata->chip.chip_delay;
        data->chip.options |= pdata->chip.options;
+       data->chip.bbt_options |= pdata->chip.bbt_options;
 
        data->chip.ecc.hwctl = pdata->ctrl.hwcontrol;
        data->chip.ecc.layout = pdata->chip.ecclayout;
index 4405468f196b076c6b97fb1366ec8fff55d684a8..370516c3f7c74ebb0a9a784ebfb9de2adbccdeb2 100644 (file)
@@ -880,8 +880,10 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
        /* If you use u-boot BBT creation code, specifying this flag will
         * let the kernel fish out the BBT from the NAND, and also skip the
         * full NAND scan that can take 1/2s or so. Little things... */
-       if (set->flash_bbt)
-               chip->options |= NAND_USE_FLASH_BBT | NAND_SKIP_BBTSCAN;
+       if (set->flash_bbt) {
+               chip->bbt_options |= NAND_USE_FLASH_BBT;
+               chip->options |= NAND_SKIP_BBTSCAN;
+       }
 }
 
 /**
index 08ffa2193c0728ffa054d90e24d4f17d38b9904f..7929514781eafaa8c0dc514cec6f3448962b510c 100644 (file)
@@ -100,8 +100,13 @@ struct nand_bbt_descr {
 #define NAND_BBT_SCANLASTPAGE  0x00008000
 /* The nand_bbt_descr was created dynamicaly and must be freed */
 #define NAND_BBT_DYNAMICSTRUCT 0x00200000
-/* The bad block table does not OOB for marker */
-#define NAND_BBT_NO_OOB                0x00400000
+/*
+ * Use a flash based bad block table. By default, OOB identifier is saved in
+ * OOB area. This option is passed to the default bad block table function.
+ */
+#define NAND_USE_FLASH_BBT     0x00040000
+/* Do not store flash based bad block table in OOB area; store it in-band */
+#define NAND_BBT_NO_OOB                0x00080000
 
 /* The maximum number of blocks to scan for a bbt */
 #define NAND_BBT_SCAN_MAXBLOCKS        4
index 42f70e2d33af9ecce54346cd72831dd763a07b0d..8a086d2cacf4e2838d2e28e0adf5cdc4d86d70a3 100644 (file)
@@ -219,11 +219,6 @@ typedef enum {
 #define NAND_CHIPOPTIONS_MSK   (0x0000ffff & ~NAND_NO_AUTOINCR)
 
 /* Non chip related options */
-/*
- * Use a flash based bad block table. OOB identifier is saved in OOB area.
- * This option is passed to the default bad block table function.
- */
-#define NAND_USE_FLASH_BBT     0x00010000
 /* This option skips the bbt scan during initialization. */
 #define NAND_SKIP_BBTSCAN      0x00020000
 /*
@@ -233,11 +228,6 @@ typedef enum {
 #define NAND_OWN_BUFFERS       0x00040000
 /* Chip may not exist, so silence any errors in scan */
 #define NAND_SCAN_SILENT_NODEV 0x00080000
-/*
- * If passed additionally to NAND_USE_FLASH_BBT then BBT code will not touch
- * the OOB area.
- */
-#define NAND_USE_FLASH_BBT_NO_OOB      0x00800000
 /* Create an empty BBT with no vendor information if the BBT is available */
 #define NAND_CREATE_EMPTY_BBT          0x01000000
 
@@ -615,6 +605,7 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
  * @partitions:                mtd partition list
  * @chip_delay:                R/B delay value in us
  * @options:           Option flags, e.g. 16bit buswidth
+ * @bbt_options:       BBT option flags, e.g. NAND_BBT_USE_FLASH
  * @ecclayout:         ecc layout info structure
  * @part_probe_types:  NULL-terminated array of probe types
  * @set_parts:         platform specific function to set partitions
@@ -628,6 +619,7 @@ struct platform_nand_chip {
        struct nand_ecclayout *ecclayout;
        int chip_delay;
        unsigned int options;
+       unsigned int bbt_options;
        const char **part_probe_types;
        void (*set_parts)(uint64_t size, struct platform_nand_chip *chip);
        void *priv;