
Hello
Gianluca wrote:
I have changed NAND code only to remove warning beacuse I don't use some variable an then I rewrite "unsigned long nandptr = nand->IO_ADDR;" in "unsigned long nandptr; nandptr = nand->IO_ADDR;".
Wolfgang and I have agreed, that direct hardware accesses and board specific implementation details should be removed from "cmd_nand.c", but should be implemented in a cpu and / or board specific low level NAND flash driver instead.
Please take a look at the NAND part of the Linux MTD drivers to get an idea how it should work.
David, I've forwarded the patch to you. Can you please have a look at the implementation details? Thanks.
I'm afraid that "bulletproof" booting from a NAND flash is not as simple as i may look at first. Please keep in mind that NAND flash are not 100% error free, but contain an arbitrary number of "bad blocks" (and new ones could appear during lifetime). Only the two first blocks of a NAND flash device are normally guarantied to be error free. Additionally the code which can be executed "directly" on the S3C24x0 when booting from a NAND flash is further limited to 4KB in size.
So a multi stage boot process has to be implemented. After reset, hardware loads a tiny piece of code from the first two blocks of the NAND flash. This code has to do:
- minimial initialisation of CPU - initialisation of SDRAM and NAND flash - copy rest of boot code (U-Boot) from NAND to SDRAM while taking care of bad blocks - jump to an appropriate place to give up control to rest of boot code
Dave