[PATCH] mtd: Nand Atmel: add On Flash BBT support

simon polette spolette at gmail.com
Mon May 25 11:44:22 EDT 2009


Hi,

Here is a patch which add support for On Flash Bad Block Table on AT91 and
AVR32 devices.

Signed-off-by: Simon Polette <spolette at adetelgroup.com>
---
 drivers/mtd/nand/Kconfig      |    9 +++++++++
 drivers/mtd/nand/atmel_nand.c |    3 +++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 890936d..c860688 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -333,6 +333,15 @@ config MTD_NAND_ATMEL_ECC_NONE

 endchoice

+config	MTD_NAND_ATMEL_FLASH_BBT
+	bool "Use On-Flash Bad Block Table"
+	depends on MTD_NAND_ATMEL
+	help
+	  This enables the On-Flash BBT, which mean that the bad blocks
+	  will be scanned one time then the BBT will be stored
+	  in flash, so scanning Nand flash for bad blocks will be no more
+	  necessary for the next boots.
+
 config MTD_NAND_PXA3xx
 	tristate "Support for NAND flash devices on PXA3xx"
 	depends on MTD_NAND && PXA3xx
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 47a33ce..dca19dd 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -464,6 +464,9 @@ static int __init atmel_nand_probe(struct
platform_device *pdev)
 			goto err_no_card;
 		}
 	}
+#ifdef CONFIG_MTD_NAND_ATMEL_FLASH_BBT
+	nand_chip->options |= NAND_USE_FLASH_BBT;
+#endif

 	/* first scan to find the device and get the page size */
 	if (nand_scan_ident(mtd, 1)) {
-- 
1.6.0.4

--
Best regards,
Simon Polette
Adeneo - Adetelgroup



More information about the linux-mtd mailing list