RE: [PATCH 01/12] mtd: nand_bbt: new header for nand family BBT
Sorry for send the patch 1 twice. Since I cannot send mail using 'git send-email' right now. I send this series by outlook. This may cause copyright symbol wrong. Patch 1 and 12 got this problem and patch 12 cannot be applied. Please ignore this error. Peter Pan On Fri, 25 Sep 2015 14:37:35 + Peter Pan 潘栋 (peterpandong) wrote: > Migrating existing BBT definitions from bbm.h to nand_bbt.h > > Signed-off-by: Brian Norris > [Peter: correct misspelling. s/neccecary/necessary/] > Signed-off-by: Peter Pan > --- > include/linux/mtd/bbm.h | 96 +-- > include/linux/mtd/nand_bbt.h | 118 > +++ > 2 files changed, 119 insertions(+), 95 deletions(-) > create mode 100644 include/linux/mtd/nand_bbt.h > > diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h > index 36bb6a5..fb751d9 100644 > --- a/include/linux/mtd/bbm.h > +++ b/include/linux/mtd/bbm.h > @@ -28,102 +28,8 @@ > #ifndef __LINUX_MTD_BBM_H > #define __LINUX_MTD_BBM_H > > -/* The maximum number of NAND chips in an array */ > -#define NAND_MAX_CHIPS 8 > +#include > > -/** > - * struct nand_bbt_descr - bad block table descriptor > - * @options: options for this descriptor > - * @pages: the page(s) where we find the bbt, used with option > BBT_ABSPAGE > - * when bbt is searched, then we store the found bbts pages here. > - * Its an array and supports up to 8 chips now > - * @offs:offset of the pattern in the oob area of the page > - * @veroffs: offset of the bbt version counter in the oob are of the page > - * @version: version read from the bbt page during scan > - * @len: length of the pattern, if 0 no pattern check is performed > - * @maxblocks: maximum number of blocks to search for a bbt. This > number of > - * blocks is reserved at the end of the device where the tables are > - * written. > - * @reserved_block_code: if non-0, this pattern denotes a reserved (rather > than > - * bad) block in the stored bbt > - * @pattern: pattern to identify bad block table or factory marked good / > - * bad blocks, can be NULL, if len = 0 > - * > - * Descriptor for the bad block table marker and the descriptor for the > - * pattern which identifies good and bad blocks. The assumption is made > - * that the pattern and the version count are always located in the oob area > - * of the first block. > - */ > -struct nand_bbt_descr { > - int options; > - int pages[NAND_MAX_CHIPS]; > - int offs; > - int veroffs; > - uint8_t version[NAND_MAX_CHIPS]; > - int len; > - int maxblocks; > - int reserved_block_code; > - uint8_t *pattern; > -}; > - > -/* Options for the bad block table descriptors */ > - > -/* The number of bits used per block in the bbt on the device */ > -#define NAND_BBT_NRBITS_MSK 0x000F > -#define NAND_BBT_1BIT0x0001 > -#define NAND_BBT_2BIT0x0002 > -#define NAND_BBT_4BIT0x0004 > -#define NAND_BBT_8BIT0x0008 > -/* The bad block table is in the last good block of the device */ > -#define NAND_BBT_LASTBLOCK 0x0010 > -/* The bbt is at the given page, else we must scan for the bbt */ > -#define NAND_BBT_ABSPAGE 0x0020 > -/* bbt is stored per chip on multichip devices */ > -#define NAND_BBT_PERCHIP 0x0080 > -/* bbt has a version counter at offset veroffs */ > -#define NAND_BBT_VERSION 0x0100 > -/* Create a bbt if none exists */ > -#define NAND_BBT_CREATE 0x0200 > -/* > - * 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_BBT_CREATE_EMPTY0x0400 > -/* Write bbt if neccecary */ > -#define NAND_BBT_WRITE 0x2000 > -/* Read and write back block contents when writing bbt */ > -#define NAND_BBT_SAVECONTENT 0x4000 > -/* Search good / bad pattern on the first and the second page */ > -#define NAND_BBT_SCAN2NDPAGE 0x8000 > -/* Search good / bad pattern on the last page of the eraseblock */ > -#define NAND_BBT_SCANLASTPAGE0x0001 > -/* > - * 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 0x0002 > -/* > - * Do not store flash based bad block table marker in the OOB area; store it > - * in-band. > - */ > -#define NAND_BBT_NO_OOB 0x0004 > -/* > - * Do not write new bad block markers to OOB; useful, e.g., when ECC covers > - * entire spare area. Must be used with NAND_BBT_USE_FLASH. > - */ > -#define NAND_BBT_NO_OOB_BBM 0x0008 > - > -/* > - * Flag set by
RE: [PATCH 01/12] mtd: nand_bbt: new header for nand family BBT
Sorry for send the patch 1 twice. Since I cannot send mail using 'git send-email' right now. I send this series by outlook. This may cause copyright symbol wrong. Patch 1 and 12 got this problem and patch 12 cannot be applied. Please ignore this error. Peter Pan On Fri, 25 Sep 2015 14:37:35 + Peter Pan 潘栋 (peterpandong)wrote: > Migrating existing BBT definitions from bbm.h to nand_bbt.h > > Signed-off-by: Brian Norris > [Peter: correct misspelling. s/neccecary/necessary/] > Signed-off-by: Peter Pan > --- > include/linux/mtd/bbm.h | 96 +-- > include/linux/mtd/nand_bbt.h | 118 > +++ > 2 files changed, 119 insertions(+), 95 deletions(-) > create mode 100644 include/linux/mtd/nand_bbt.h > > diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h > index 36bb6a5..fb751d9 100644 > --- a/include/linux/mtd/bbm.h > +++ b/include/linux/mtd/bbm.h > @@ -28,102 +28,8 @@ > #ifndef __LINUX_MTD_BBM_H > #define __LINUX_MTD_BBM_H > > -/* The maximum number of NAND chips in an array */ > -#define NAND_MAX_CHIPS 8 > +#include > > -/** > - * struct nand_bbt_descr - bad block table descriptor > - * @options: options for this descriptor > - * @pages: the page(s) where we find the bbt, used with option > BBT_ABSPAGE > - * when bbt is searched, then we store the found bbts pages here. > - * Its an array and supports up to 8 chips now > - * @offs:offset of the pattern in the oob area of the page > - * @veroffs: offset of the bbt version counter in the oob are of the page > - * @version: version read from the bbt page during scan > - * @len: length of the pattern, if 0 no pattern check is performed > - * @maxblocks: maximum number of blocks to search for a bbt. This > number of > - * blocks is reserved at the end of the device where the tables are > - * written. > - * @reserved_block_code: if non-0, this pattern denotes a reserved (rather > than > - * bad) block in the stored bbt > - * @pattern: pattern to identify bad block table or factory marked good / > - * bad blocks, can be NULL, if len = 0 > - * > - * Descriptor for the bad block table marker and the descriptor for the > - * pattern which identifies good and bad blocks. The assumption is made > - * that the pattern and the version count are always located in the oob area > - * of the first block. > - */ > -struct nand_bbt_descr { > - int options; > - int pages[NAND_MAX_CHIPS]; > - int offs; > - int veroffs; > - uint8_t version[NAND_MAX_CHIPS]; > - int len; > - int maxblocks; > - int reserved_block_code; > - uint8_t *pattern; > -}; > - > -/* Options for the bad block table descriptors */ > - > -/* The number of bits used per block in the bbt on the device */ > -#define NAND_BBT_NRBITS_MSK 0x000F > -#define NAND_BBT_1BIT0x0001 > -#define NAND_BBT_2BIT0x0002 > -#define NAND_BBT_4BIT0x0004 > -#define NAND_BBT_8BIT0x0008 > -/* The bad block table is in the last good block of the device */ > -#define NAND_BBT_LASTBLOCK 0x0010 > -/* The bbt is at the given page, else we must scan for the bbt */ > -#define NAND_BBT_ABSPAGE 0x0020 > -/* bbt is stored per chip on multichip devices */ > -#define NAND_BBT_PERCHIP 0x0080 > -/* bbt has a version counter at offset veroffs */ > -#define NAND_BBT_VERSION 0x0100 > -/* Create a bbt if none exists */ > -#define NAND_BBT_CREATE 0x0200 > -/* > - * 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_BBT_CREATE_EMPTY0x0400 > -/* Write bbt if neccecary */ > -#define NAND_BBT_WRITE 0x2000 > -/* Read and write back block contents when writing bbt */ > -#define NAND_BBT_SAVECONTENT 0x4000 > -/* Search good / bad pattern on the first and the second page */ > -#define NAND_BBT_SCAN2NDPAGE 0x8000 > -/* Search good / bad pattern on the last page of the eraseblock */ > -#define NAND_BBT_SCANLASTPAGE0x0001 > -/* > - * 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 0x0002 > -/* > - * Do not store flash based bad block table marker in the OOB area; store it > - * in-band. > - */ > -#define NAND_BBT_NO_OOB 0x0004 > -/* > - * Do not write new bad block markers to OOB; useful, e.g., when ECC covers > - * entire spare area. Must be used with NAND_BBT_USE_FLASH. > - */ >