diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2008-06-27 15:04:13 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2008-07-11 13:16:16 -0400 |
commit | ec6e0ea3bdf82ee9761d324c011c3627821f7410 (patch) | |
tree | 0a8998044363d28177daab74eb2a1fc2e8898de1 | |
parent | 452db2724351ff3d9416a183a7955e00ab4e6ab4 (diff) |
[MTD] [NAND] fsl_elbc_nand: implement support for flash-based BBT
This patch implements support for flash-based BBT for chips working
through ELBC NAND controller, so that NAND core will not have to re-scan
for bad blocks on every boot.
Because ELBC controller may provide HW-generated ECCs we should adjust
bbt pattern and bbt version positions in the OOB free area.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r-- | drivers/mtd/nand/fsl_elbc_nand.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c index 99dc2be620a6..5f1bc5ea2a73 100644 --- a/drivers/mtd/nand/fsl_elbc_nand.c +++ b/drivers/mtd/nand/fsl_elbc_nand.c | |||
@@ -130,6 +130,34 @@ static struct nand_bbt_descr largepage_memorybased = { | |||
130 | .pattern = scan_ff_pattern, | 130 | .pattern = scan_ff_pattern, |
131 | }; | 131 | }; |
132 | 132 | ||
133 | /* | ||
134 | * ELBC may use HW ECC, so that OOB offsets, that NAND core uses for bbt, | ||
135 | * interfere with ECC positions, that's why we implement our own descriptors. | ||
136 | * OOB {11, 5}, works for both SP and LP chips, with ECCM = 1 and ECCM = 0. | ||
137 | */ | ||
138 | static u8 bbt_pattern[] = {'B', 'b', 't', '0' }; | ||
139 | static u8 mirror_pattern[] = {'1', 't', 'b', 'B' }; | ||
140 | |||
141 | static struct nand_bbt_descr bbt_main_descr = { | ||
142 | .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE | | ||
143 | NAND_BBT_2BIT | NAND_BBT_VERSION, | ||
144 | .offs = 11, | ||
145 | .len = 4, | ||
146 | .veroffs = 15, | ||
147 | .maxblocks = 4, | ||
148 | .pattern = bbt_pattern, | ||
149 | }; | ||
150 | |||
151 | static struct nand_bbt_descr bbt_mirror_descr = { | ||
152 | .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE | | ||
153 | NAND_BBT_2BIT | NAND_BBT_VERSION, | ||
154 | .offs = 11, | ||
155 | .len = 4, | ||
156 | .veroffs = 15, | ||
157 | .maxblocks = 4, | ||
158 | .pattern = mirror_pattern, | ||
159 | }; | ||
160 | |||
133 | /*=================================*/ | 161 | /*=================================*/ |
134 | 162 | ||
135 | /* | 163 | /* |
@@ -767,8 +795,12 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv) | |||
767 | chip->cmdfunc = fsl_elbc_cmdfunc; | 795 | chip->cmdfunc = fsl_elbc_cmdfunc; |
768 | chip->waitfunc = fsl_elbc_wait; | 796 | chip->waitfunc = fsl_elbc_wait; |
769 | 797 | ||
798 | chip->bbt_td = &bbt_main_descr; | ||
799 | chip->bbt_md = &bbt_mirror_descr; | ||
800 | |||
770 | /* set up nand options */ | 801 | /* set up nand options */ |
771 | chip->options = NAND_NO_READRDY | NAND_NO_AUTOINCR; | 802 | chip->options = NAND_NO_READRDY | NAND_NO_AUTOINCR | |
803 | NAND_USE_FLASH_BBT; | ||
772 | 804 | ||
773 | chip->controller = &ctrl->controller; | 805 | chip->controller = &ctrl->controller; |
774 | chip->priv = priv; | 806 | chip->priv = priv; |