[PATCH] mtd: nand: mrvl-nand: create initial empty bbt

Robert Jarzmik robert.jarzmik at free.fr
Sun Aug 9 14:54:18 PDT 2015


When creating an initial bad blocks table, create it empty. This is
necessary because when the bad block table blocks are not
initialized (all ff) while some partitions are, all the blocks which
have an OOB data not beginning with 0xff 0xff will be marked as bad
blocks in the initial bad blocks scan.

As a consequence, any existing blocks are impossible to erase
anymore. Fix this by fixing the BBT creation flag.

Signed-off-by: Robert Jarzmik <robert.jarzmik at free.fr>
---
 drivers/mtd/nand/nand_mrvl_nfc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/nand_mrvl_nfc.c b/drivers/mtd/nand/nand_mrvl_nfc.c
index 258ff75..1ec48cc 100644
--- a/drivers/mtd/nand/nand_mrvl_nfc.c
+++ b/drivers/mtd/nand/nand_mrvl_nfc.c
@@ -881,8 +881,9 @@ static int mrvl_nand_scan(struct mtd_info *mtd)
 		 * We'll use a bad block table stored in-flash and don't
 		 * allow writing the bad block marker to the flash.
 		 */
-		chip->bbt_options |= NAND_BBT_USE_FLASH |
-				     NAND_BBT_NO_OOB_BBM;
+		chip->bbt_options |=
+			NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB_BBM |
+			NAND_BBT_CREATE_EMPTY;
 		chip->bbt_td = &bbt_main_descr;
 		chip->bbt_md = &bbt_mirror_descr;
 	}
-- 
2.1.4




More information about the barebox mailing list