diff options
author | Ezequiel GarcĂa <ezequiel@vanguardiasur.com.ar> | 2014-09-11 11:02:08 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-09-17 04:02:48 -0400 |
commit | fef775caa705255358cdf7bbaf9bbc2fd1111761 (patch) | |
tree | ed080f0f7c339f4b51cbc3e19fa98b73c161c4a3 /drivers/mtd/nand | |
parent | 2d405ec5fdd5b6848beb820301d4fcaa3e2c4159 (diff) |
nand: omap2: Add support for flash-based bad block table
This commit adds a new platform-data boolean property that enables use
of a flash-based bad block table. This can also be enabled by setting
the 'nand-on-flash-bbt' devicetree property.
If the flash BBT is not enabled, the driver falls back to use OOB
bad block markers only, as before. If the flash BBT is enabled the
kernel will keep track of bad blocks using a BBT, in addition to
the OOB markers.
As explained by Brian Norris the reasons for using a BBT are:
""
The primary reason would be that NAND datasheets specify it these days.
A better argument is that nobody guarantees that you can write a
bad block marker to a worn out block; you may just get program failures.
This has been acknowledged by several developers over the last several
years.
Additionally, you get a boot-time performance improvement if you only
have to read a few pages, instead of a page or two from every block on
the flash.
""
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Acked-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/omap2.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 5967b385141b..e1a9b310c159 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -1663,7 +1663,6 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1663 | mtd->owner = THIS_MODULE; | 1663 | mtd->owner = THIS_MODULE; |
1664 | nand_chip = &info->nand; | 1664 | nand_chip = &info->nand; |
1665 | nand_chip->ecc.priv = NULL; | 1665 | nand_chip->ecc.priv = NULL; |
1666 | nand_chip->options |= NAND_SKIP_BBTSCAN; | ||
1667 | 1666 | ||
1668 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1667 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1669 | nand_chip->IO_ADDR_R = devm_ioremap_resource(&pdev->dev, res); | 1668 | nand_chip->IO_ADDR_R = devm_ioremap_resource(&pdev->dev, res); |
@@ -1692,6 +1691,11 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1692 | nand_chip->chip_delay = 50; | 1691 | nand_chip->chip_delay = 50; |
1693 | } | 1692 | } |
1694 | 1693 | ||
1694 | if (pdata->flash_bbt) | ||
1695 | nand_chip->bbt_options |= NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB; | ||
1696 | else | ||
1697 | nand_chip->options |= NAND_SKIP_BBTSCAN; | ||
1698 | |||
1695 | /* scan NAND device connected to chip controller */ | 1699 | /* scan NAND device connected to chip controller */ |
1696 | nand_chip->options |= pdata->devsize & NAND_BUSWIDTH_16; | 1700 | nand_chip->options |= pdata->devsize & NAND_BUSWIDTH_16; |
1697 | if (nand_scan_ident(mtd, 1, NULL)) { | 1701 | if (nand_scan_ident(mtd, 1, NULL)) { |