[U-Boot-Users] Re: Patch s3c2410 nand-boot.

Dear Gianluca,
in message 3F68D1DF.7020007@libero.it you wrote:
I send you my patch for s3c2410 ARM processor. This patch implements boot directly from nandflash. I haven't created new board in board directory but I have writed new config-file (smdk2410nand.h) that use smdk2410 board.
I have forwarded your patch to David Müller who is the maintainer for the SMDK2410 board; I cannot test it myself.
I tested with MAKEALL ARM9 my patch. I changed the frequency of internal clock of s3c2410 (for smdk2410 borad) because (only) in this way the Linux Mizi kernel can boot correctly. The patch is based on u-boot 0.4.8.
This is my first contribution to open source and I hope that it is useful to someone.
It is definitely useful, but I have a couple of questions:
* Which problem are you trying to address which is not supported by the existing NAND code?
* Is it necessary to implement this in a processor specific way?
* You add new configuration options like CONFIG_S3C2410_NAND_BOOT but do not include any dosumentation. At least, please provide an explantion of these options for the README fie. If you feel longer explanations are needed create a new file doc/README.NAND-Boot or so.
David, I've forwarded the patch to you. Can you please have a look at the implementation details? Thanks.
Best regards,
Wolfgang Denk

Wolfgang Denk wrote:
Dear Gianluca,
in message 3F68D1DF.7020007@libero.it you wrote:
I send you my patch for s3c2410 ARM processor. This patch implements boot directly from nandflash. I haven't created new board in board directory but I have writed new config-file (smdk2410nand.h) that use smdk2410 board.
I have forwarded your patch to David Müller who is the maintainer for the SMDK2410 board; I cannot test it myself.
I tested with MAKEALL ARM9 my patch. I changed the frequency of internal clock of s3c2410 (for smdk2410 borad) because (only) in this way the Linux Mizi kernel can boot correctly. The patch is based on u-boot 0.4.8.
This is my first contribution to open source and I hope that it is useful to someone.
It is definitely useful, but I have a couple of questions:
- Which problem are you trying to address which is not supported by the existing NAND code?
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;".
- Is it necessary to implement this in a processor specific way?
The boot from nand (without flash) is specific of s3c2410 cpu and so I rewrite some part of cpu/arm920t/start.S (reset and copy from nand to ram).
- You add new configuration options like CONFIG_S3C2410_NAND_BOOT but do not include any dosumentation. At least, please provide an explantion of these options for the README fie. If you feel longer explanations are needed create a new file doc/README.NAND-Boot or so.
I have forgot! When you want boot from nand-flash and not from frash you have to define CONFIG_S3C2410_NAND_BOOT in your conifg file. This define is independent to u-boot NAND support.
David, I've forwarded the patch to you. Can you please have a look at the implementation details? Thanks.
Best regards,
Wolfgang Denk
Bye Ginaluca

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

Hello,
in message 3F6AD744.1030107@elsoft.ch you wrote:
So a multi stage boot process has to be implemented. After reset,
I agree.
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
In my opinion, such a "primary boot loader" should be completely independend of U-Boot, i. e. you shouldbe able to use it to load any other boot loader as well, and the U-Boot code itself should only need minimal adjustment.
Best regards,
Wolfgang Denk

Wolfgang wrote:
In my opinion, such a "primary boot loader" should be completely independend of U-Boot, i. e. you shouldbe able to use it to load any other boot loader as well, and the U-Boot code itself should only need minimal adjustment.
Samsung has such a solution (ADAM) available from the s3c2410 page. The direct link is below. (sorry about any line wrapping)
http://www.samsung.com/Products/Semiconductor/SystemLSI/MobileSolutions/ MobileASSP/MobileComputing/S3C2410X/2410loadGNU.tar
I now have a question for the U-boot team. I have been unsuccessful in compiling the U-boot code for the smdk2410 with the nand command enabled. I am successful in compiling, writing U-boot to NOR flash and loading and running linux via tftp and bootm.
My attempts at getting nand support have included the following:
- Simply un-commenting CFG_CMD_NAND in include/configs/smdk2410.h. This resulted in compile error -- CFG_MAX_NAND_DEVICE, NAND_ChipID_UNKNOWN, etc.. all undeclared
- Copy and Paste code from the VCMA9 board, and config in order to alleviate compile errors. I won't claim to know why what I was copying was working, only that I was able to compile with nand support and get a print out of the nand size, etc. from the nand command.
For the question. Is U-boot presently able to take an image from NAND flash and load it into RAM? What is the status of this functionality on the SMDK2410 evaluation board? What am I missing?
Oh, and thanks for a fun tool!
-- Matt Matoushek
Invocon, Inc. www.invocon.com 281-292-9903 mmatoushek@invocon.com
participants (4)
-
"David Müller (ELSOFT AG)"
-
Gianluca
-
Matt Matoushek
-
Wolfgang Denk