[U-Boot] [PATCH] - fix "nand erase clean" problem

Scott Wood scottwood at freescale.com
Tue Oct 28 17:55:32 CET 2008


On Tue, Oct 28, 2008 at 11:45:21AM +0100, Ilko Iliev wrote:
> > AFAICT, it does a read using MTD_OOB_AUTO, which can span multiple 
> > free segments.
> Yes, but the current U-BOOT uses MTD_OOB_PLACE and the command "nand 
> erase clean" marks all blocks as bad.

I'm not defending the current code.

> >>> What if oobsize > 64 (as with 4k pages)?  Why write anything at all if
> >>> you're not going to write the cleanmarker?  Why badblockpos & ~1 (I 
> >>> know
> >>> existing code does it, but why)?
> >>>   
> >> The current Linux NAND Flash driver supports 8, 16 and 64 bytes OOB.
> >
> > No need to add a place that will silently break if that changes, though.
> No, I think it will work also with OOB=128 bytes

Your patch as-is will write random data to the second half of a 128-byte
OOB if it doesn't have enough space in the first free segment for the
clean marker.

> >>>
> >> I think the NAND driver should work not only with MTD_OOB_AUTO.
> >
> > Explain?  MTD_OOB_AUTO is a feature of the NAND subsystem, which 
> > automatically places user OOB data in the free regions described by 
> > the low-level driver.  It's not some hardware feature that may or may 
> > not be present.
> At the moment U-BOOT doesn't use MTD_OOB_AUTO and the NAND flash can't 
> be erased with "nand erase clean".
> I think this bug should be corrected instead of to switch to MTD_OOB_AUTO.

I think the bug should be corrected *by* switching to MTD_OOB_AUTO.  What
do you have against it?

-Scott


More information about the U-Boot mailing list