[U-Boot] PATCH: bugfix for nand erase failure with bad blocks

Wolfgang Denk
2009-06-17T09:18:09Z

Dear Scott,

In message <4A37FE47.3030203@freescale.com> you wrote:
>
> > I see - thanks for the explanation.
> >
> > Hm... actually I think the write should fail in such a case...
> >
> > Scott, what do you think?
>
> I think the current behavior is reasonable. You're erasing a specific
> region of flash, not an amount needed to hold a certain amount of data.
>
> While I can see the appeal of Michele's suggestion, I think it would be
> more error-prone as people trying to erase a region rather than just the
> size of data could erase too much.

That was my initial thought, too, which is why I asked Michele for an
explanation.

when I think about typiical use cases like automatic uypdate script
similar to:

=> tftp 200000 filename
=> nand erase 0 +${filesize}
=> nand write 200000 0 ${filesize}

I (and probably any other user) will expect that the "erase" and
"nand write" commands use the same interpretation for the size
argument, i. e. that and "erase" followed by a "write" will have made
sufficient room to write all data.

Thus I reconsidered and think the patch is actually reasonable, as it
does what is the most practical use case needs.

> It definitely should not be an error to erase a region that happens to
> contain a bad block. Bad blocks are expected and we need to work around
> them.

Agreed.

But it should be an error when writing to not erase flash blocks.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"...this does not mean that some of us should not want, in a rather
dispassionate sort of way, to put a bullet through csh's head."
- Larry Wall in <1992Aug6.221512.5963@netlabs.com>