
Dear Wolfgang,
On Fri, Jul 14, 2006 at 01:19:23PM +0200, Wolfgang Denk wrote:
In message 44B76ABA.3000607@fsforth.de you wrote:
/ # mtd_debug erase /dev/mtd/2 0x22f00000 0x3000000 nand_erase: attempt to erase a bad block at page 0x0004bf40 MEMERASE: Input/output error
That's the behaviour I would expect to see from looking at the code.
And what you will see in U-Boot, too - same code, same behaviour.
Indeed, but MTD code in U-Boot is invoked different way (that's my bad and I apologize for late reply). Most Linux users are probably using mtd-utils to deal with erasing NAND. flash_erase will issue MEMERASE ioctl directly and that will fail on attempt to erase bad block. However flash_eraseall will first ask for bad block using MEMGETBADBLOCK ioctl and eventually skip it, printing info message "Skipping bad block at 0x%08x" Average U-Boot user probably wants flash_eraseall behaviour...
I think, bad blocks should not prevent U-Boot from erasing a partition, which is needed to write an OS there, which needs to be booted.
I tend to agree here, which was the reason that I said I was willing to accept the patch, but that at least the printf() shoould be kept so that the user gets the warning.
So, it seems the only unanswered question is implementation. You can either accept second version of proposed patch or ask for different implementation which will be similar to flash_eraseall (ie. bad block checking done outside MTD code, so it can remain unmodified). Not being U-Boot maintainer I trade off decision :-)
Best regards, ladis