提交 a40f7341 编写于 作者: B Brian Norris 提交者: Artem Bityutskiy

mtd: nand: consolidate redundant flash-based BBT flags

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: NBrian Norris <computersforpeace@gmail.com>
Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
上级 5fb1549d
...@@ -572,7 +572,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip) ...@@ -572,7 +572,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip)
</para> </para>
<para> <para>
The simplest way to activate the FLASH based bad block table support 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 the nand chip structure before calling nand_scan(). For AG-AND
chips is this done by default. chips is this done by default.
This activates the default FLASH based bad block table functionality This activates the default FLASH based bad block table functionality
...@@ -1158,9 +1158,6 @@ in this page</entry> ...@@ -1158,9 +1158,6 @@ in this page</entry>
These constants are defined in nand.h. They are ored together to describe These constants are defined in nand.h. They are ored together to describe
the functionality. the functionality.
<programlisting> <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 /* 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 * 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 */ * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */
......
...@@ -377,7 +377,7 @@ static struct davinci_nand_pdata da830_evm_nand_pdata = { ...@@ -377,7 +377,7 @@ static struct davinci_nand_pdata da830_evm_nand_pdata = {
.nr_parts = ARRAY_SIZE(da830_evm_nand_partitions), .nr_parts = ARRAY_SIZE(da830_evm_nand_partitions),
.ecc_mode = NAND_ECC_HW, .ecc_mode = NAND_ECC_HW,
.ecc_bits = 4, .ecc_bits = 4,
.options = NAND_USE_FLASH_BBT, .bbt_options = NAND_USE_FLASH_BBT,
.bbt_td = &da830_evm_nand_bbt_main_descr, .bbt_td = &da830_evm_nand_bbt_main_descr,
.bbt_md = &da830_evm_nand_bbt_mirror_descr, .bbt_md = &da830_evm_nand_bbt_mirror_descr,
.timing = &da830_evm_nandflash_timing, .timing = &da830_evm_nandflash_timing,
......
...@@ -225,7 +225,7 @@ static struct davinci_nand_pdata da850_evm_nandflash_data = { ...@@ -225,7 +225,7 @@ static struct davinci_nand_pdata da850_evm_nandflash_data = {
.nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition), .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition),
.ecc_mode = NAND_ECC_HW, .ecc_mode = NAND_ECC_HW,
.ecc_bits = 4, .ecc_bits = 4,
.options = NAND_USE_FLASH_BBT, .bbt_options = NAND_USE_FLASH_BBT,
.timing = &da850_evm_nandflash_timing, .timing = &da850_evm_nandflash_timing,
}; };
......
...@@ -77,7 +77,7 @@ static struct davinci_nand_pdata davinci_nand_data = { ...@@ -77,7 +77,7 @@ static struct davinci_nand_pdata davinci_nand_data = {
.parts = davinci_nand_partitions, .parts = davinci_nand_partitions,
.nr_parts = ARRAY_SIZE(davinci_nand_partitions), .nr_parts = ARRAY_SIZE(davinci_nand_partitions),
.ecc_mode = NAND_ECC_HW, .ecc_mode = NAND_ECC_HW,
.options = NAND_USE_FLASH_BBT, .bbt_options = NAND_USE_FLASH_BBT,
.ecc_bits = 4, .ecc_bits = 4,
}; };
......
...@@ -74,7 +74,7 @@ static struct davinci_nand_pdata davinci_nand_data = { ...@@ -74,7 +74,7 @@ static struct davinci_nand_pdata davinci_nand_data = {
.parts = davinci_nand_partitions, .parts = davinci_nand_partitions,
.nr_parts = ARRAY_SIZE(davinci_nand_partitions), .nr_parts = ARRAY_SIZE(davinci_nand_partitions),
.ecc_mode = NAND_ECC_HW_SYNDROME, .ecc_mode = NAND_ECC_HW_SYNDROME,
.options = NAND_USE_FLASH_BBT, .bbt_options = NAND_USE_FLASH_BBT,
}; };
static struct resource davinci_nand_resources[] = { static struct resource davinci_nand_resources[] = {
......
...@@ -139,7 +139,7 @@ static struct davinci_nand_pdata davinci_nand_data = { ...@@ -139,7 +139,7 @@ static struct davinci_nand_pdata davinci_nand_data = {
.parts = davinci_nand_partitions, .parts = davinci_nand_partitions,
.nr_parts = ARRAY_SIZE(davinci_nand_partitions), .nr_parts = ARRAY_SIZE(davinci_nand_partitions),
.ecc_mode = NAND_ECC_HW, .ecc_mode = NAND_ECC_HW,
.options = NAND_USE_FLASH_BBT, .bbt_options = NAND_USE_FLASH_BBT,
.ecc_bits = 4, .ecc_bits = 4,
}; };
......
...@@ -150,7 +150,7 @@ static struct davinci_nand_pdata davinci_evm_nandflash_data = { ...@@ -150,7 +150,7 @@ static struct davinci_nand_pdata davinci_evm_nandflash_data = {
.parts = davinci_evm_nandflash_partition, .parts = davinci_evm_nandflash_partition,
.nr_parts = ARRAY_SIZE(davinci_evm_nandflash_partition), .nr_parts = ARRAY_SIZE(davinci_evm_nandflash_partition),
.ecc_mode = NAND_ECC_HW, .ecc_mode = NAND_ECC_HW,
.options = NAND_USE_FLASH_BBT, .bbt_options = NAND_USE_FLASH_BBT,
.timing = &davinci_evm_nandflash_timing, .timing = &davinci_evm_nandflash_timing,
}; };
......
...@@ -396,7 +396,8 @@ static struct davinci_nand_pdata mityomapl138_nandflash_data = { ...@@ -396,7 +396,8 @@ static struct davinci_nand_pdata mityomapl138_nandflash_data = {
.parts = mityomapl138_nandflash_partition, .parts = mityomapl138_nandflash_partition,
.nr_parts = ARRAY_SIZE(mityomapl138_nandflash_partition), .nr_parts = ARRAY_SIZE(mityomapl138_nandflash_partition),
.ecc_mode = NAND_ECC_HW, .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 */ .ecc_bits = 1, /* 4 bit mode is not supported with 16 bit NAND */
}; };
......
...@@ -87,7 +87,7 @@ static struct davinci_nand_pdata davinci_ntosd2_nandflash_data = { ...@@ -87,7 +87,7 @@ static struct davinci_nand_pdata davinci_ntosd2_nandflash_data = {
.parts = davinci_ntosd2_nandflash_partition, .parts = davinci_ntosd2_nandflash_partition,
.nr_parts = ARRAY_SIZE(davinci_ntosd2_nandflash_partition), .nr_parts = ARRAY_SIZE(davinci_ntosd2_nandflash_partition),
.ecc_mode = NAND_ECC_HW, .ecc_mode = NAND_ECC_HW,
.options = NAND_USE_FLASH_BBT, .bbt_options = NAND_USE_FLASH_BBT,
}; };
static struct resource davinci_ntosd2_nandflash_resource[] = { static struct resource davinci_ntosd2_nandflash_resource[] = {
......
...@@ -144,7 +144,7 @@ static struct davinci_nand_pdata nand_config = { ...@@ -144,7 +144,7 @@ static struct davinci_nand_pdata nand_config = {
.parts = nand_partitions, .parts = nand_partitions,
.nr_parts = ARRAY_SIZE(nand_partitions), .nr_parts = ARRAY_SIZE(nand_partitions),
.ecc_mode = NAND_ECC_HW, .ecc_mode = NAND_ECC_HW,
.options = NAND_USE_FLASH_BBT, .bbt_options = NAND_USE_FLASH_BBT,
.ecc_bits = 1, .ecc_bits = 1,
}; };
......
...@@ -74,8 +74,10 @@ struct davinci_nand_pdata { /* platform_data */ ...@@ -74,8 +74,10 @@ struct davinci_nand_pdata { /* platform_data */
nand_ecc_modes_t ecc_mode; nand_ecc_modes_t ecc_mode;
u8 ecc_bits; u8 ecc_bits;
/* e.g. NAND_BUSWIDTH_16 or NAND_USE_FLASH_BBT */ /* e.g. NAND_BUSWIDTH_16 */
unsigned options; unsigned options;
/* e.g. NAND_USE_FLASH_BBT */
unsigned bbt_options;
/* Main and mirror bbt descriptor overrides */ /* Main and mirror bbt descriptor overrides */
struct nand_bbt_descr *bbt_td; struct nand_bbt_descr *bbt_td;
......
...@@ -275,7 +275,7 @@ static struct platform_nand_data ts78xx_ts_nand_data = { ...@@ -275,7 +275,7 @@ static struct platform_nand_data ts78xx_ts_nand_data = {
.partitions = ts78xx_ts_nand_parts, .partitions = ts78xx_ts_nand_parts,
.nr_partitions = ARRAY_SIZE(ts78xx_ts_nand_parts), .nr_partitions = ARRAY_SIZE(ts78xx_ts_nand_parts),
.chip_delay = 15, .chip_delay = 15,
.options = NAND_USE_FLASH_BBT, .bbt_options = NAND_USE_FLASH_BBT,
}, },
.ctrl = { .ctrl = {
/* /*
......
...@@ -163,7 +163,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void) ...@@ -163,7 +163,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
this->ecc.mode = NAND_ECC_SOFT; this->ecc.mode = NAND_ECC_SOFT;
/* Enable the following for a flash based bad block table */ /* 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 */ /* Scan to find existence of the device */
if (nand_scan(crisv32_mtd, 1)) { if (nand_scan(crisv32_mtd, 1)) {
......
...@@ -154,7 +154,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void) ...@@ -154,7 +154,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
this->ecc.mode = NAND_ECC_SOFT; this->ecc.mode = NAND_ECC_SOFT;
/* Enable the following for a flash based bad block table */ /* 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 */ /* Scan to find existence of the device */
if (nand_scan(crisv32_mtd, 1)) { if (nand_scan(crisv32_mtd, 1)) {
......
...@@ -583,7 +583,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev) ...@@ -583,7 +583,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
if (on_flash_bbt) { if (on_flash_bbt) {
printk(KERN_INFO "atmel_nand: Use On Flash BBT\n"); 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()) if (!cpu_has_dma())
......
...@@ -172,9 +172,9 @@ static int __init autcpu12_init(void) ...@@ -172,9 +172,9 @@ static int __init autcpu12_init(void)
/* Enable the following for a flash based bad block table */ /* 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 */ /* Scan to find existence of the device */
if (nand_scan(autcpu12_mtd, 1)) { if (nand_scan(autcpu12_mtd, 1)) {
......
...@@ -474,7 +474,7 @@ static int __devinit bcm_umi_nand_probe(struct platform_device *pdev) ...@@ -474,7 +474,7 @@ static int __devinit bcm_umi_nand_probe(struct platform_device *pdev)
#if NAND_ECC_BCH #if NAND_ECC_BCH
if (board_mtd->writesize > 512) { 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; largepage_bbt.options = NAND_BBT_SCAN2NDPAGE;
this->badblock_pattern = &largepage_bbt; this->badblock_pattern = &largepage_bbt;
} }
......
...@@ -686,7 +686,8 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev, ...@@ -686,7 +686,8 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev,
cafe->nand.chip_delay = 0; cafe->nand.chip_delay = 0;
/* Enable the following for a flash based bad block table */ /* 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) { if (skipbbt) {
cafe->nand.options |= NAND_SKIP_BBTSCAN; cafe->nand.options |= NAND_SKIP_BBTSCAN;
......
...@@ -239,7 +239,8 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr) ...@@ -239,7 +239,8 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
this->ecc.correct = nand_correct_data; this->ecc.correct = nand_correct_data;
/* Enable the following for a flash based bad block table */ /* 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 */ /* Scan to find existence of the device */
if (nand_scan(new_mtd, 1)) { if (nand_scan(new_mtd, 1)) {
......
...@@ -581,7 +581,9 @@ static int __init nand_davinci_probe(struct platform_device *pdev) ...@@ -581,7 +581,9 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
info->chip.chip_delay = 0; info->chip.chip_delay = 0;
info->chip.select_chip = nand_davinci_select_chip; 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.options = pdata->options;
info->chip.bbt_td = pdata->bbt_td; info->chip.bbt_td = pdata->bbt_td;
info->chip.bbt_md = pdata->bbt_md; info->chip.bbt_md = pdata->bbt_md;
......
...@@ -1577,7 +1577,8 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -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; denali->nand.bbt_md = &bbt_mirror_descr;
/* skip the scan for now until we have OOB read and write support */ /* 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->nand.ecc.mode = NAND_ECC_HW_SYNDROME;
/* Denali Controller only support 15bit and 8bit ECC in MRST, /* Denali Controller only support 15bit and 8bit ECC in MRST,
......
...@@ -1652,7 +1652,7 @@ static int __init doc_probe(unsigned long physadr) ...@@ -1652,7 +1652,7 @@ static int __init doc_probe(unsigned long physadr)
nand->ecc.mode = NAND_ECC_HW_SYNDROME; nand->ecc.mode = NAND_ECC_HW_SYNDROME;
nand->ecc.size = 512; nand->ecc.size = 512;
nand->ecc.bytes = 6; nand->ecc.bytes = 6;
nand->options = NAND_USE_FLASH_BBT; nand->bbt_options = NAND_USE_FLASH_BBT;
doc->physadr = physadr; doc->physadr = physadr;
doc->virtadr = virtadr; doc->virtadr = virtadr;
......
...@@ -791,8 +791,8 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv) ...@@ -791,8 +791,8 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
chip->bbt_md = &bbt_mirror_descr; chip->bbt_md = &bbt_mirror_descr;
/* set up nand options */ /* set up nand options */
chip->options = NAND_NO_READRDY | NAND_NO_AUTOINCR | chip->options = NAND_NO_READRDY | NAND_NO_AUTOINCR;
NAND_USE_FLASH_BBT; chip->bbt_options = NAND_USE_FLASH_BBT;
chip->controller = &elbc_fcm_ctrl->controller; chip->controller = &elbc_fcm_ctrl->controller;
chip->priv = priv; chip->priv = priv;
......
...@@ -735,7 +735,8 @@ static int __devinit mpc5121_nfc_probe(struct platform_device *op) ...@@ -735,7 +735,8 @@ static int __devinit mpc5121_nfc_probe(struct platform_device *op)
chip->write_buf = mpc5121_nfc_write_buf; chip->write_buf = mpc5121_nfc_write_buf;
chip->verify_buf = mpc5121_nfc_verify_buf; chip->verify_buf = mpc5121_nfc_verify_buf;
chip->select_chip = mpc5121_nfc_select_chip; 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; chip->ecc.mode = NAND_ECC_SOFT;
/* Support external chip-select logic on ADS5121 board */ /* Support external chip-select logic on ADS5121 board */
......
...@@ -1179,7 +1179,7 @@ static int __init mxcnd_probe(struct platform_device *pdev) ...@@ -1179,7 +1179,7 @@ static int __init mxcnd_probe(struct platform_device *pdev)
this->bbt_td = &bbt_main_descr; this->bbt_td = &bbt_main_descr;
this->bbt_md = &bbt_mirror_descr; this->bbt_md = &bbt_mirror_descr;
/* update flash based bbt */ /* update flash based bbt */
this->options |= NAND_USE_FLASH_BBT; this->bbt_options |= NAND_USE_FLASH_BBT;
} }
init_completion(&host->op_completion); init_completion(&host->op_completion);
......
...@@ -405,7 +405,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs) ...@@ -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); chip->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1);
/* Do we have a flash based bad block table ? */ /* 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); ret = nand_update_bbt(mtd, ofs);
else { else {
nand_get_device(chip, mtd, FL_WRITING); nand_get_device(chip, mtd, FL_WRITING);
......
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
* The table is marked in the OOB area with an ident pattern and a version * 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 * 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 * 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 * option NAND_BBT_NO_OOB should be used (along with NAND_USE_FLASH_BBT, of
* and the version byte into the data area and the OOB area will remain * course): it moves the ident pattern and the version byte into the data area
* untouched. * and the OOB area will remain untouched.
* *
* The table uses 2 bits per block * The table uses 2 bits per block
* 11b: block is good * 11b: block is good
...@@ -1082,16 +1082,16 @@ static void verify_bbt_descr(struct mtd_info *mtd, struct nand_bbt_descr *bd) ...@@ -1082,16 +1082,16 @@ static void verify_bbt_descr(struct mtd_info *mtd, struct nand_bbt_descr *bd)
pattern_len = bd->len; pattern_len = bd->len;
bits = bd->options & NAND_BBT_NRBITS_MSK; bits = bd->options & NAND_BBT_NRBITS_MSK;
BUG_ON((this->options & NAND_USE_FLASH_BBT_NO_OOB) && BUG_ON((this->bbt_options & NAND_BBT_NO_OOB) &&
!(this->options & NAND_USE_FLASH_BBT)); !(this->bbt_options & NAND_USE_FLASH_BBT));
BUG_ON(!bits); BUG_ON(!bits);
if (bd->options & NAND_BBT_VERSION) if (bd->options & NAND_BBT_VERSION)
pattern_len++; pattern_len++;
if (bd->options & NAND_BBT_NO_OOB) { if (bd->options & NAND_BBT_NO_OOB) {
BUG_ON(!(this->options & NAND_USE_FLASH_BBT)); BUG_ON(!(this->bbt_options & NAND_USE_FLASH_BBT));
BUG_ON(!(this->options & NAND_USE_FLASH_BBT_NO_OOB)); BUG_ON(!(this->bbt_options & NAND_BBT_NO_OOB));
BUG_ON(bd->offs); BUG_ON(bd->offs);
if (bd->options & NAND_BBT_VERSION) if (bd->options & NAND_BBT_VERSION)
BUG_ON(bd->veroffs != bd->len); BUG_ON(bd->veroffs != bd->len);
...@@ -1357,15 +1357,15 @@ int nand_default_bbt(struct mtd_info *mtd) ...@@ -1357,15 +1357,15 @@ int nand_default_bbt(struct mtd_info *mtd)
this->bbt_td = &bbt_main_descr; this->bbt_td = &bbt_main_descr;
this->bbt_md = &bbt_mirror_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); return nand_scan_bbt(mtd, &agand_flashbased);
} }
/* Is a flash based bad block table requested ? */ /* 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 */ /* Use the default pattern descriptors */
if (!this->bbt_td) { 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_td = &bbt_main_no_bbt_descr;
this->bbt_md = &bbt_mirror_no_bbt_descr; this->bbt_md = &bbt_mirror_no_bbt_descr;
} else { } else {
......
...@@ -2273,9 +2273,9 @@ static int __init ns_init_module(void) ...@@ -2273,9 +2273,9 @@ static int __init ns_init_module(void)
switch (bbt) { switch (bbt) {
case 2: case 2:
chip->options |= NAND_USE_FLASH_BBT_NO_OOB; chip->bbt_options |= NAND_BBT_NO_OOB;
case 1: case 1:
chip->options |= NAND_USE_FLASH_BBT; chip->bbt_options |= NAND_USE_FLASH_BBT;
case 0: case 0:
break; break;
default: default:
......
...@@ -155,7 +155,8 @@ static int __devinit pasemi_nand_probe(struct platform_device *ofdev) ...@@ -155,7 +155,8 @@ static int __devinit pasemi_nand_probe(struct platform_device *ofdev)
chip->ecc.mode = NAND_ECC_SOFT; chip->ecc.mode = NAND_ECC_SOFT;
/* Enable the following for a flash based bad block table */ /* 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 */ /* Scan to find existence of the device */
if (nand_scan(pasemi_nand_mtd, 1)) { if (nand_scan(pasemi_nand_mtd, 1)) {
......
...@@ -79,6 +79,7 @@ static int __devinit plat_nand_probe(struct platform_device *pdev) ...@@ -79,6 +79,7 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
data->chip.read_buf = pdata->ctrl.read_buf; data->chip.read_buf = pdata->ctrl.read_buf;
data->chip.chip_delay = pdata->chip.chip_delay; data->chip.chip_delay = pdata->chip.chip_delay;
data->chip.options |= pdata->chip.options; data->chip.options |= pdata->chip.options;
data->chip.bbt_options |= pdata->chip.bbt_options;
data->chip.ecc.hwctl = pdata->ctrl.hwcontrol; data->chip.ecc.hwctl = pdata->ctrl.hwcontrol;
data->chip.ecc.layout = pdata->chip.ecclayout; data->chip.ecc.layout = pdata->chip.ecclayout;
......
...@@ -880,8 +880,10 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info, ...@@ -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 /* 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 * 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... */ * full NAND scan that can take 1/2s or so. Little things... */
if (set->flash_bbt) if (set->flash_bbt) {
chip->options |= NAND_USE_FLASH_BBT | NAND_SKIP_BBTSCAN; chip->bbt_options |= NAND_USE_FLASH_BBT;
chip->options |= NAND_SKIP_BBTSCAN;
}
} }
/** /**
......
...@@ -100,8 +100,13 @@ struct nand_bbt_descr { ...@@ -100,8 +100,13 @@ struct nand_bbt_descr {
#define NAND_BBT_SCANLASTPAGE 0x00008000 #define NAND_BBT_SCANLASTPAGE 0x00008000
/* The nand_bbt_descr was created dynamicaly and must be freed */ /* The nand_bbt_descr was created dynamicaly and must be freed */
#define NAND_BBT_DYNAMICSTRUCT 0x00200000 #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 */ /* The maximum number of blocks to scan for a bbt */
#define NAND_BBT_SCAN_MAXBLOCKS 4 #define NAND_BBT_SCAN_MAXBLOCKS 4
......
...@@ -219,11 +219,6 @@ typedef enum { ...@@ -219,11 +219,6 @@ typedef enum {
#define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) #define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR)
/* Non chip related options */ /* 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. */ /* This option skips the bbt scan during initialization. */
#define NAND_SKIP_BBTSCAN 0x00020000 #define NAND_SKIP_BBTSCAN 0x00020000
/* /*
...@@ -233,11 +228,6 @@ typedef enum { ...@@ -233,11 +228,6 @@ typedef enum {
#define NAND_OWN_BUFFERS 0x00040000 #define NAND_OWN_BUFFERS 0x00040000
/* Chip may not exist, so silence any errors in scan */ /* Chip may not exist, so silence any errors in scan */
#define NAND_SCAN_SILENT_NODEV 0x00080000 #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 */ /* Create an empty BBT with no vendor information if the BBT is available */
#define NAND_CREATE_EMPTY_BBT 0x01000000 #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, ...@@ -615,6 +605,7 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
* @partitions: mtd partition list * @partitions: mtd partition list
* @chip_delay: R/B delay value in us * @chip_delay: R/B delay value in us
* @options: Option flags, e.g. 16bit buswidth * @options: Option flags, e.g. 16bit buswidth
* @bbt_options: BBT option flags, e.g. NAND_BBT_USE_FLASH
* @ecclayout: ecc layout info structure * @ecclayout: ecc layout info structure
* @part_probe_types: NULL-terminated array of probe types * @part_probe_types: NULL-terminated array of probe types
* @set_parts: platform specific function to set partitions * @set_parts: platform specific function to set partitions
...@@ -628,6 +619,7 @@ struct platform_nand_chip { ...@@ -628,6 +619,7 @@ struct platform_nand_chip {
struct nand_ecclayout *ecclayout; struct nand_ecclayout *ecclayout;
int chip_delay; int chip_delay;
unsigned int options; unsigned int options;
unsigned int bbt_options;
const char **part_probe_types; const char **part_probe_types;
void (*set_parts)(uint64_t size, struct platform_nand_chip *chip); void (*set_parts)(uint64_t size, struct platform_nand_chip *chip);
void *priv; void *priv;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册