linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd/nand: Edit macro flag for BBT scan of last page in block
@ 2010-06-23 20:36 Brian Norris
  2010-06-25 21:36 ` [PATCH 2] mtd/nand, BB detect: factory marker in page 1, 2, last and byte 1 or 6 Brian Norris
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Brian Norris @ 2010-06-23 20:36 UTC (permalink / raw)
  To: linux-mtd; +Cc: Brian Norris

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: Brian Norris <norris@broadcom.com>
---
 drivers/mtd/nand/nand_base.c |    6 +++---
 drivers/mtd/nand/nand_bbt.c  |    2 +-
 include/linux/mtd/bbm.h      |    2 ++
 include/linux/mtd/nand.h     |    2 --
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 4a7b864..e6cf9ae 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -347,7 +347,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_BB_LAST_PAGE)
+	if (chip->options & NAND_BBT_SCANLASTPAGE)
 		ofs += mtd->erasesize - mtd->writesize;
 
 	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)
 	uint8_t buf[2] = { 0, 0 };
 	int block, ret;
 
-	if (chip->options & NAND_BB_LAST_PAGE)
+	if (chip->options & NAND_BBT_SCANLASTPAGE)
 		ofs += mtd->erasesize - mtd->writesize;
 
 	/* Get block number */
@@ -2946,7 +2946,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
 	if ((chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
 			(*maf_id == NAND_MFR_SAMSUNG ||
 			 *maf_id == NAND_MFR_HYNIX))
-		chip->options |= NAND_BB_LAST_PAGE;
+		chip->options |= NAND_BBT_SCANLASTPAGE;
 
 	/* Check for AND chips with 4 page planes */
 	if (chip->options & NAND_4PAGE_ARRAY)
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index ad97c0c..71d83be 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -432,7 +432,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_BB_LAST_PAGE)
+	if (this->options & NAND_BBT_SCANLASTPAGE)
 		from += mtd->erasesize - (mtd->writesize * len);
 
 	for (i = startblock; i < numblocks;) {
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 9c3757c..8ad0b86 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -82,6 +82,8 @@ struct nand_bbt_descr {
 #define NAND_BBT_SAVECONTENT	0x00002000
 /* Search good / bad pattern on the first and the second page */
 #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 */
 #define NAND_BBT_SCAN_MAXBLOCKS	4
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index a81b185..50f3aa0 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -181,8 +181,6 @@ typedef enum {
 #define NAND_NO_READRDY		0x00000100
 /* Chip does not allow subpage writes */
 #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 */
 #define NAND_BROKEN_XD		0x00000400
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-07-26  4:31 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-23 20:36 [PATCH] mtd/nand: Edit macro flag for BBT scan of last page in block Brian Norris
2010-06-25 21:36 ` [PATCH 2] mtd/nand, BB detect: factory marker in page 1, 2, last and byte 1 or 6 Brian Norris
2010-07-13  8:21   ` Artem Bityutskiy
2010-07-13 22:12     ` [PATCH v2 0/2] Improved BB Scanning Brian Norris
2010-07-13 22:13       ` [PATCH v2 1/2] mtd/nand, BB detect: factory marker in page 1, 2, last and byte 1 or 6 Brian Norris
2010-07-13 22:13       ` [PATCH v2 2/2] mtd/nand: More BB Detection, dynamic scan options Brian Norris
2010-07-13 23:56         ` Brian Norris
2010-07-15 19:15           ` [PATCH v3 " Brian Norris
2010-07-18 16:38       ` [PATCH v2 0/2] Improved BB Scanning Artem Bityutskiy
2010-07-19 19:32         ` Brian Norris
2010-07-21  9:49           ` Artem Bityutskiy
2010-07-22 19:44             ` Karl Beldan
2010-07-21 23:53       ` [PATCH] mtd/nand: Update nand_default_block_markbad() Brian Norris
2010-07-26  4:30         ` Artem Bityutskiy
2010-07-08  9:15 ` [PATCH] mtd/nand: Edit macro flag for BBT scan of last page in block Artem Bityutskiy
2010-07-13  8:01 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).