Can ID the NAND chip, but every erase block is bad?
Guys:
I have a platform with an ancient Linux kernel that I'm updating, and I'm having some problems. The platform has a Freescale MPC5200, a Samsung K9 NAND flash chip, and it all works fine under 2.6.20, I'm trying to bring it up to 2.6.32.
Simply put, when I register the gen_nand device for this chip under 2.6.32, it successfully identifies the chip but then says that every single eraseblock in the chip is bad. When I reboot to the 2.6.20 kernel, I don't get any complaints there. I see the same problem both with and without CONFIG_MTD_NAND_ECC_SMC.
Anyone have any ideas on where I should look for the problem? Thanks!
b.g.
Signature · 4 lines
Bill Gatliff Embedded systems training and consulting http://billgatliff.com [email protected]
Quoted 6 lines · Bill Gatliff
I have a platform with an ancient Linux kernel that I'm updating, and I'm having some problems. The platform has a Freescale MPC5200, a Samsung K9 NAND flash chip, and it all works fine under 2.6.20, I'm trying to bring it up to 2.6.32.
Quoted 7 lines
Simply put, when I register the
gen_nanddevice for this chip under 2.6.32, it successfully identifies the chip but then says that every single eraseblock in the chip is bad. When I reboot to the 2.6.20 kernel, I don't get any complaints there. I see the same problem both with and withoutCONFIG_MTD_NAND_ECC_SMC.Anyone have any ideas on where I should look for the problem? Thanks!
Take a closer look at how bad blocks were detected under 2.6.20.
A virgin chip will use a certain byte in the spare area of each eraseblock to mark that block as bad. But often we reclaim those bytes and transcribe the information into a bad block table elsewhere on the flash.
Booting a kernel which ignores the bad block table and looks for the bad block markers in the original location will have fairly much the effect you describe.
Signature · 2 lines
David Woodhouse Open Source Technology Centre [email protected] Intel Corporation
Quoted 11 lines · David Woodhouse
Take a closer look at how bad blocks were detected under 2.6.20.
A virgin chip will use a certain byte in the spare area of each eraseblock to mark that block as bad. But often we reclaim those bytes and transcribe the information into a bad block table elsewhere on the flash.
Booting a kernel which ignores the bad block table and looks for the bad block markers in the original location will have fairly much the effect you describe.
Ok, I'll take a look into that code.
Is there any way to instruct MTD to discard any previous bad block information, and reconstruct the bad block table from scratch?
b.g.
Signature · 4 lines
Bill Gatliff Embedded systems training and consulting http://billgatliff.com [email protected]
Quoted 3 lines
Is there any way to instruct MTD to discard any previous bad block information, and reconstruct the bad block table from scratch?
You can use the config option that leaves the bad block markers alone in the oob and have linux quickly build the bad block table in RAM on bootup instead of flash. I think that it's risky to corrupt the bad block markers in the oob of the bad block itself since a single accidental erasure can lose _all_ the bad block markers in one fell swoop and they can't be reconstructed without detailed knowledge of the factory testing algorithms and environmental test parameters. You could possibly have redundant blocks for bad block tables in flash to handle this. If you need more space for strong bch/reed solomon ecc bytes, you can truncate the 8 byte cleanmarker down to a byte or two using a custom oob layout map, and the multi-byte ecc can skip over the bad block marker.
Darwin
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 6 lines · Bill Gatliff
Ok, I'll take a look into that code.
Is there any way to instruct MTD to discard any previous bad block information, and reconstruct the bad block table from scratch?
In general, it's not possible to reconstruct the bad block table from scratch. Don't lose the previous bad block table. That's why we generally write two copies of it...
Signature · 2 lines
David Woodhouse Open Source Technology Centre [email protected] Intel Corporation
Quoted 2 lines · David Woodhouse
Take a closer look at how bad blocks were detected under 2.6.20.
Found the problem.
I hacked the code to show me the bytes as they were being read from the flash, and they were significantly different with my 2.6.32 kernel--- all zeros, in fact. That led me to a bug in my cmd_ctrl code: I was bailing out if the command was CMD_NONE, before writing anything to the flash. That causes some important bytes to get dropped, apparently. :)
Thanks!
b.g.
Signature · 4 lines
Bill Gatliff Embedded systems training and consulting http://billgatliff.com [email protected]