aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-10-21 08:25:27 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2009-11-12 02:33:32 -0500
commitf1372055df21734f042f12ab92852e9d350be8d0 (patch)
treefd4ef8a4b6eeb14bdf4afbf021bf0db1c24fba64 /drivers/mtd/nand
parentf06368f7d15f6fc323ba0c71aec67b9b2dd5614a (diff)
mxc_nand: Allow flash based bbt
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/mxc_nand.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 2e3f3fbcd67c..044a57483027 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -648,6 +648,33 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
648 } 648 }
649} 649}
650 650
651/*
652 * The generic flash bbt decriptors overlap with our ecc
653 * hardware, so define some i.MX specific ones.
654 */
655static uint8_t bbt_pattern[] = { 'B', 'b', 't', '0' };
656static uint8_t mirror_pattern[] = { '1', 't', 'b', 'B' };
657
658static struct nand_bbt_descr bbt_main_descr = {
659 .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE
660 | NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP,
661 .offs = 0,
662 .len = 4,
663 .veroffs = 4,
664 .maxblocks = 4,
665 .pattern = bbt_pattern,
666};
667
668static struct nand_bbt_descr bbt_mirror_descr = {
669 .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE
670 | NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP,
671 .offs = 0,
672 .len = 4,
673 .veroffs = 4,
674 .maxblocks = 4,
675 .pattern = mirror_pattern,
676};
677
651static int __init mxcnd_probe(struct platform_device *pdev) 678static int __init mxcnd_probe(struct platform_device *pdev)
652{ 679{
653 struct nand_chip *this; 680 struct nand_chip *this;
@@ -786,6 +813,13 @@ static int __init mxcnd_probe(struct platform_device *pdev)
786 if (pdata->width == 2) 813 if (pdata->width == 2)
787 this->options |= NAND_BUSWIDTH_16; 814 this->options |= NAND_BUSWIDTH_16;
788 815
816 if (pdata->flash_bbt) {
817 this->bbt_td = &bbt_main_descr;
818 this->bbt_md = &bbt_mirror_descr;
819 /* update flash based bbt */
820 this->options |= NAND_USE_FLASH_BBT;
821 }
822
789 /* first scan to find the device and get the page size */ 823 /* first scan to find the device and get the page size */
790 if (nand_scan_ident(mtd, 1)) { 824 if (nand_scan_ident(mtd, 1)) {
791 err = -ENXIO; 825 err = -ENXIO;