Skip to contentSkip to conversation

mtd: nand_bbt: Skip bad blocks when searching for the BBT in NAND

PATCH In review Yunus Bas 1 participant 2 messages May 4, 2020

Subsystems (2)
lore
Share & tools
lore

Yunus Bas

author
#0 lore raw

PATCH 1/1 mtd: nand_bbt: Skip bad blocks when searching for the BBT in NAND

From: Stefan Riedmueller <[email protected]>

The blocks containing the bad block table can become bad as well. So make sure to skip any blocks that are marked bad when searching for the bad block table.

---
 drivers/mtd/nand/nand_bbt.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/mtd/nand/nand_bbt.c +8 -2
index 435a06f..403c0ae 100644
@@ -560,8 +560,14 @@ static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
 			int actblock = startblock + dir * block;
 			loff_t offs = (loff_t)actblock << this->bbt_erase_shift;
 
-			/* Read first page */
-			scan_read(mtd, buf, offs, mtd->writesize, td);
+			/* Read first page including oob */
+			scan_read_oob(mtd, buf, offs, scanlen);
+
+			/* Skip blocks which are marked bad */
+			if (buf[mtd->writesize] == 0x00) {
+				continue;
+			}
+
 			if (!check_pattern(buf, scanlen, mtd->writesize, td)) {
 				td->pages[i] = actblock << blocktopage;
 				if (td->options & NAND_BBT_VERSION) {
Signature · 7 lines
2.7.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
author
#1 lore raw

Please skip this patch, there seems to be a problem here.

Regards

Y. Bas

Am 04.05.20 um 15:44 schrieb Yunus Bas:

Quoted 24 lines

From: Stefan Riedmueller <[email protected]>

The blocks containing the bad block table can become bad as well. So make sure to skip any blocks that are marked bad when searching for the bad block table.

---
  drivers/mtd/nand/nand_bbt.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)
drivers/mtd/nand/nand_bbt.c +1 -2
index 435a06f..403c0ae 100644
@@ -560,8 +560,14 @@ static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
  			int actblock = startblock + dir * block;
  			loff_t offs = (loff_t)actblock << this->bbt_erase_shift;
 
-			/* Read first page */
-			scan_read(mtd, buf, offs, mtd->writesize, td);
+			/* Read first page including oob */

drivers/mtd/nand/nand_bbt.c static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr · line 573

Quoted 10 lines
drivers/mtd/nand/nand_bbt.c +7 -0
+			scan_read_oob(mtd, buf, offs, scanlen);
+
+			/* Skip blocks which are marked bad */
+			if (buf[mtd->writesize] == 0x00) {
+				continue;
+			}
+
  			if (!check_pattern(buf, scanlen, mtd->writesize, td)) {
  				td->pages[i] = actblock << blocktopage;
  				if (td->options & NAND_BBT_VERSION) {

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox