[U-Boot-Users] What's the status on erasing a nand flash with bad blocks?

Hello list,
There was a discussion on how to handle the bad blocks when erasing entire nand flash few month ago. I was curious to know what you all decided on how to handle the issue.
Now I got a nand flash (Samsung) with 2 bad blocks and I can erase and program it from kernel using flash_eraseall and nandwrite just fine. However, from u-boot (I'm using a newer nand driver, btw) the erase stops at the first bad block, as you know.
I'm little hesitant to just fix the code to skip the bad blocks during erase/write since like it was discussed on the earlier thread, kernel's mtd driver do it that way as well...
Any comments/update on this issue will be very helpful!
Thanks.

Hi Mitsy,
On Thursday 05 October 2006 17:04, mitsy wrote:
There was a discussion on how to handle the bad blocks when erasing entire nand flash few month ago. I was curious to know what you all decided on how to handle the issue.
Now I got a nand flash (Samsung) with 2 bad blocks and I can erase and program it from kernel using flash_eraseall and nandwrite just fine. However, from u-boot (I'm using a newer nand driver, btw) the erase stops at the first bad block, as you know.
I'm little hesitant to just fix the code to skip the bad blocks during erase/write since like it was discussed on the earlier thread, kernel's mtd driver do it that way as well...
Any comments/update on this issue will be very helpful!
When I remember correctly, Wolfgang was a little hesitantly to accept any changes to this code, because it was taken directly from the Linux MTD code. But as Ladislav Michl (the original comitter of the new NAND code) stated, this is because the erase is normally done from the mtd-utils package:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/23621
I would suggest that we change the current U-Boot code, so that erasing doesn't stop at bad blocks anymore, but skips them and prints a message, like the linux flash_eraseall utility:
"Skipping bad block at 0x%08x"
Wolfgang: Would this be ok for you?
Mitsy: Are you willing to create a patch for this?
Best regards, Stefan

Hi,
It looks like Guido is working on a patch for this. I modified the code for myself to handle the bad blocks and it seem to work fine. I will wait for Guido's patch and compare with what I did.
Thank you Stefan and Guido!
On 10/6/06, Stefan Roese sr@denx.de wrote:
Hi Mitsy,
On Thursday 05 October 2006 17:04, mitsy wrote:
There was a discussion on how to handle the bad blocks when erasing entire nand flash few month ago. I was curious to know what you all decided on how to handle the issue.
Now I got a nand flash (Samsung) with 2 bad blocks and I can erase and program it from kernel using flash_eraseall and nandwrite just fine. However, from u-boot (I'm using a newer nand driver, btw) the erase stops at the first bad block, as you know.
I'm little hesitant to just fix the code to skip the bad blocks during erase/write since like it was discussed on the earlier thread, kernel's mtd driver do it that way as well...
Any comments/update on this issue will be very helpful!
When I remember correctly, Wolfgang was a little hesitantly to accept any changes to this code, because it was taken directly from the Linux MTD code. But as Ladislav Michl (the original comitter of the new NAND code) stated, this is because the erase is normally done from the mtd-utils package:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/23621
I would suggest that we change the current U-Boot code, so that erasing doesn't stop at bad blocks anymore, but skips them and prints a message, like the linux flash_eraseall utility:
"Skipping bad block at 0x%08x"
Wolfgang: Would this be ok for you?
Mitsy: Are you willing to create a patch for this?
Best regards, Stefan

It looks like Guido is working on a patch for this. I modified the code for myself to handle the bad blocks and it seem to work fine. I will wait for Guido's patch and compare with what I did.
Thank you Stefan and Guido!
I hope the patch is now arrived on the list. The mail was a little bit to large, so I must resent ist with gzipped attachment. I am waiting for your comments regarding the patch.
Guido

Stefan Roese wrote:
When I remember correctly, Wolfgang was a little hesitantly to accept any changes to this code, because it was taken directly from the Linux MTD code. But as Ladislav Michl (the original comitter of the new NAND code) stated, this is because the erase is normally done from the mtd-utils package:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/23621
I would suggest that we change the current U-Boot code, so that erasing doesn't stop at bad blocks anymore, but skips them and prints a message, like the linux flash_eraseall utility:
"Skipping bad block at 0x%08x"
Last time we discussed this on the list I suggested we only print a summary at the end instead of for each skipped block. Summary would state how many bad blocks skipped during operation in all. We have another command to list the bad blocks (AFAIK) if one is interested at all.
Best regards, Tolunay

Hi Tolunay,
On Friday 06 October 2006 17:11, Tolunay Orkun wrote:
I would suggest that we change the current U-Boot code, so that erasing doesn't stop at bad blocks anymore, but skips them and prints a message, like the linux flash_eraseall utility:
"Skipping bad block at 0x%08x"
Last time we discussed this on the list I suggested we only print a summary at the end instead of for each skipped block. Summary would state how many bad blocks skipped during operation in all. We have another command to list the bad blocks (AFAIK) if one is interested at all.
OK.
I'll try to take a deeper look into the patch from Guido this weekend. Looks promising.
Best regards, Stefan
participants (4)
-
Guido Classen
-
mitsy
-
Stefan Roese
-
Tolunay Orkun