clean-up NAND / BBT code, flags
Subsystems (12)
cover clean-up NAND / BBT code, flags
Hello,
This patch series handles several issues with NAND chip flags and BBT flags, especially those related to the nand_chip.options and nand_bbt_descr.options fields. This topic was discussed and reviewed a bit on the linux-mtd thread found here:
http://lists.infradead.org/pipermail/linux-mtd/2011-April/035146.html
These changes have affected many drivers in relatively small ways, so I copied all the maintainers/contributors given by the scripts/getmaintainer.pl scripts. FYI, this patch set is based on the mtd-2.6.git repository from linux-mtd.
Also, the first patch:
mtd: nand: remove NAND_BBT_SCANBYTE1AND6 option
solves the regression issues discussed here:
http://lists.infradead.org/pipermail/linux-mtd/2011-May/035696.html
Thanks for the review.
Brian
Brian Norris (8):
mtd: nand: remove NAND_BBT_SCANBYTE1AND6 option
mtd: nand: separate chip options / bbt_options
mtd: nand: consolidate redundant flash-based BBT flags
mtd: nand: rename NAND_USE_FLASH_BBT
mtd: nand: move NAND_CREATE_EMPTY_BBT flag
mtd: nand: rename CREATE_EMPTY bbt flag with proper prefix
mtd: nand: renumber the reorganized flags in nand.h / bbm.h
mtd: nand: improve comment on NAND_BBT_DYNAMIC_STRUCT
Documentation/DocBook/mtdnand.tmpl | 5 +-- arch/arm/mach-davinci/board-da830-evm.c | 2 +- arch/arm/mach-davinci/board-da850-evm.c | 2 +- arch/arm/mach-davinci/board-dm355-evm.c | 2 +- arch/arm/mach-davinci/board-dm355-leopard.c | 2 +- arch/arm/mach-davinci/board-dm365-evm.c | 2 +- arch/arm/mach-davinci/board-dm644x-evm.c | 2 +- arch/arm/mach-davinci/board-mityomapl138.c | 3 +- arch/arm/mach-davinci/board-neuros-osd2.c | 2 +- arch/arm/mach-davinci/board-tnetv107x-evm.c | 2 +- arch/arm/mach-davinci/include/mach/nand.h | 4 +- arch/arm/mach-orion5x/ts78xx-setup.c | 2 +- arch/cris/arch-v32/drivers/mach-a3/nandflash.c | 2 +- arch/cris/arch-v32/drivers/mach-fs/nandflash.c | 2 +- drivers/mtd/nand/atmel_nand.c | 2 +- drivers/mtd/nand/autcpu12.c | 4 +- drivers/mtd/nand/bcm_umi_nand.c | 2 +- drivers/mtd/nand/cafe_nand.c | 3 +- drivers/mtd/nand/cs553x_nand.c | 3 +- drivers/mtd/nand/davinci_nand.c | 4 +- drivers/mtd/nand/denali.c | 3 +- drivers/mtd/nand/diskonchip.c | 2 +- drivers/mtd/nand/fsl_elbc_nand.c | 4 +- drivers/mtd/nand/mpc5121_nfc.c | 3 +- drivers/mtd/nand/mxc_nand.c | 2 +- drivers/mtd/nand/nand_base.c | 41 ++++------------ drivers/mtd/nand/nand_bbt.c | 59 ++++++------------------ drivers/mtd/nand/nandsim.c | 4 +- drivers/mtd/nand/pasemi_nand.c | 3 +- drivers/mtd/nand/s3c2410.c | 6 ++- include/linux/mtd/bbm.h | 39 +++++++++++----- include/linux/mtd/nand.h | 22 +++------ 32 files changed, 103 insertions(+), 137 deletions(-)
PATCH 1/8 mtd: nand: remove NAND_BBT_SCANBYTE1AND6 option
This patch reverts most of:
commit 58373ff0afff4cc8ac40608872995f4d87eb72ec
mtd: nand: more BB Detection refactoring and dynamic scan options
According to the discussion at:
http://lists.infradead.org/pipermail/linux-mtd/2011-May/035696.html
the NAND_BBT_SCANBYTE1AND6 flag, although technically valid, can break some existing ECC layouts that use the 6th byte in the OOB for ECC data. Furthermore, we apparently do not need to scan both bytes 1 and 6 in the OOB region of the devices under consideration; instead, we only need to scan one or the other.
Thus, the NAND_BBT_SCANBYTE1AND6 flag is at best unnecessary and at worst a regression.
--- drivers/mtd/nand/nand_base.c | 29 +++++------------------------ drivers/mtd/nand/nand_bbt.c | 32 +------------------------------- include/linux/mtd/bbm.h | 2 -- 3 files changed, 6 insertions(+), 57 deletions(-)
drivers/mtd/nand/nand_base.c +5 -24
@@ -410,10 +410,11 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)else {nand_get_device (chip, mtd,FL_WRITING ); -/* Write to first two pages and to byte 1 and 6 if necessary. -* If we write to more than one location, the first error -* encountered quits the procedure. We write two bytes per -* location, so we dont have to mess with 16 bit access. +/* +* Write to first two pages if necessary. If we write to more +* than one location, the first error encountered quits the +* procedure. We write two bytes per location, so we dont have +* to mess with 16 bit access. */ do { chip->ops.len = chip->ops.ooblen = 2;
@@ -423,11 +424,6 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs) ret =nand_do_write_oob (mtd, ofs, &chip->ops); -if (!ret && (chip->options &NAND_BBT_SCANBYTE1AND6 )) { - chip->ops.ooboffs =NAND_SMALL_BADBLOCK_POS - & ~0x01 ; - ret =nand_do_write_oob (mtd, ofs, &chip->ops); - } i++; ofs += mtd->writesize; } while (!ret && (chip->options & NAND_BBT_SCAN2NDPAGE) &&
@@ -3131,16 +3127,6 @@ ident_done: *maf_id == NAND_MFR_MICRON)) chip->options |=NAND_BBT_SCAN2NDPAGE ; -/* -* Numonyx/ST 2K pages, x8 bus use BOTH byte 1 and 6 -*/ -if (!(busw &NAND_BUSWIDTH_16 ) && - *maf_id ==NAND_MFR_STMICRO && - mtd->writesize ==2048 ) { - chip->options |=NAND_BBT_SCANBYTE1AND6 ; - chip->badblockpos =0 ; - } -/* Check for AND chips with 4 page planes */ if (chip->options &NAND_4PAGE_ARRAY ) chip->erase_cmd = multi_erase_cmd;
@@ -3538,11 +3524,6 @@ void nand_release(struct mtd_info *mtd)kfree (chip->bbt);if (!(chip->options &NAND_OWN_BUFFERS ))kfree (chip->buffers); - -/* Free bad block descriptor memory */ -if (chip->badblock_pattern && chip->badblock_pattern->options - &NAND_BBT_DYNAMICSTRUCT ) -kfree (chip->badblock_pattern); }EXPORT_SYMBOL_GPL (nand_release);
drivers/mtd/nand/nand_bbt.c +1 -31
@@ -114,28 +114,6 @@ static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_descreturn -1 ; } -/* Check both positions 1 and 6 for pattern? */ -if (td->options &NAND_BBT_SCANBYTE1AND6 ) { -if (td->options &NAND_BBT_SCANEMPTY ) { - p += td->len; - end +=NAND_SMALL_BADBLOCK_POS - td->offs; -/* Check region between positions 1 and 6 */ -for (i =0 ; i <NAND_SMALL_BADBLOCK_POS - td->offs - td->len; - i++) { -if (*p++ !=0xff ) -return -1 ; - } - } -else { - p +=NAND_SMALL_BADBLOCK_POS - td->offs; - } -/* Compare the pattern */ -for (i =0 ; i < td->len; i++) { -if (p[i] != td->pattern[i]) -return -1 ; - } - } -if (td->options &NAND_BBT_SCANEMPTY ) { p += td->len; end += td->len;
@@ -167,13 +145,6 @@ static int check_short_pattern(uint8_t *buf, struct nand_bbt_descr *td)if (p[td->offs + i] != td->pattern[i])return -1 ; } -/* Need to check location 1 AND 6? */ -if (td->options &NAND_BBT_SCANBYTE1AND6 ) { -for (i =0 ; i < td->len; i++) { -if (p[NAND_SMALL_BADBLOCK_POS + i] != td->pattern[i]) -return -1 ; - } - }return 0 ; }
@@ -1330,8 +1301,7 @@ static struct nand_bbt_descr bbt_mirror_no_bbt_descr = { .pattern = mirror_pattern }; -#define BBT_SCAN_OPTIONS (NAND_BBT_SCANLASTPAGE | NAND_BBT_SCAN2NDPAGE | \ - NAND_BBT_SCANBYTE1AND6) +#define BBT_SCAN_OPTIONS (NAND_BBT_SCANLASTPAGE | NAND_BBT_SCAN2NDPAGE)/** * nand_create_default_bbt_descr - [Internal] Creates a BBT descriptor structure * @this: NAND chip to create descriptor for
include/linux/mtd/bbm.h +0 -2
@@ -98,8 +98,6 @@ struct nand_bbt_descr {#define NAND_BBT_SCAN2NDPAGE 0x00004000/* Search good / bad pattern on the last page of the eraseblock */ #define NAND_BBT_SCANLASTPAGE 0x00008000 -/* Chip stores bad block marker on BOTH 1st and 6th bytes of OOB */ -#define NAND_BBT_SCANBYTE1AND6 0x00100000/* 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 */
Signature · 1 line
1.7.0.4
PATCH 2/8 mtd: nand: separate chip options / bbt_options
In reply to Brian NorrisThis patch handles the problems we've been having with using conflicting flags from nand.h and bbm.h in the same nand_chip.options field. We should try to separate these two spaces a little more clearly, and so I have added a bbt_options field to nand_chip.
Important notes about nand_chip fields:
* bbt_options field should contain ONLY flags from bbm.h. They should be able to pass safely to a nand_bbt_descr data structure.
- BBT option flags start with the "NAND_BBT_" prefix.
* options field should contian ONLY flags from nand.h. Ideally, they should not be involved in any BBT related options.
- NAND chip option flags start with the "NAND_" prefix.
* Every flag should have a nice comment explaining what the flag is. While this is not yet the case on all existing flags, please be sure to write one for new flags. Even better, you can help document the code better yourself!
Please try to follow these conventions to make everyone's lives easier.
Among the flags that are being moved to the new bbt_options field throughout various drivers, etc. are:
* NAND_BBT_SCANLASTPAGE
* NAND_BBT_SCAN2NDPAGE
and there will be more to come.
--- drivers/mtd/nand/nand_base.c | 10 +++++----- drivers/mtd/nand/nand_bbt.c | 5 ++--- include/linux/mtd/nand.h | 4 ++++ 3 files changed, 11 insertions(+), 8 deletions(-)
drivers/mtd/nand/nand_base.c +5 -5
@@ -344,7 +344,7 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)struct nand_chip *chip = mtd->priv;u16 bad; -if (chip->options &NAND_BBT_SCANLASTPAGE ) +if (chip->bbt_options &NAND_BBT_SCANLASTPAGE ) ofs += mtd->erasesize - mtd->writesize; page = (int )(ofs >> chip->page_shift) & chip->pagemask;
@@ -396,7 +396,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)uint8_t buf[2 ] = {0 ,0 };int block, ret, i =0 ; -if (chip->options &NAND_BBT_SCANLASTPAGE ) +if (chip->bbt_options &NAND_BBT_SCANLASTPAGE ) ofs += mtd->erasesize - mtd->writesize;/* Get block number */
@@ -426,7 +426,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs) i++; ofs += mtd->writesize; - }while (!ret && (chip->options &NAND_BBT_SCAN2NDPAGE ) && + }while (!ret && (chip->bbt_options &NAND_BBT_SCAN2NDPAGE ) && i <2 );nand_release_device (mtd);
@@ -3117,7 +3117,7 @@ ident_done:if ((chip->cellinfo &NAND_CI_CELLTYPE_MSK ) && (*maf_id ==NAND_MFR_SAMSUNG || *maf_id ==NAND_MFR_HYNIX )) - chip->options |=NAND_BBT_SCANLASTPAGE ; + chip->bbt_options |=NAND_BBT_SCANLASTPAGE ; else if ((!(chip->cellinfo & NAND_CI_CELLTYPE_MSK) && (*maf_id == NAND_MFR_SAMSUNG || *maf_id == NAND_MFR_HYNIX ||
@@ -3125,7 +3125,7 @@ ident_done: *maf_id == NAND_MFR_AMD)) || (mtd->writesize ==2048 && *maf_id == NAND_MFR_MICRON)) - chip->options |= NAND_BBT_SCAN2NDPAGE; + chip->bbt_options |= NAND_BBT_SCAN2NDPAGE;/* Check for AND chips with 4 page planes */ if (chip->options &NAND_4PAGE_ARRAY )
drivers/mtd/nand/nand_bbt.c +2 -3
@@ -517,7 +517,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, from = (loff_t )startblock << (this->bbt_erase_shift -1 ); } -if (this->options &NAND_BBT_SCANLASTPAGE ) +if (this->bbt_options &NAND_BBT_SCANLASTPAGE ) from += mtd->erasesize - (mtd->writesize * len);for (i = startblock; i < numblocks;) {
@@ -1301,7 +1301,6 @@ static struct nand_bbt_descr bbt_mirror_no_bbt_descr = { .pattern = mirror_pattern }; -#define BBT_SCAN_OPTIONS (NAND_BBT_SCANLASTPAGE | NAND_BBT_SCAN2NDPAGE)/** * nand_create_default_bbt_descr - [Internal] Creates a BBT descriptor structure * @this: NAND chip to create descriptor for
@@ -1324,7 +1323,7 @@ static int nand_create_default_bbt_descr(struct nand_chip *this)printk (KERN_ERR "nand_create_default_bbt_descr: Out of memory\n" );return -ENOMEM ; } - bd->options = this->options &BBT_SCAN_OPTIONS ; + bd->options = this->bbt_options; bd->offs = this->badblockpos; bd->len = (this->options &NAND_BUSWIDTH_16 ) ?2 :1 ; bd->pattern = scan_ff_pattern;
include/linux/mtd/nand.h +4 -0
@@ -449,6 +449,9 @@ struct nand_buffers {* @options: [BOARDSPECIFIC] various chip options. They can partly * be set to inform nand_scan about special functionality. * See the defines for further explanation. +* @bbt_options: [INTERN] bad block specific options. All options used +* here must come from bbm.h. By default, these options +* will be copied to the appropriate nand_bbt_descr's. * @badblockpos: [INTERN] position of the bad block marker in the oob * area. * @badblockbits: [INTERN] number of bits to left-shift the bad block
@@ -509,6 +512,7 @@ struct nand_chip {int chip_delay;unsigned int options; +unsigned int bbt_options;int page_shift;int phys_erase_shift;
Signature · 1 line
1.7.0.4
PATCH 3/8 mtd: nand: consolidate redundant flash-based BBT flags
In reply to Brian NorrisThis 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.
--- Documentation/DocBook/mtdnand.tmpl | 5 +---- arch/arm/mach-davinci/board-da830-evm.c | 2 +- arch/arm/mach-davinci/board-da850-evm.c | 2 +- arch/arm/mach-davinci/board-dm355-evm.c | 2 +- arch/arm/mach-davinci/board-dm355-leopard.c | 2 +- arch/arm/mach-davinci/board-dm365-evm.c | 2 +- arch/arm/mach-davinci/board-dm644x-evm.c | 2 +- arch/arm/mach-davinci/board-mityomapl138.c | 3 ++- arch/arm/mach-davinci/board-neuros-osd2.c | 2 +- arch/arm/mach-davinci/board-tnetv107x-evm.c | 2 +- arch/arm/mach-davinci/include/mach/nand.h | 4 +++- arch/arm/mach-orion5x/ts78xx-setup.c | 2 +- arch/cris/arch-v32/drivers/mach-a3/nandflash.c | 2 +- arch/cris/arch-v32/drivers/mach-fs/nandflash.c | 2 +- drivers/mtd/nand/atmel_nand.c | 2 +- drivers/mtd/nand/autcpu12.c | 4 ++-- drivers/mtd/nand/bcm_umi_nand.c | 2 +- drivers/mtd/nand/cafe_nand.c | 3 ++- drivers/mtd/nand/cs553x_nand.c | 3 ++- drivers/mtd/nand/davinci_nand.c | 4 +++- drivers/mtd/nand/denali.c | 3 ++- drivers/mtd/nand/diskonchip.c | 2 +- drivers/mtd/nand/fsl_elbc_nand.c | 4 ++-- drivers/mtd/nand/mpc5121_nfc.c | 3 ++- drivers/mtd/nand/mxc_nand.c | 2 +- drivers/mtd/nand/nand_base.c | 2 +- drivers/mtd/nand/nand_bbt.c | 20 ++++++++++---------- drivers/mtd/nand/nandsim.c | 4 ++-- drivers/mtd/nand/pasemi_nand.c | 3 ++- drivers/mtd/nand/s3c2410.c | 6 ++++-- include/linux/mtd/bbm.h | 9 +++++++-- include/linux/mtd/nand.h | 10 ---------- 32 files changed, 62 insertions(+), 58 deletions(-)
Documentation/DocBook/mtdnand.tmpl +1 -4
@@ -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 */
arch/arm/mach-davinci/board-da830-evm.c +1 -1
@@ -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,
arch/arm/mach-davinci/board-da850-evm.c +1 -1
@@ -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, };
arch/arm/mach-davinci/board-dm355-evm.c +1 -1
@@ -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, };
arch/arm/mach-davinci/board-dm355-leopard.c +1 -1
@@ -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[] = {
arch/arm/mach-davinci/board-dm365-evm.c +1 -1
@@ -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, };
arch/arm/mach-davinci/board-dm644x-evm.c +1 -1
@@ -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, };
arch/arm/mach-davinci/board-mityomapl138.c +2 -1
@@ -395,7 +395,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 */ };
arch/arm/mach-davinci/board-neuros-osd2.c +1 -1
@@ -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[] = {
arch/arm/mach-davinci/board-tnetv107x-evm.c +1 -1
@@ -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, };
arch/arm/mach-davinci/include/mach/nand.h +3 -1
@@ -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;
arch/arm/mach-orion5x/ts78xx-setup.c +1 -1
@@ -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 = {/*
arch/cris/arch-v32/drivers/mach-a3/nandflash.c +1 -1
@@ -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 )) {
arch/cris/arch-v32/drivers/mach-fs/nandflash.c +1 -1
@@ -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 )) {
drivers/mtd/nand/atmel_nand.c +1 -1
@@ -582,7 +582,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 ())
drivers/mtd/nand/autcpu12.c +2 -2
@@ -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 )) {
drivers/mtd/nand/bcm_umi_nand.c +1 -1
@@ -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; }
drivers/mtd/nand/cafe_nand.c +2 -1
@@ -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 ;
drivers/mtd/nand/cs553x_nand.c +2 -1
@@ -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 )) {
drivers/mtd/nand/davinci_nand.c +3 -1
@@ -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;
drivers/mtd/nand/denali.c +2 -1
@@ -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,
drivers/mtd/nand/diskonchip.c +1 -1
@@ -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;
drivers/mtd/nand/fsl_elbc_nand.c +2 -2
@@ -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;
drivers/mtd/nand/mpc5121_nfc.c +2 -1
@@ -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 */
drivers/mtd/nand/mxc_nand.c +1 -1
@@ -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);
drivers/mtd/nand/nand_base.c +1 -1
@@ -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 );
drivers/mtd/nand/nand_bbt.c +10 -10
@@ -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 {
drivers/mtd/nand/nandsim.c +2 -2
@@ -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 :
drivers/mtd/nand/pasemi_nand.c +2 -1
@@ -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 )) {
drivers/mtd/nand/s3c2410.c +4 -2
@@ -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 ; + } }/**
include/linux/mtd/bbm.h +7 -2
@@ -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
include/linux/mtd/nand.h +0 -10
@@ -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
Signature · 1 line
1.7.0.4
PATCH 4/8 mtd: nand: rename NAND_USE_FLASH_BBT
In reply to Brian NorrisRecall the recently added prefix requirements:
* "NAND_" for flags in nand.h, used in nand_chip.options
* "NAND_BBT_" for flags in bbm.h, used in nand_chip.bbt_options or in nand_bbt_descr.options
Thus, I am changing NAND_USE_FLASH_BBT to NAND_BBT_USE_FLASH.
Again, this flag is found in bbm.h and so should NOT be used in the "nand_chip.options" field.
--- Documentation/DocBook/mtdnand.tmpl | 2 +- arch/arm/mach-davinci/board-da830-evm.c | 2 +- arch/arm/mach-davinci/board-da850-evm.c | 2 +- arch/arm/mach-davinci/board-dm355-evm.c | 2 +- arch/arm/mach-davinci/board-dm355-leopard.c | 2 +- arch/arm/mach-davinci/board-dm365-evm.c | 2 +- arch/arm/mach-davinci/board-dm644x-evm.c | 2 +- arch/arm/mach-davinci/board-mityomapl138.c | 2 +- arch/arm/mach-davinci/board-neuros-osd2.c | 2 +- arch/arm/mach-davinci/board-tnetv107x-evm.c | 2 +- arch/arm/mach-davinci/include/mach/nand.h | 2 +- arch/arm/mach-orion5x/ts78xx-setup.c | 2 +- arch/cris/arch-v32/drivers/mach-a3/nandflash.c | 2 +- arch/cris/arch-v32/drivers/mach-fs/nandflash.c | 2 +- drivers/mtd/nand/atmel_nand.c | 2 +- drivers/mtd/nand/autcpu12.c | 4 ++-- drivers/mtd/nand/bcm_umi_nand.c | 2 +- drivers/mtd/nand/cafe_nand.c | 2 +- drivers/mtd/nand/cs553x_nand.c | 2 +- drivers/mtd/nand/davinci_nand.c | 2 +- drivers/mtd/nand/denali.c | 2 +- drivers/mtd/nand/diskonchip.c | 2 +- drivers/mtd/nand/fsl_elbc_nand.c | 2 +- drivers/mtd/nand/mpc5121_nfc.c | 2 +- drivers/mtd/nand/mxc_nand.c | 2 +- drivers/mtd/nand/nand_base.c | 2 +- drivers/mtd/nand/nand_bbt.c | 12 ++++++------ drivers/mtd/nand/nandsim.c | 2 +- drivers/mtd/nand/pasemi_nand.c | 2 +- drivers/mtd/nand/s3c2410.c | 2 +- include/linux/mtd/bbm.h | 2 +- 31 files changed, 37 insertions(+), 37 deletions(-)
Documentation/DocBook/mtdnand.tmpl +1 -1
@@ -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 bbt_option field of + is to set the option NAND_BBT_USE_FLASH 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
arch/arm/mach-davinci/board-da830-evm.c +1 -1
@@ -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, - .bbt_options = NAND_USE_FLASH_BBT, + .bbt_options = NAND_BBT_USE_FLASH, .bbt_td = &da830_evm_nand_bbt_main_descr, .bbt_md = &da830_evm_nand_bbt_mirror_descr, .timing = &da830_evm_nandflash_timing,
arch/arm/mach-davinci/board-da850-evm.c +1 -1
@@ -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, - .bbt_options = NAND_USE_FLASH_BBT, + .bbt_options = NAND_BBT_USE_FLASH, .timing = &da850_evm_nandflash_timing, };
arch/arm/mach-davinci/board-dm355-evm.c +1 -1
@@ -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, - .bbt_options = NAND_USE_FLASH_BBT, + .bbt_options = NAND_BBT_USE_FLASH, .ecc_bits = 4, };
arch/arm/mach-davinci/board-dm355-leopard.c +1 -1
@@ -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, - .bbt_options = NAND_USE_FLASH_BBT, + .bbt_options = NAND_BBT_USE_FLASH, };static struct resource davinci_nand_resources[] = {
arch/arm/mach-davinci/board-dm365-evm.c +1 -1
@@ -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, - .bbt_options = NAND_USE_FLASH_BBT, + .bbt_options = NAND_BBT_USE_FLASH, .ecc_bits = 4, };
arch/arm/mach-davinci/board-dm644x-evm.c +1 -1
@@ -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, - .bbt_options = NAND_USE_FLASH_BBT, + .bbt_options = NAND_BBT_USE_FLASH, .timing = &davinci_evm_nandflash_timing, };
arch/arm/mach-davinci/board-mityomapl138.c +1 -1
@@ -395,7 +395,7 @@ static struct davinci_nand_pdata mityomapl138_nandflash_data = { .parts = mityomapl138_nandflash_partition, .nr_parts = ARRAY_SIZE(mityomapl138_nandflash_partition), .ecc_mode = NAND_ECC_HW, - .bbt_options = NAND_USE_FLASH_BBT, + .bbt_options = NAND_BBT_USE_FLASH, .options = NAND_BUSWIDTH_16, .ecc_bits = 1, /* 4 bit mode is not supported with 16 bit NAND */ };
arch/arm/mach-davinci/board-neuros-osd2.c +1 -1
@@ -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, - .bbt_options = NAND_USE_FLASH_BBT, + .bbt_options = NAND_BBT_USE_FLASH, };static struct resource davinci_ntosd2_nandflash_resource[] = {
arch/arm/mach-davinci/board-tnetv107x-evm.c +1 -1
@@ -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, - .bbt_options = NAND_USE_FLASH_BBT, + .bbt_options = NAND_BBT_USE_FLASH, .ecc_bits = 1, };
arch/arm/mach-davinci/include/mach/nand.h +1 -1
@@ -76,7 +76,7 @@ struct davinci_nand_pdata { /* platform_data *//* e.g. NAND_BUSWIDTH_16 */ unsigned options; -/* e.g. NAND_USE_FLASH_BBT */ +/* e.g. NAND_BBT_USE_FLASH */ unsigned bbt_options;/* Main and mirror bbt descriptor overrides */
arch/arm/mach-orion5x/ts78xx-setup.c +1 -1
@@ -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, - .bbt_options = NAND_USE_FLASH_BBT, + .bbt_options = NAND_BBT_USE_FLASH, }, .ctrl = {/*
arch/cris/arch-v32/drivers/mach-a3/nandflash.c +1 -1
@@ -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->bbt_options = NAND_USE_FLASH_BBT; */ +/* this->bbt_options = NAND_BBT_USE_FLASH; */ /* Scan to find existence of the device */ if (nand_scan (crisv32_mtd,1 )) {
arch/cris/arch-v32/drivers/mach-fs/nandflash.c +1 -1
@@ -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->bbt_options = NAND_USE_FLASH_BBT; */ +/* this->bbt_options = NAND_BBT_USE_FLASH; */ /* Scan to find existence of the device */ if (nand_scan (crisv32_mtd,1 )) {
drivers/mtd/nand/atmel_nand.c +1 -1
@@ -582,7 +582,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->bbt_options |=NAND_USE_FLASH_BBT ; + nand_chip->bbt_options |=NAND_BBT_USE_FLASH ; }if (!cpu_has_dma ())
drivers/mtd/nand/autcpu12.c +2 -2
@@ -172,9 +172,9 @@ static int __init autcpu12_init(void)/* Enable the following for a flash based bad block table */ /* -this->bbt_options = NAND_USE_FLASH_BBT; +this->bbt_options = NAND_BBT_USE_FLASH; */ - this->bbt_options =NAND_USE_FLASH_BBT ; + this->bbt_options =NAND_BBT_USE_FLASH ;/* Scan to find existence of the device */ if (nand_scan (autcpu12_mtd,1 )) {
drivers/mtd/nand/bcm_umi_nand.c +1 -1
@@ -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->bbt_options &NAND_USE_FLASH_BBT ) +if (this->bbt_options &NAND_BBT_USE_FLASH ) largepage_bbt.options =NAND_BBT_SCAN2NDPAGE ; this->badblock_pattern = &largepage_bbt; }
drivers/mtd/nand/cafe_nand.c +1 -1
@@ -686,7 +686,7 @@ 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.bbt_options =NAND_USE_FLASH_BBT ; + cafe->nand.bbt_options =NAND_BBT_USE_FLASH ; cafe->nand.options =NAND_NO_AUTOINCR |NAND_OWN_BUFFERS ;if (skipbbt) {
drivers/mtd/nand/cs553x_nand.c +1 -1
@@ -239,7 +239,7 @@ 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->bbt_options =NAND_USE_FLASH_BBT ; + this->bbt_options =NAND_BBT_USE_FLASH ; this->options =NAND_NO_AUTOINCR ;/* Scan to find existence of the device */
drivers/mtd/nand/davinci_nand.c +1 -1
@@ -581,7 +581,7 @@ 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 */ +/* options such as NAND_BBT_USE_FLASH */ info->chip.bbt_options = pdata->bbt_options;/* options such as 16-bit widths */ info->chip.options = pdata->options;
drivers/mtd/nand/denali.c +1 -1
@@ -1577,7 +1577,7 @@ 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.bbt_options |=NAND_USE_FLASH_BBT ; + denali->nand.bbt_options |=NAND_BBT_USE_FLASH ; denali->nand.options |=NAND_SKIP_BBTSCAN ; denali->nand.ecc.mode =NAND_ECC_HW_SYNDROME ;
drivers/mtd/nand/diskonchip.c +1 -1
@@ -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->bbt_options =NAND_USE_FLASH_BBT ; + nand->bbt_options =NAND_BBT_USE_FLASH ; doc->physadr = physadr; doc->virtadr = virtadr;
drivers/mtd/nand/fsl_elbc_nand.c +1 -1
@@ -792,7 +792,7 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)/* set up nand options */ chip->options =NAND_NO_READRDY |NAND_NO_AUTOINCR ; - chip->bbt_options =NAND_USE_FLASH_BBT ; + chip->bbt_options =NAND_BBT_USE_FLASH ; chip->controller = &elbc_fcm_ctrl->controller; chip->priv = priv;
drivers/mtd/nand/mpc5121_nfc.c +1 -1
@@ -736,7 +736,7 @@ static int __devinit mpc5121_nfc_probe(struct platform_device *op) chip->verify_buf = mpc5121_nfc_verify_buf; chip->select_chip = mpc5121_nfc_select_chip; chip->options =NAND_NO_AUTOINCR ; - chip->bbt_options =NAND_USE_FLASH_BBT ; + chip->bbt_options =NAND_BBT_USE_FLASH ; chip->ecc.mode =NAND_ECC_SOFT ;/* Support external chip-select logic on ADS5121 board */
drivers/mtd/nand/mxc_nand.c +1 -1
@@ -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->bbt_options |=NAND_USE_FLASH_BBT ; + this->bbt_options |=NAND_BBT_USE_FLASH ; }init_completion (&host->op_completion);
drivers/mtd/nand/nand_base.c +1 -1
@@ -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->bbt_options &NAND_USE_FLASH_BBT ) +if (chip->bbt_options &NAND_BBT_USE_FLASH ) ret =nand_update_bbt (mtd, ofs);else {nand_get_device (chip, mtd,FL_WRITING );
drivers/mtd/nand/nand_bbt.c +6 -6
@@ -14,7 +14,7 @@* * When nand_scan_bbt is called, then it tries to find the bad block table * depending on the options in the BBT descriptor(s). If no flash based BBT -* (NAND_USE_FLASH_BBT) is specified then the device is scanned for factory +* (NAND_BBT_USE_FLASH) is specified then the device is scanned for factory * marked good / bad blocks. This information is used to create a memory BBT. * Once a new bad block is discovered then the "factory" information is updated * on the device.
@@ -36,7 +36,7 @@* 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_BBT_NO_OOB should be used (along with NAND_USE_FLASH_BBT, of +* option NAND_BBT_NO_OOB should be used (along with NAND_BBT_USE_FLASH, of * course): it moves the ident pattern and the version byte into the data area * and the OOB area will remain untouched. *
@@ -1083,14 +1083,14 @@ static void verify_bbt_descr(struct mtd_info *mtd, struct nand_bbt_descr *bd) bits = bd->options &NAND_BBT_NRBITS_MSK ;BUG_ON ((this->bbt_options &NAND_BBT_NO_OOB ) && - !(this->bbt_options &NAND_USE_FLASH_BBT )); + !(this->bbt_options &NAND_BBT_USE_FLASH ));BUG_ON (!bits);if (bd->options &NAND_BBT_VERSION ) pattern_len++;if (bd->options &NAND_BBT_NO_OOB ) { -BUG_ON (!(this->bbt_options &NAND_USE_FLASH_BBT )); +BUG_ON (!(this->bbt_options &NAND_BBT_USE_FLASH ));BUG_ON (!(this->bbt_options &NAND_BBT_NO_OOB ));BUG_ON (bd->offs);if (bd->options &NAND_BBT_VERSION )
@@ -1357,12 +1357,12 @@ int nand_default_bbt(struct mtd_info *mtd) this->bbt_td = &bbt_main_descr; this->bbt_md = &bbt_mirror_descr; } - this->bbt_options |=NAND_USE_FLASH_BBT ; + this->bbt_options |=NAND_BBT_USE_FLASH ;return nand_scan_bbt (mtd, &agand_flashbased); }/* Is a flash based bad block table requested ? */ -if (this->bbt_options &NAND_USE_FLASH_BBT ) { +if (this->bbt_options &NAND_BBT_USE_FLASH ) {/* Use the default pattern descriptors */ if (!this->bbt_td) {if (this->bbt_options &NAND_BBT_NO_OOB ) {
drivers/mtd/nand/nandsim.c +1 -1
@@ -2275,7 +2275,7 @@ static int __init ns_init_module(void)case 2 : chip->bbt_options |=NAND_BBT_NO_OOB ;case 1 : - chip->bbt_options |=NAND_USE_FLASH_BBT ; + chip->bbt_options |=NAND_BBT_USE_FLASH ;case 0 :break ;default :
drivers/mtd/nand/pasemi_nand.c +1 -1
@@ -156,7 +156,7 @@ static int __devinit pasemi_nand_probe(struct platform_device *ofdev)/* Enable the following for a flash based bad block table */ chip->options =NAND_NO_AUTOINCR ; - chip->bbt_options =NAND_USE_FLASH_BBT ; + chip->bbt_options =NAND_BBT_USE_FLASH ;/* Scan to find existence of the device */ if (nand_scan (pasemi_nand_mtd,1 )) {
drivers/mtd/nand/s3c2410.c +1 -1
@@ -881,7 +881,7 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,* 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->bbt_options |=NAND_USE_FLASH_BBT ; + chip->bbt_options |=NAND_BBT_USE_FLASH ; chip->options |=NAND_SKIP_BBTSCAN ; } }
include/linux/mtd/bbm.h +1 -1
@@ -104,7 +104,7 @@ struct nand_bbt_descr {* 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 +#define NAND_BBT_USE_FLASH 0x00040000/* Do not store flash based bad block table in OOB area; store it in-band */ #define NAND_BBT_NO_OOB 0x00080000
Signature · 1 line
1.7.0.4
PATCH 5/8 mtd: nand: move NAND_CREATE_EMPTY_BBT flag
In reply to Brian NorrisThe NAND_CREATE_EMPTY_BBT flag was added by commit:
453281a973c10bce941b240d1c654d536623b16b
mtd: nand: introduce NAND_CREATE_EMPTY_BBT
This flag is not used within the kernel and not explained well, so I took the liberty to edit its comments.
Also, this is a BBT-related flag (and closely tied with NAND_BBT_CREATE) so I'm moving it to bbm.h next to NAND_BBT_CREATE, thus requiring that we use the flag in nand_chip.bbt_options, *not* in nand_chip.options.
--- drivers/mtd/nand/nand_bbt.c | 2 +- include/linux/mtd/bbm.h | 7 +++++++ include/linux/mtd/nand.h | 2 -- 3 files changed, 8 insertions(+), 3 deletions(-)
drivers/mtd/nand/nand_bbt.c +1 -1
@@ -970,7 +970,7 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desccontinue ;/* Create the table in memory by scanning the chip(s) */ -if (!(this->options &NAND_CREATE_EMPTY_BBT )) +if (!(this->bbt_options &NAND_CREATE_EMPTY_BBT ))create_bbt (mtd, buf, bd, chipsel); td->version[i] =1 ;
include/linux/mtd/bbm.h +7 -0
@@ -86,6 +86,13 @@ struct nand_bbt_descr {#define NAND_BBT_VERSION 0x00000100/* Create a bbt if none exists */ #define NAND_BBT_CREATE 0x00000200 +/* +* Create an empty BBT with no vendor information. Vendor's information may be +* unavailable, for example, if the NAND controller has a different data and OOB +* layout or if this information is already purged. Must be used in conjunction +* with NAND_BBT_CREATE. +*/ +#define NAND_CREATE_EMPTY_BBT 0x01000000/* Search good / bad pattern through all pages of a block */ #define NAND_BBT_SCANALLPAGES 0x00000400/* Scan block empty during good / bad block scan */
include/linux/mtd/nand.h +0 -2
@@ -228,8 +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 -/* Create an empty BBT with no vendor information if the BBT is available */ -#define NAND_CREATE_EMPTY_BBT 0x01000000/* Options set by nand scan */ /* Nand scan has allocated controller struct */
Signature · 1 line
1.7.0.4
PATCH 6/8 mtd: nand: rename CREATE_EMPTY bbt flag with proper prefix
In reply to Brian NorrisAccording to our new prefix rules, we should rename NAND_CREATE_EMPTY_BBT with a NAND_BBT prefix, i.e., NAND_BBT_CREATE_EMPTY.
--- drivers/mtd/nand/nand_bbt.c | 2 +- include/linux/mtd/bbm.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/nand_bbt.c +1 -1
@@ -970,7 +970,7 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desccontinue ;/* Create the table in memory by scanning the chip(s) */ -if (!(this->bbt_options &NAND_CREATE_EMPTY_BBT )) +if (!(this->bbt_options &NAND_BBT_CREATE_EMPTY ))create_bbt (mtd, buf, bd, chipsel); td->version[i] =1 ;
include/linux/mtd/bbm.h +1 -1
@@ -92,7 +92,7 @@ struct nand_bbt_descr {* layout or if this information is already purged. Must be used in conjunction * with NAND_BBT_CREATE. */ -#define NAND_CREATE_EMPTY_BBT 0x01000000 +#define NAND_BBT_CREATE_EMPTY 0x01000000/* Search good / bad pattern through all pages of a block */ #define NAND_BBT_SCANALLPAGES 0x00000400/* Scan block empty during good / bad block scan */
Signature · 1 line
1.7.0.4
PATCH 7/8 mtd: nand: renumber the reorganized flags in nand.h / bbm.h
In reply to Brian NorrisAfter several steps of rearrangement and consolidation, it is probably worth re-sequencing the numbers on some of our affected flags in nand.h and bbm.h.
--- include/linux/mtd/bbm.h | 23 ++++++++++++----------- include/linux/mtd/nand.h | 6 +++--- 2 files changed, 15 insertions(+), 14 deletions(-)
include/linux/mtd/bbm.h +12 -11
@@ -92,28 +92,29 @@ struct nand_bbt_descr {* layout or if this information is already purged. Must be used in conjunction * with NAND_BBT_CREATE. */ -#define NAND_BBT_CREATE_EMPTY 0x01000000 +#define NAND_BBT_CREATE_EMPTY 0x00000400/* Search good / bad pattern through all pages of a block */ -#define NAND_BBT_SCANALLPAGES 0x00000400 +#define NAND_BBT_SCANALLPAGES 0x00000800/* Scan block empty during good / bad block scan */ -#define NAND_BBT_SCANEMPTY 0x00000800 +#define NAND_BBT_SCANEMPTY 0x00001000/* Write bbt if neccecary */ -#define NAND_BBT_WRITE 0x00001000 +#define NAND_BBT_WRITE 0x00002000/* Read and write back block contents when writing bbt */ -#define NAND_BBT_SAVECONTENT 0x00002000 +#define NAND_BBT_SAVECONTENT 0x00004000/* Search good / bad pattern on the first and the second page */ -#define NAND_BBT_SCAN2NDPAGE 0x00004000 +#define NAND_BBT_SCAN2NDPAGE 0x00008000/* Search good / bad pattern on the last page of the eraseblock */ -#define NAND_BBT_SCANLASTPAGE 0x00008000 -/* The nand_bbt_descr was created dynamicaly and must be freed */ -#define NAND_BBT_DYNAMICSTRUCT 0x00200000 +#define NAND_BBT_SCANLASTPAGE 0x00010000/* * 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_BBT_USE_FLASH 0x00040000 +#define NAND_BBT_USE_FLASH 0x00020000/* Do not store flash based bad block table in OOB area; store it in-band */ -#define NAND_BBT_NO_OOB 0x00080000 +#define NAND_BBT_NO_OOB 0x00040000 + +/* The nand_bbt_descr was created dynamicaly and must be freed */ +#define NAND_BBT_DYNAMICSTRUCT 0x80000000/* The maximum number of blocks to scan for a bbt */ #define NAND_BBT_SCAN_MAXBLOCKS 4
include/linux/mtd/nand.h +3 -3
@@ -220,14 +220,14 @@ typedef enum {/* Non chip related options */ /* This option skips the bbt scan during initialization. */ -#define NAND_SKIP_BBTSCAN 0x00020000 +#define NAND_SKIP_BBTSCAN 0x00010000/* * This option is defined if the board driver allocates its own buffers * (e.g. because it needs them DMA-coherent). */ -#define NAND_OWN_BUFFERS 0x00040000 +#define NAND_OWN_BUFFERS 0x00020000/* Chip may not exist, so silence any errors in scan */ -#define NAND_SCAN_SILENT_NODEV 0x00080000 +#define NAND_SCAN_SILENT_NODEV 0x00040000/* Options set by nand scan */ /* Nand scan has allocated controller struct */
Signature · 1 line
1.7.0.4
PATCH 8/8 mtd: nand: improve comment on NAND_BBT_DYNAMIC_STRUCT
In reply to Brian NorrisIn an attempt to improve the documentation of the BBT code, I am expanding the comments I left in commit:
58373ff0afff4cc8ac40608872995f4d87eb72ec
mtd: nand: more BB Detection refactoring and dynamic scan options
--- include/linux/mtd/bbm.h | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
include/linux/mtd/bbm.h +5 -1
@@ -113,7 +113,11 @@ struct nand_bbt_descr {/* Do not store flash based bad block table in OOB area; store it in-band */ #define NAND_BBT_NO_OOB 0x00040000 -/* The nand_bbt_descr was created dynamicaly and must be freed */ +/* +* Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr +* was allocated dynamicaly and must be freed in nand_release(). Has no meaning +* in nand_chip.bbt_options. +*/ #define NAND_BBT_DYNAMICSTRUCT 0x80000000/* The maximum number of blocks to scan for a bbt */
Signature · 1 line
1.7.0.4
cover clean-up NAND / BBT code, flags
In reply to Brian NorrisQuoted 13 lines · Brian Norris
Hello,
This patch series handles several issues with NAND chip flags and BBT flags, especially those related to the nand_chip.options and nand_bbt_descr.options fields. This topic was discussed and reviewed a bit on the linux-mtd thread found here:
http://lists.infradead.org/pipermail/linux-mtd/2011-April/035146.htmlThese changes have affected many drivers in relatively small ways, so I copied all the maintainers/contributors given by the
scripts/getmaintainer.plscripts. FYI, this patch set is based on the mtd-2.6.git repository from linux-mtd.
Quoted 4 lines
Also, the first patch:
mtd: nand: removeNAND_BBT_SCANBYTE1AND6option
solves the regression issues discussed here:http://lists.infradead.org/pipermail/linux-mtd/2011-May/035696.html
Looks good to me, thank you. Pushed to l2-mtd-2.6.git.
Signature · 2 lines
Best Regards, Artem Bityutskiy (????? ????????)