Commit 30fe8115 authored by Brian Norris's avatar Brian Norris Committed by David Woodhouse

mtd: nand: edit macro flag for BBT scan of last page in block

NAND_BB_LAST_PAGE used to be in nand.h, but it pertained to bad block
management and so belongs next to NAND_BBT_SCAN2NDPAGE in bbm.h. Also,
its previous flag value (0x00000400) conflicted with NAND_BBT_SCANALLPAGES
so I changed its value to 0x00008000. All uses of the name were modified to
provide consistency with other "NAND_BBT_*" flags.
Signed-off-by: default avatarBrian Norris <norris@broadcom.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent e1d0fe3c
...@@ -347,7 +347,7 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip) ...@@ -347,7 +347,7 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd->priv;
u16 bad; u16 bad;
if (chip->options & NAND_BB_LAST_PAGE) if (chip->options & NAND_BBT_SCANLASTPAGE)
ofs += mtd->erasesize - mtd->writesize; ofs += mtd->erasesize - mtd->writesize;
page = (int)(ofs >> chip->page_shift) & chip->pagemask; page = (int)(ofs >> chip->page_shift) & chip->pagemask;
...@@ -399,7 +399,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs) ...@@ -399,7 +399,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
uint8_t buf[2] = { 0, 0 }; uint8_t buf[2] = { 0, 0 };
int block, ret; int block, ret;
if (chip->options & NAND_BB_LAST_PAGE) if (chip->options & NAND_BBT_SCANLASTPAGE)
ofs += mtd->erasesize - mtd->writesize; ofs += mtd->erasesize - mtd->writesize;
/* Get block number */ /* Get block number */
...@@ -2946,7 +2946,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, ...@@ -2946,7 +2946,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
if ((chip->cellinfo & NAND_CI_CELLTYPE_MSK) && if ((chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
(*maf_id == NAND_MFR_SAMSUNG || (*maf_id == NAND_MFR_SAMSUNG ||
*maf_id == NAND_MFR_HYNIX)) *maf_id == NAND_MFR_HYNIX))
chip->options |= NAND_BB_LAST_PAGE; chip->options |= NAND_BBT_SCANLASTPAGE;
/* Check for AND chips with 4 page planes */ /* Check for AND chips with 4 page planes */
if (chip->options & NAND_4PAGE_ARRAY) if (chip->options & NAND_4PAGE_ARRAY)
......
...@@ -432,7 +432,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, ...@@ -432,7 +432,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf,
from = (loff_t)startblock << (this->bbt_erase_shift - 1); from = (loff_t)startblock << (this->bbt_erase_shift - 1);
} }
if (this->options & NAND_BB_LAST_PAGE) if (this->options & NAND_BBT_SCANLASTPAGE)
from += mtd->erasesize - (mtd->writesize * len); from += mtd->erasesize - (mtd->writesize * len);
for (i = startblock; i < numblocks;) { for (i = startblock; i < numblocks;) {
......
...@@ -82,6 +82,8 @@ struct nand_bbt_descr { ...@@ -82,6 +82,8 @@ struct nand_bbt_descr {
#define NAND_BBT_SAVECONTENT 0x00002000 #define NAND_BBT_SAVECONTENT 0x00002000
/* Search good / bad pattern on the first and the second page */ /* Search good / bad pattern on the first and the second page */
#define NAND_BBT_SCAN2NDPAGE 0x00004000 #define NAND_BBT_SCAN2NDPAGE 0x00004000
/* Search good / bad pattern on the last page of the eraseblock */
#define NAND_BBT_SCANLASTPAGE 0x00008000
/* 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
......
...@@ -181,8 +181,6 @@ typedef enum { ...@@ -181,8 +181,6 @@ typedef enum {
#define NAND_NO_READRDY 0x00000100 #define NAND_NO_READRDY 0x00000100
/* Chip does not allow subpage writes */ /* Chip does not allow subpage writes */
#define NAND_NO_SUBPAGE_WRITE 0x00000200 #define NAND_NO_SUBPAGE_WRITE 0x00000200
/* Chip stores bad block marker on the last page of the eraseblock */
#define NAND_BB_LAST_PAGE 0x00000400
/* Device is one of 'new' xD cards that expose fake nand command set */ /* Device is one of 'new' xD cards that expose fake nand command set */
#define NAND_BROKEN_XD 0x00000400 #define NAND_BROKEN_XD 0x00000400
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment