aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/mtdnand.tmpl5
-rw-r--r--arch/arm/mach-davinci/board-da830-evm.c2
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c2
-rw-r--r--arch/arm/mach-davinci/board-dm355-evm.c2
-rw-r--r--arch/arm/mach-davinci/board-dm355-leopard.c2
-rw-r--r--arch/arm/mach-davinci/board-dm365-evm.c2
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c2
-rw-r--r--arch/arm/mach-davinci/board-mityomapl138.c3
-rw-r--r--arch/arm/mach-davinci/board-neuros-osd2.c2
-rw-r--r--arch/arm/mach-davinci/board-tnetv107x-evm.c2
-rw-r--r--arch/arm/mach-davinci/include/mach/nand.h4
-rw-r--r--arch/arm/mach-orion5x/ts78xx-setup.c2
-rw-r--r--arch/cris/arch-v32/drivers/mach-a3/nandflash.c2
-rw-r--r--arch/cris/arch-v32/drivers/mach-fs/nandflash.c2
-rw-r--r--drivers/mtd/nand/atmel_nand.c2
-rw-r--r--drivers/mtd/nand/autcpu12.c4
-rw-r--r--drivers/mtd/nand/bcm_umi_nand.c2
-rw-r--r--drivers/mtd/nand/cafe_nand.c3
-rw-r--r--drivers/mtd/nand/cs553x_nand.c3
-rw-r--r--drivers/mtd/nand/davinci_nand.c4
-rw-r--r--drivers/mtd/nand/denali.c3
-rw-r--r--drivers/mtd/nand/diskonchip.c2
-rw-r--r--drivers/mtd/nand/fsl_elbc_nand.c4
-rw-r--r--drivers/mtd/nand/mpc5121_nfc.c3
-rw-r--r--drivers/mtd/nand/mxc_nand.c2
-rw-r--r--drivers/mtd/nand/nand_base.c2
-rw-r--r--drivers/mtd/nand/nand_bbt.c20
-rw-r--r--drivers/mtd/nand/nandsim.c4
-rw-r--r--drivers/mtd/nand/pasemi_nand.c3
-rw-r--r--drivers/mtd/nand/plat_nand.c1
-rw-r--r--drivers/mtd/nand/s3c2410.c6
-rw-r--r--include/linux/mtd/bbm.h9
-rw-r--r--include/linux/mtd/nand.h12
33 files changed, 65 insertions, 58 deletions
diff --git a/Documentation/DocBook/mtdnand.tmpl b/Documentation/DocBook/mtdnand.tmpl
index 17910e2052ad..05cc83ea8ef7 100644
--- a/Documentation/DocBook/mtdnand.tmpl
+++ b/Documentation/DocBook/mtdnand.tmpl
@@ -572,7 +572,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip)
572 </para> 572 </para>
573 <para> 573 <para>
574 The simplest way to activate the FLASH based bad block table support 574 The simplest way to activate the FLASH based bad block table support
575 is to set the option NAND_USE_FLASH_BBT in the option field of 575 is to set the option NAND_USE_FLASH_BBT in the bbt_option field of
576 the nand chip structure before calling nand_scan(). For AG-AND 576 the nand chip structure before calling nand_scan(). For AG-AND
577 chips is this done by default. 577 chips is this done by default.
578 This activates the default FLASH based bad block table functionality 578 This activates the default FLASH based bad block table functionality
@@ -1158,9 +1158,6 @@ in this page</entry>
1158 These constants are defined in nand.h. They are ored together to describe 1158 These constants are defined in nand.h. They are ored together to describe
1159 the functionality. 1159 the functionality.
1160 <programlisting> 1160 <programlisting>
1161/* Use a flash based bad block table. This option is parsed by the
1162 * default bad block table function (nand_default_bbt). */
1163#define NAND_USE_FLASH_BBT 0x00010000
1164/* The hw ecc generator provides a syndrome instead a ecc value on read 1161/* The hw ecc generator provides a syndrome instead a ecc value on read
1165 * This can only work if we have the ecc bytes directly behind the 1162 * This can only work if we have the ecc bytes directly behind the
1166 * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */ 1163 * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index 84fd78684868..a790c1b363ff 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -377,7 +377,7 @@ static struct davinci_nand_pdata da830_evm_nand_pdata = {
377 .nr_parts = ARRAY_SIZE(da830_evm_nand_partitions), 377 .nr_parts = ARRAY_SIZE(da830_evm_nand_partitions),
378 .ecc_mode = NAND_ECC_HW, 378 .ecc_mode = NAND_ECC_HW,
379 .ecc_bits = 4, 379 .ecc_bits = 4,
380 .options = NAND_USE_FLASH_BBT, 380 .bbt_options = NAND_USE_FLASH_BBT,
381 .bbt_td = &da830_evm_nand_bbt_main_descr, 381 .bbt_td = &da830_evm_nand_bbt_main_descr,
382 .bbt_md = &da830_evm_nand_bbt_mirror_descr, 382 .bbt_md = &da830_evm_nand_bbt_mirror_descr,
383 .timing = &da830_evm_nandflash_timing, 383 .timing = &da830_evm_nandflash_timing,
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index bd5394537c88..de27111d1b27 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -225,7 +225,7 @@ static struct davinci_nand_pdata da850_evm_nandflash_data = {
225 .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition), 225 .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition),
226 .ecc_mode = NAND_ECC_HW, 226 .ecc_mode = NAND_ECC_HW,
227 .ecc_bits = 4, 227 .ecc_bits = 4,
228 .options = NAND_USE_FLASH_BBT, 228 .bbt_options = NAND_USE_FLASH_BBT,
229 .timing = &da850_evm_nandflash_timing, 229 .timing = &da850_evm_nandflash_timing,
230}; 230};
231 231
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index 241a6bd67408..fd2de2c0338b 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -77,7 +77,7 @@ static struct davinci_nand_pdata davinci_nand_data = {
77 .parts = davinci_nand_partitions, 77 .parts = davinci_nand_partitions,
78 .nr_parts = ARRAY_SIZE(davinci_nand_partitions), 78 .nr_parts = ARRAY_SIZE(davinci_nand_partitions),
79 .ecc_mode = NAND_ECC_HW, 79 .ecc_mode = NAND_ECC_HW,
80 .options = NAND_USE_FLASH_BBT, 80 .bbt_options = NAND_USE_FLASH_BBT,
81 .ecc_bits = 4, 81 .ecc_bits = 4,
82}; 82};
83 83
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
index bee284ca7fd6..cfbd897e6611 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -74,7 +74,7 @@ static struct davinci_nand_pdata davinci_nand_data = {
74 .parts = davinci_nand_partitions, 74 .parts = davinci_nand_partitions,
75 .nr_parts = ARRAY_SIZE(davinci_nand_partitions), 75 .nr_parts = ARRAY_SIZE(davinci_nand_partitions),
76 .ecc_mode = NAND_ECC_HW_SYNDROME, 76 .ecc_mode = NAND_ECC_HW_SYNDROME,
77 .options = NAND_USE_FLASH_BBT, 77 .bbt_options = NAND_USE_FLASH_BBT,
78}; 78};
79 79
80static struct resource davinci_nand_resources[] = { 80static struct resource davinci_nand_resources[] = {
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index 9818f214d4f0..e66116ddea4f 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -139,7 +139,7 @@ static struct davinci_nand_pdata davinci_nand_data = {
139 .parts = davinci_nand_partitions, 139 .parts = davinci_nand_partitions,
140 .nr_parts = ARRAY_SIZE(davinci_nand_partitions), 140 .nr_parts = ARRAY_SIZE(davinci_nand_partitions),
141 .ecc_mode = NAND_ECC_HW, 141 .ecc_mode = NAND_ECC_HW,
142 .options = NAND_USE_FLASH_BBT, 142 .bbt_options = NAND_USE_FLASH_BBT,
143 .ecc_bits = 4, 143 .ecc_bits = 4,
144}; 144};
145 145
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index 95607a191e03..dde204933c9e 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -150,7 +150,7 @@ static struct davinci_nand_pdata davinci_evm_nandflash_data = {
150 .parts = davinci_evm_nandflash_partition, 150 .parts = davinci_evm_nandflash_partition,
151 .nr_parts = ARRAY_SIZE(davinci_evm_nandflash_partition), 151 .nr_parts = ARRAY_SIZE(davinci_evm_nandflash_partition),
152 .ecc_mode = NAND_ECC_HW, 152 .ecc_mode = NAND_ECC_HW,
153 .options = NAND_USE_FLASH_BBT, 153 .bbt_options = NAND_USE_FLASH_BBT,
154 .timing = &davinci_evm_nandflash_timing, 154 .timing = &davinci_evm_nandflash_timing,
155}; 155};
156 156
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
index c278226627ad..ef7ba494493d 100644
--- a/arch/arm/mach-davinci/board-mityomapl138.c
+++ b/arch/arm/mach-davinci/board-mityomapl138.c
@@ -396,7 +396,8 @@ static struct davinci_nand_pdata mityomapl138_nandflash_data = {
396 .parts = mityomapl138_nandflash_partition, 396 .parts = mityomapl138_nandflash_partition,
397 .nr_parts = ARRAY_SIZE(mityomapl138_nandflash_partition), 397 .nr_parts = ARRAY_SIZE(mityomapl138_nandflash_partition),
398 .ecc_mode = NAND_ECC_HW, 398 .ecc_mode = NAND_ECC_HW,
399 .options = NAND_USE_FLASH_BBT | NAND_BUSWIDTH_16, 399 .bbt_options = NAND_USE_FLASH_BBT,
400 .options = NAND_BUSWIDTH_16,
400 .ecc_bits = 1, /* 4 bit mode is not supported with 16 bit NAND */ 401 .ecc_bits = 1, /* 4 bit mode is not supported with 16 bit NAND */
401}; 402};
402 403
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index d60a80028ba3..1989768973a7 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -87,7 +87,7 @@ static struct davinci_nand_pdata davinci_ntosd2_nandflash_data = {
87 .parts = davinci_ntosd2_nandflash_partition, 87 .parts = davinci_ntosd2_nandflash_partition,
88 .nr_parts = ARRAY_SIZE(davinci_ntosd2_nandflash_partition), 88 .nr_parts = ARRAY_SIZE(davinci_ntosd2_nandflash_partition),
89 .ecc_mode = NAND_ECC_HW, 89 .ecc_mode = NAND_ECC_HW,
90 .options = NAND_USE_FLASH_BBT, 90 .bbt_options = NAND_USE_FLASH_BBT,
91}; 91};
92 92
93static struct resource davinci_ntosd2_nandflash_resource[] = { 93static struct resource davinci_ntosd2_nandflash_resource[] = {
diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c
index 782892065682..046f8e00938e 100644
--- a/arch/arm/mach-davinci/board-tnetv107x-evm.c
+++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c
@@ -144,7 +144,7 @@ static struct davinci_nand_pdata nand_config = {
144 .parts = nand_partitions, 144 .parts = nand_partitions,
145 .nr_parts = ARRAY_SIZE(nand_partitions), 145 .nr_parts = ARRAY_SIZE(nand_partitions),
146 .ecc_mode = NAND_ECC_HW, 146 .ecc_mode = NAND_ECC_HW,
147 .options = NAND_USE_FLASH_BBT, 147 .bbt_options = NAND_USE_FLASH_BBT,
148 .ecc_bits = 1, 148 .ecc_bits = 1,
149}; 149};
150 150
diff --git a/arch/arm/mach-davinci/include/mach/nand.h b/arch/arm/mach-davinci/include/mach/nand.h
index 025151049f05..2c506f905cb8 100644
--- a/arch/arm/mach-davinci/include/mach/nand.h
+++ b/arch/arm/mach-davinci/include/mach/nand.h
@@ -74,8 +74,10 @@ struct davinci_nand_pdata { /* platform_data */
74 nand_ecc_modes_t ecc_mode; 74 nand_ecc_modes_t ecc_mode;
75 u8 ecc_bits; 75 u8 ecc_bits;
76 76
77 /* e.g. NAND_BUSWIDTH_16 or NAND_USE_FLASH_BBT */ 77 /* e.g. NAND_BUSWIDTH_16 */
78 unsigned options; 78 unsigned options;
79 /* e.g. NAND_USE_FLASH_BBT */
80 unsigned bbt_options;
79 81
80 /* Main and mirror bbt descriptor overrides */ 82 /* Main and mirror bbt descriptor overrides */
81 struct nand_bbt_descr *bbt_td; 83 struct nand_bbt_descr *bbt_td;
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c
index 6b7b54116f30..e5ca57ce6e50 100644
--- a/arch/arm/mach-orion5x/ts78xx-setup.c
+++ b/arch/arm/mach-orion5x/ts78xx-setup.c
@@ -275,7 +275,7 @@ static struct platform_nand_data ts78xx_ts_nand_data = {
275 .partitions = ts78xx_ts_nand_parts, 275 .partitions = ts78xx_ts_nand_parts,
276 .nr_partitions = ARRAY_SIZE(ts78xx_ts_nand_parts), 276 .nr_partitions = ARRAY_SIZE(ts78xx_ts_nand_parts),
277 .chip_delay = 15, 277 .chip_delay = 15,
278 .options = NAND_USE_FLASH_BBT, 278 .bbt_options = NAND_USE_FLASH_BBT,
279 }, 279 },
280 .ctrl = { 280 .ctrl = {
281 /* 281 /*
diff --git a/arch/cris/arch-v32/drivers/mach-a3/nandflash.c b/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
index f58f2c1c5295..fdd11c12b759 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
@@ -163,7 +163,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
163 this->ecc.mode = NAND_ECC_SOFT; 163 this->ecc.mode = NAND_ECC_SOFT;
164 164
165 /* Enable the following for a flash based bad block table */ 165 /* Enable the following for a flash based bad block table */
166 /* this->options = NAND_USE_FLASH_BBT; */ 166 /* this->bbt_options = NAND_USE_FLASH_BBT; */
167 167
168 /* Scan to find existence of the device */ 168 /* Scan to find existence of the device */
169 if (nand_scan(crisv32_mtd, 1)) { 169 if (nand_scan(crisv32_mtd, 1)) {
diff --git a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
index d5b0cc9f976b..3368177bdd3b 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
@@ -154,7 +154,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
154 this->ecc.mode = NAND_ECC_SOFT; 154 this->ecc.mode = NAND_ECC_SOFT;
155 155
156 /* Enable the following for a flash based bad block table */ 156 /* Enable the following for a flash based bad block table */
157 /* this->options = NAND_USE_FLASH_BBT; */ 157 /* this->bbt_options = NAND_USE_FLASH_BBT; */
158 158
159 /* Scan to find existence of the device */ 159 /* Scan to find existence of the device */
160 if (nand_scan(crisv32_mtd, 1)) { 160 if (nand_scan(crisv32_mtd, 1)) {
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 55da20ccc7a8..78d551622e11 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -583,7 +583,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
583 583
584 if (on_flash_bbt) { 584 if (on_flash_bbt) {
585 printk(KERN_INFO "atmel_nand: Use On Flash BBT\n"); 585 printk(KERN_INFO "atmel_nand: Use On Flash BBT\n");
586 nand_chip->options |= NAND_USE_FLASH_BBT; 586 nand_chip->bbt_options |= NAND_USE_FLASH_BBT;
587 } 587 }
588 588
589 if (!cpu_has_dma()) 589 if (!cpu_has_dma())
diff --git a/drivers/mtd/nand/autcpu12.c b/drivers/mtd/nand/autcpu12.c
index eddc9a224985..adf934df8958 100644
--- a/drivers/mtd/nand/autcpu12.c
+++ b/drivers/mtd/nand/autcpu12.c
@@ -172,9 +172,9 @@ static int __init autcpu12_init(void)
172 172
173 /* Enable the following for a flash based bad block table */ 173 /* Enable the following for a flash based bad block table */
174 /* 174 /*
175 this->options = NAND_USE_FLASH_BBT; 175 this->bbt_options = NAND_USE_FLASH_BBT;
176 */ 176 */
177 this->options = NAND_USE_FLASH_BBT; 177 this->bbt_options = NAND_USE_FLASH_BBT;
178 178
179 /* Scan to find existence of the device */ 179 /* Scan to find existence of the device */
180 if (nand_scan(autcpu12_mtd, 1)) { 180 if (nand_scan(autcpu12_mtd, 1)) {
diff --git a/drivers/mtd/nand/bcm_umi_nand.c b/drivers/mtd/nand/bcm_umi_nand.c
index 8c569e454dc5..974d9bc8e48e 100644
--- a/drivers/mtd/nand/bcm_umi_nand.c
+++ b/drivers/mtd/nand/bcm_umi_nand.c
@@ -474,7 +474,7 @@ static int __devinit bcm_umi_nand_probe(struct platform_device *pdev)
474 474
475#if NAND_ECC_BCH 475#if NAND_ECC_BCH
476 if (board_mtd->writesize > 512) { 476 if (board_mtd->writesize > 512) {
477 if (this->options & NAND_USE_FLASH_BBT) 477 if (this->bbt_options & NAND_USE_FLASH_BBT)
478 largepage_bbt.options = NAND_BBT_SCAN2NDPAGE; 478 largepage_bbt.options = NAND_BBT_SCAN2NDPAGE;
479 this->badblock_pattern = &largepage_bbt; 479 this->badblock_pattern = &largepage_bbt;
480 } 480 }
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
index 87ebb4e5b0c3..7dd7d844d2cf 100644
--- a/drivers/mtd/nand/cafe_nand.c
+++ b/drivers/mtd/nand/cafe_nand.c
@@ -686,7 +686,8 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev,
686 cafe->nand.chip_delay = 0; 686 cafe->nand.chip_delay = 0;
687 687
688 /* Enable the following for a flash based bad block table */ 688 /* Enable the following for a flash based bad block table */
689 cafe->nand.options = NAND_USE_FLASH_BBT | NAND_NO_AUTOINCR | NAND_OWN_BUFFERS; 689 cafe->nand.bbt_options = NAND_USE_FLASH_BBT;
690 cafe->nand.options = NAND_NO_AUTOINCR | NAND_OWN_BUFFERS;
690 691
691 if (skipbbt) { 692 if (skipbbt) {
692 cafe->nand.options |= NAND_SKIP_BBTSCAN; 693 cafe->nand.options |= NAND_SKIP_BBTSCAN;
diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c
index f59ad1f2d5db..05adedd8c20c 100644
--- a/drivers/mtd/nand/cs553x_nand.c
+++ b/drivers/mtd/nand/cs553x_nand.c
@@ -239,7 +239,8 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
239 this->ecc.correct = nand_correct_data; 239 this->ecc.correct = nand_correct_data;
240 240
241 /* Enable the following for a flash based bad block table */ 241 /* Enable the following for a flash based bad block table */
242 this->options = NAND_USE_FLASH_BBT | NAND_NO_AUTOINCR; 242 this->bbt_options = NAND_USE_FLASH_BBT;
243 this->options = NAND_NO_AUTOINCR;
243 244
244 /* Scan to find existence of the device */ 245 /* Scan to find existence of the device */
245 if (nand_scan(new_mtd, 1)) { 246 if (nand_scan(new_mtd, 1)) {
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index 1f34951ae1a7..69f70195ff35 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -581,7 +581,9 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
581 info->chip.chip_delay = 0; 581 info->chip.chip_delay = 0;
582 info->chip.select_chip = nand_davinci_select_chip; 582 info->chip.select_chip = nand_davinci_select_chip;
583 583
584 /* options such as NAND_USE_FLASH_BBT or 16-bit widths */ 584 /* options such as NAND_USE_FLASH_BBT */
585 info->chip.bbt_options = pdata->bbt_options;
586 /* options such as 16-bit widths */
585 info->chip.options = pdata->options; 587 info->chip.options = pdata->options;
586 info->chip.bbt_td = pdata->bbt_td; 588 info->chip.bbt_td = pdata->bbt_td;
587 info->chip.bbt_md = pdata->bbt_md; 589 info->chip.bbt_md = pdata->bbt_md;
diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c
index d5276218945f..dbb6fbae7d25 100644
--- a/drivers/mtd/nand/denali.c
+++ b/drivers/mtd/nand/denali.c
@@ -1577,7 +1577,8 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
1577 denali->nand.bbt_md = &bbt_mirror_descr; 1577 denali->nand.bbt_md = &bbt_mirror_descr;
1578 1578
1579 /* skip the scan for now until we have OOB read and write support */ 1579 /* skip the scan for now until we have OOB read and write support */
1580 denali->nand.options |= NAND_USE_FLASH_BBT | NAND_SKIP_BBTSCAN; 1580 denali->nand.bbt_options |= NAND_USE_FLASH_BBT;
1581 denali->nand.options |= NAND_SKIP_BBTSCAN;
1581 denali->nand.ecc.mode = NAND_ECC_HW_SYNDROME; 1582 denali->nand.ecc.mode = NAND_ECC_HW_SYNDROME;
1582 1583
1583 /* Denali Controller only support 15bit and 8bit ECC in MRST, 1584 /* Denali Controller only support 15bit and 8bit ECC in MRST,
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c
index 7837728d02ff..f70bc73e7948 100644
--- a/drivers/mtd/nand/diskonchip.c
+++ b/drivers/mtd/nand/diskonchip.c
@@ -1652,7 +1652,7 @@ static int __init doc_probe(unsigned long physadr)
1652 nand->ecc.mode = NAND_ECC_HW_SYNDROME; 1652 nand->ecc.mode = NAND_ECC_HW_SYNDROME;
1653 nand->ecc.size = 512; 1653 nand->ecc.size = 512;
1654 nand->ecc.bytes = 6; 1654 nand->ecc.bytes = 6;
1655 nand->options = NAND_USE_FLASH_BBT; 1655 nand->bbt_options = NAND_USE_FLASH_BBT;
1656 1656
1657 doc->physadr = physadr; 1657 doc->physadr = physadr;
1658 doc->virtadr = virtadr; 1658 doc->virtadr = virtadr;
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 33d8aad8bba5..bff4791d73c3 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -791,8 +791,8 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
791 chip->bbt_md = &bbt_mirror_descr; 791 chip->bbt_md = &bbt_mirror_descr;
792 792
793 /* set up nand options */ 793 /* set up nand options */
794 chip->options = NAND_NO_READRDY | NAND_NO_AUTOINCR | 794 chip->options = NAND_NO_READRDY | NAND_NO_AUTOINCR;
795 NAND_USE_FLASH_BBT; 795 chip->bbt_options = NAND_USE_FLASH_BBT;
796 796
797 chip->controller = &elbc_fcm_ctrl->controller; 797 chip->controller = &elbc_fcm_ctrl->controller;
798 chip->priv = priv; 798 chip->priv = priv;
diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c
index eb1fbac63eb6..0ac64b54bd67 100644
--- a/drivers/mtd/nand/mpc5121_nfc.c
+++ b/drivers/mtd/nand/mpc5121_nfc.c
@@ -735,7 +735,8 @@ static int __devinit mpc5121_nfc_probe(struct platform_device *op)
735 chip->write_buf = mpc5121_nfc_write_buf; 735 chip->write_buf = mpc5121_nfc_write_buf;
736 chip->verify_buf = mpc5121_nfc_verify_buf; 736 chip->verify_buf = mpc5121_nfc_verify_buf;
737 chip->select_chip = mpc5121_nfc_select_chip; 737 chip->select_chip = mpc5121_nfc_select_chip;
738 chip->options = NAND_NO_AUTOINCR | NAND_USE_FLASH_BBT; 738 chip->options = NAND_NO_AUTOINCR;
739 chip->bbt_options = NAND_USE_FLASH_BBT;
739 chip->ecc.mode = NAND_ECC_SOFT; 740 chip->ecc.mode = NAND_ECC_SOFT;
740 741
741 /* Support external chip-select logic on ADS5121 board */ 742 /* Support external chip-select logic on ADS5121 board */
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 90df34c4d26c..ed68fde3d1be 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1179,7 +1179,7 @@ static int __init mxcnd_probe(struct platform_device *pdev)
1179 this->bbt_td = &bbt_main_descr; 1179 this->bbt_td = &bbt_main_descr;
1180 this->bbt_md = &bbt_mirror_descr; 1180 this->bbt_md = &bbt_mirror_descr;
1181 /* update flash based bbt */ 1181 /* update flash based bbt */
1182 this->options |= NAND_USE_FLASH_BBT; 1182 this->bbt_options |= NAND_USE_FLASH_BBT;
1183 } 1183 }
1184 1184
1185 init_completion(&host->op_completion); 1185 init_completion(&host->op_completion);
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 3a9a8fc6a36c..d39dffe71de4 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -405,7 +405,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
405 chip->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1); 405 chip->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1);
406 406
407 /* Do we have a flash based bad block table ? */ 407 /* Do we have a flash based bad block table ? */
408 if (chip->options & NAND_USE_FLASH_BBT) 408 if (chip->bbt_options & NAND_USE_FLASH_BBT)
409 ret = nand_update_bbt(mtd, ofs); 409 ret = nand_update_bbt(mtd, ofs);
410 else { 410 else {
411 nand_get_device(chip, mtd, FL_WRITING); 411 nand_get_device(chip, mtd, FL_WRITING);
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 5df01d8efd92..66f93e2ac16b 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -36,9 +36,9 @@
36 * The table is marked in the OOB area with an ident pattern and a version 36 * The table is marked in the OOB area with an ident pattern and a version
37 * number which indicates which of both tables is more up to date. If the NAND 37 * number which indicates which of both tables is more up to date. If the NAND
38 * controller needs the complete OOB area for the ECC information then the 38 * controller needs the complete OOB area for the ECC information then the
39 * option NAND_USE_FLASH_BBT_NO_OOB should be used: it moves the ident pattern 39 * option NAND_BBT_NO_OOB should be used (along with NAND_USE_FLASH_BBT, of
40 * and the version byte into the data area and the OOB area will remain 40 * course): it moves the ident pattern and the version byte into the data area
41 * untouched. 41 * and the OOB area will remain untouched.
42 * 42 *
43 * The table uses 2 bits per block 43 * The table uses 2 bits per block
44 * 11b: block is good 44 * 11b: block is good
@@ -1082,16 +1082,16 @@ static void verify_bbt_descr(struct mtd_info *mtd, struct nand_bbt_descr *bd)
1082 pattern_len = bd->len; 1082 pattern_len = bd->len;
1083 bits = bd->options & NAND_BBT_NRBITS_MSK; 1083 bits = bd->options & NAND_BBT_NRBITS_MSK;
1084 1084
1085 BUG_ON((this->options & NAND_USE_FLASH_BBT_NO_OOB) && 1085 BUG_ON((this->bbt_options & NAND_BBT_NO_OOB) &&
1086 !(this->options & NAND_USE_FLASH_BBT)); 1086 !(this->bbt_options & NAND_USE_FLASH_BBT));
1087 BUG_ON(!bits); 1087 BUG_ON(!bits);
1088 1088
1089 if (bd->options & NAND_BBT_VERSION) 1089 if (bd->options & NAND_BBT_VERSION)
1090 pattern_len++; 1090 pattern_len++;
1091 1091
1092 if (bd->options & NAND_BBT_NO_OOB) { 1092 if (bd->options & NAND_BBT_NO_OOB) {
1093 BUG_ON(!(this->options & NAND_USE_FLASH_BBT)); 1093 BUG_ON(!(this->bbt_options & NAND_USE_FLASH_BBT));
1094 BUG_ON(!(this->options & NAND_USE_FLASH_BBT_NO_OOB)); 1094 BUG_ON(!(this->bbt_options & NAND_BBT_NO_OOB));
1095 BUG_ON(bd->offs); 1095 BUG_ON(bd->offs);
1096 if (bd->options & NAND_BBT_VERSION) 1096 if (bd->options & NAND_BBT_VERSION)
1097 BUG_ON(bd->veroffs != bd->len); 1097 BUG_ON(bd->veroffs != bd->len);
@@ -1357,15 +1357,15 @@ int nand_default_bbt(struct mtd_info *mtd)
1357 this->bbt_td = &bbt_main_descr; 1357 this->bbt_td = &bbt_main_descr;
1358 this->bbt_md = &bbt_mirror_descr; 1358 this->bbt_md = &bbt_mirror_descr;
1359 } 1359 }
1360 this->options |= NAND_USE_FLASH_BBT; 1360 this->bbt_options |= NAND_USE_FLASH_BBT;
1361 return nand_scan_bbt(mtd, &agand_flashbased); 1361 return nand_scan_bbt(mtd, &agand_flashbased);
1362 } 1362 }
1363 1363
1364 /* Is a flash based bad block table requested ? */ 1364 /* Is a flash based bad block table requested ? */
1365 if (this->options & NAND_USE_FLASH_BBT) { 1365 if (this->bbt_options & NAND_USE_FLASH_BBT) {
1366 /* Use the default pattern descriptors */ 1366 /* Use the default pattern descriptors */
1367 if (!this->bbt_td) { 1367 if (!this->bbt_td) {
1368 if (this->options & NAND_USE_FLASH_BBT_NO_OOB) { 1368 if (this->bbt_options & NAND_BBT_NO_OOB) {
1369 this->bbt_td = &bbt_main_no_bbt_descr; 1369 this->bbt_td = &bbt_main_no_bbt_descr;
1370 this->bbt_md = &bbt_mirror_no_bbt_descr; 1370 this->bbt_md = &bbt_mirror_no_bbt_descr;
1371 } else { 1371 } else {
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 357e8c5252a8..1856c42c62c4 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -2273,9 +2273,9 @@ static int __init ns_init_module(void)
2273 2273
2274 switch (bbt) { 2274 switch (bbt) {
2275 case 2: 2275 case 2:
2276 chip->options |= NAND_USE_FLASH_BBT_NO_OOB; 2276 chip->bbt_options |= NAND_BBT_NO_OOB;
2277 case 1: 2277 case 1:
2278 chip->options |= NAND_USE_FLASH_BBT; 2278 chip->bbt_options |= NAND_USE_FLASH_BBT;
2279 case 0: 2279 case 0:
2280 break; 2280 break;
2281 default: 2281 default:
diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c
index b1aa41b8a4eb..1c17f091e16b 100644
--- a/drivers/mtd/nand/pasemi_nand.c
+++ b/drivers/mtd/nand/pasemi_nand.c
@@ -155,7 +155,8 @@ static int __devinit pasemi_nand_probe(struct platform_device *ofdev)
155 chip->ecc.mode = NAND_ECC_SOFT; 155 chip->ecc.mode = NAND_ECC_SOFT;
156 156
157 /* Enable the following for a flash based bad block table */ 157 /* Enable the following for a flash based bad block table */
158 chip->options = NAND_USE_FLASH_BBT | NAND_NO_AUTOINCR; 158 chip->options = NAND_NO_AUTOINCR;
159 chip->bbt_options = NAND_USE_FLASH_BBT;
159 160
160 /* Scan to find existence of the device */ 161 /* Scan to find existence of the device */
161 if (nand_scan(pasemi_nand_mtd, 1)) { 162 if (nand_scan(pasemi_nand_mtd, 1)) {
diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c
index 633c04bf76f6..ccdb16ec8143 100644
--- a/drivers/mtd/nand/plat_nand.c
+++ b/drivers/mtd/nand/plat_nand.c
@@ -79,6 +79,7 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
79 data->chip.read_buf = pdata->ctrl.read_buf; 79 data->chip.read_buf = pdata->ctrl.read_buf;
80 data->chip.chip_delay = pdata->chip.chip_delay; 80 data->chip.chip_delay = pdata->chip.chip_delay;
81 data->chip.options |= pdata->chip.options; 81 data->chip.options |= pdata->chip.options;
82 data->chip.bbt_options |= pdata->chip.bbt_options;
82 83
83 data->chip.ecc.hwctl = pdata->ctrl.hwcontrol; 84 data->chip.ecc.hwctl = pdata->ctrl.hwcontrol;
84 data->chip.ecc.layout = pdata->chip.ecclayout; 85 data->chip.ecc.layout = pdata->chip.ecclayout;
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 4405468f196b..370516c3f7c7 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -880,8 +880,10 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
880 /* If you use u-boot BBT creation code, specifying this flag will 880 /* If you use u-boot BBT creation code, specifying this flag will
881 * let the kernel fish out the BBT from the NAND, and also skip the 881 * let the kernel fish out the BBT from the NAND, and also skip the
882 * full NAND scan that can take 1/2s or so. Little things... */ 882 * full NAND scan that can take 1/2s or so. Little things... */
883 if (set->flash_bbt) 883 if (set->flash_bbt) {
884 chip->options |= NAND_USE_FLASH_BBT | NAND_SKIP_BBTSCAN; 884 chip->bbt_options |= NAND_USE_FLASH_BBT;
885 chip->options |= NAND_SKIP_BBTSCAN;
886 }
885} 887}
886 888
887/** 889/**
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 08ffa2193c07..7929514781ea 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -100,8 +100,13 @@ struct nand_bbt_descr {
100#define NAND_BBT_SCANLASTPAGE 0x00008000 100#define NAND_BBT_SCANLASTPAGE 0x00008000
101/* The nand_bbt_descr was created dynamicaly and must be freed */ 101/* The nand_bbt_descr was created dynamicaly and must be freed */
102#define NAND_BBT_DYNAMICSTRUCT 0x00200000 102#define NAND_BBT_DYNAMICSTRUCT 0x00200000
103/* The bad block table does not OOB for marker */ 103/*
104#define NAND_BBT_NO_OOB 0x00400000 104 * Use a flash based bad block table. By default, OOB identifier is saved in
105 * OOB area. This option is passed to the default bad block table function.
106 */
107#define NAND_USE_FLASH_BBT 0x00040000
108/* Do not store flash based bad block table in OOB area; store it in-band */
109#define NAND_BBT_NO_OOB 0x00080000
105 110
106/* The maximum number of blocks to scan for a bbt */ 111/* The maximum number of blocks to scan for a bbt */
107#define NAND_BBT_SCAN_MAXBLOCKS 4 112#define NAND_BBT_SCAN_MAXBLOCKS 4
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 42f70e2d33af..8a086d2cacf4 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -219,11 +219,6 @@ typedef enum {
219#define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) 219#define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR)
220 220
221/* Non chip related options */ 221/* Non chip related options */
222/*
223 * Use a flash based bad block table. OOB identifier is saved in OOB area.
224 * This option is passed to the default bad block table function.
225 */
226#define NAND_USE_FLASH_BBT 0x00010000
227/* This option skips the bbt scan during initialization. */ 222/* This option skips the bbt scan during initialization. */
228#define NAND_SKIP_BBTSCAN 0x00020000 223#define NAND_SKIP_BBTSCAN 0x00020000
229/* 224/*
@@ -233,11 +228,6 @@ typedef enum {
233#define NAND_OWN_BUFFERS 0x00040000 228#define NAND_OWN_BUFFERS 0x00040000
234/* Chip may not exist, so silence any errors in scan */ 229/* Chip may not exist, so silence any errors in scan */
235#define NAND_SCAN_SILENT_NODEV 0x00080000 230#define NAND_SCAN_SILENT_NODEV 0x00080000
236/*
237 * If passed additionally to NAND_USE_FLASH_BBT then BBT code will not touch
238 * the OOB area.
239 */
240#define NAND_USE_FLASH_BBT_NO_OOB 0x00800000
241/* Create an empty BBT with no vendor information if the BBT is available */ 231/* Create an empty BBT with no vendor information if the BBT is available */
242#define NAND_CREATE_EMPTY_BBT 0x01000000 232#define NAND_CREATE_EMPTY_BBT 0x01000000
243 233
@@ -615,6 +605,7 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
615 * @partitions: mtd partition list 605 * @partitions: mtd partition list
616 * @chip_delay: R/B delay value in us 606 * @chip_delay: R/B delay value in us
617 * @options: Option flags, e.g. 16bit buswidth 607 * @options: Option flags, e.g. 16bit buswidth
608 * @bbt_options: BBT option flags, e.g. NAND_BBT_USE_FLASH
618 * @ecclayout: ecc layout info structure 609 * @ecclayout: ecc layout info structure
619 * @part_probe_types: NULL-terminated array of probe types 610 * @part_probe_types: NULL-terminated array of probe types
620 * @set_parts: platform specific function to set partitions 611 * @set_parts: platform specific function to set partitions
@@ -628,6 +619,7 @@ struct platform_nand_chip {
628 struct nand_ecclayout *ecclayout; 619 struct nand_ecclayout *ecclayout;
629 int chip_delay; 620 int chip_delay;
630 unsigned int options; 621 unsigned int options;
622 unsigned int bbt_options;
631 const char **part_probe_types; 623 const char **part_probe_types;
632 void (*set_parts)(uint64_t size, struct platform_nand_chip *chip); 624 void (*set_parts)(uint64_t size, struct platform_nand_chip *chip);
633 void *priv; 625 void *priv;