
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