linux equivalent of u-boot's "nand scrub" (erasing blocks even when OOB says "bad")

Mike Frysinger vapier.adi at gmail.com
Fri Sep 10 19:53:22 EDT 2010


ive come across a situation where it would have been invaluable to
have the ability to "scrub" the nand flash while running linux.
unfortunately, while i can see options to mark blocks as bad, there
doesnt appear to be any ioctls to mark blocks as good.  this applies
both to the userspace api as well as the kernel api.

further, it seems like if (for whatever reason)  the bad block marker
in the oob region got screwed, there is absolutely no way to recover
(when not using a dedicated bbt).  in
drivers/mtd/nand/nand_base.c:nand_erase_nand(), the very first thing
it does is call nand_block_checkbad().  without a bbt, it'll tail into
chip->block_bad and the default nand_block_bad() reads the bad block
marker out of the oob.  but if the oob region has been screwed, the
block will be thought of as bad, and so you're stuck in a loop.  you
cant reset the oob to 0xff because the oob isnt 0xff ...

the logical thing in my mind would be to extend the userspace mtd abi
to allow a "do the erase even if people think it's bad" option.
perhaps MEMSCRUB ?
-mike



More information about the linux-mtd mailing list