ARM: at91: atmel_nand: Support flash based BBT
authorDavid Dueck <davidcdueck@googlemail.com>
Fri, 20 Mar 2015 09:52:49 +0000 (10:52 +0100)
committerAndreas Bießmann <andreas.devel@googlemail.com>
Tue, 31 Mar 2015 23:04:28 +0000 (01:04 +0200)
Add support for on-flash bad block table. This makes U-Boot handle an existing
BBT correctly.

Signed-off-by: David Dueck <davidcdueck@googlemail.com>
Reviewed-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
CC: Boris BREZILLON <boris.brezillon@free-electrons.com>
CC: Josh Wu <josh.wu@atmel.com>
CC: Andreas Bießmann <andreas.devel@googlemail.com>
CC: Scott Wood <scottwood@freescale.com>
Acked-by: Josh Wu <josh.wu@atmel.com>
drivers/mtd/nand/atmel_nand.c

index b16e3aa15749428e1a9937f98767ae662b55acb6..a2016e7945d0f06a6c33bc9703e2bdb33665d998 100644 (file)
@@ -1456,6 +1456,9 @@ int board_nand_init(struct nand_chip *nand)
        nand->dev_ready = at91_nand_wait_ready;
 #endif
        nand->chip_delay = 20;
+#ifdef CONFIG_SYS_NAND_USE_FLASH_BBT
+       nand->bbt_options |= NAND_BBT_USE_FLASH;
+#endif
 
 #ifdef CONFIG_ATMEL_NAND_HWECC
 #ifdef CONFIG_ATMEL_NAND_HW_PMECC
@@ -1522,6 +1525,9 @@ int atmel_nand_chip_init(int devnum, ulong base_addr)
        nand->dev_ready = at91_nand_ready;
 #endif
        nand->chip_delay = 75;
+#ifdef CONFIG_SYS_NAND_USE_FLASH_BBT
+       nand->bbt_options |= NAND_BBT_USE_FLASH;
+#endif
 
        ret = nand_scan_ident(mtd, CONFIG_SYS_NAND_MAX_CHIPS, NULL);
        if (ret)