[PATCH v3] mtd: nand: add option to erase NAND blocks even if detected as bad.

Richard Weinberger richard at nod.at
Mon May 15 02:23:55 PDT 2017


Boris,

Am 15.05.2017 um 10:21 schrieb Boris Brezillon:
 > #ifndef statements should be at the beginning of the line. But anyway,
> I think we all agree that always forcing bad block erasure is a bad
> idea. If we accept to support this feature, this should be done through
> a per-NAND-chip debugfs entry, with fine grained selection of the block
> that we're allowing to be forcibly erased.
> 
> Here is a suggestion:
> 
> echo all > /sys/kernel/debug/nand/<nand-chip-name>/erase-bad-blocks
> echo none > /sys/kernel/debug/nand/<nand-chip-name>/erase-bad-blocks
> echo X,Y-Z,... > /sys/kernel/debug/nand/<nand-chip-name>/erase-bad-blocks
> 
> where X is an eraseblock number, and X-Y is a range of eraseblocks.

Will a write to that file trigger the erase or just allow it?

IMHO we can keept it simple such as:
echo y > /sys/kernel/debug/nand/<nand-chip-name>/allow-bad-block-erase

Then a user can erase whatever he wants...

> BTW, maybe we should create and expose a top-level mtd debugfs directory
> to avoid exposing MTD related things at the root of the debugfs FS.
> 
> Something like:
> 
> /sys/kernel/debug/mtd/<dev-type>/...
> 
> so for the NAND related bits it would be
> 
> /sys/kernel/debug/mtd/nand/...

Yes, this makes sense to me.

And since this is debugfs we can do what we want.

Thanks,
//richard



More information about the linux-mtd mailing list