diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-10-26 12:42:00 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-10-26 13:06:02 +0100 |
commit | a968fad1cda0d6ba338b945bdaad5bfb87e7070d (patch) | |
tree | fcd62f12759b494976d574696083230f720ae177 | |
parent | 422fbc0a2821c30e6f826f92b7d128f566373a62 (diff) | |
download | barebox-a968fad1cda0d6ba338b945bdaad5bfb87e7070d.tar.gz barebox-a968fad1cda0d6ba338b945bdaad5bfb87e7070d.tar.xz |
imx_nand: allow flash based bbt
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/nand/nand_imx.c | 35 | ||||
-rw-r--r-- | include/asm-arm/arch-imx/imx-nand.h | 5 |
2 files changed, 37 insertions, 3 deletions
diff --git a/drivers/nand/nand_imx.c b/drivers/nand/nand_imx.c index 8ad56dd292..3d52a1a15c 100644 --- a/drivers/nand/nand_imx.c +++ b/drivers/nand/nand_imx.c @@ -771,6 +771,34 @@ static void imx_low_erase(struct mtd_info *mtd) } #endif + +/* + * The generic flash bbt decriptors overlap with our ecc + * hardware, so define some i.MX specific ones. + */ +static uint8_t bbt_pattern[] = { 'B', 'b', 't', '0' }; +static uint8_t mirror_pattern[] = { '1', 't', 'b', 'B' }; + +static struct nand_bbt_descr bbt_main_descr = { + .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE + | NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP, + .offs = 0, + .len = 4, + .veroffs = 4, + .maxblocks = 4, + .pattern = bbt_pattern, +}; + +static struct nand_bbt_descr bbt_mirror_descr = { + .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE + | NAND_BBT_2BIT | NAND_BBT_VERSION | NAND_BBT_PERCHIP, + .offs = 0, + .len = 4, + .veroffs = 4, + .maxblocks = 4, + .pattern = mirror_pattern, +}; + /* * This function is called during the driver binding process. * @@ -896,7 +924,12 @@ static int __init imxnd_probe(struct device_d *dev) this->ecc.layout = &nandv1_hw_eccoob_smallpage; } - this->options |= NAND_SKIP_BBTSCAN; + if (pdata->flash_bbt) { + this->bbt_td = &bbt_main_descr; + this->bbt_md = &bbt_mirror_descr; + /* update flash based bbt */ + this->options |= NAND_USE_FLASH_BBT; + } /* first scan to find the device and get the page size */ if (nand_scan_ident(mtd, 1)) { diff --git a/include/asm-arm/arch-imx/imx-nand.h b/include/asm-arm/arch-imx/imx-nand.h index 0e9d6510fa..3fdd8bf342 100644 --- a/include/asm-arm/arch-imx/imx-nand.h +++ b/include/asm-arm/arch-imx/imx-nand.h @@ -7,7 +7,8 @@ void imx_nand_load_image(void *dest, int size); struct imx_nand_platform_data { int width; - int hw_ecc; - }; + int hw_ecc:1; + int flash_bbt:1; +}; #endif /* __ASM_ARCH_NAND_H */ |