Patch for NAND Booting on SMDK2410
Hi folks,
here is a patch to enable U-Boot 1.0 to boot from NAND/SmartMedia cards. smdk2410.h must include the line '#define CONFIG_BOOT_NAND 1" and the resulting u-boot.bin must be copied to the first SmartMedia sectors (with a JTAG tool for example). The first sector of the SmartMedia card should also be marked as "Defect". With J33 and J34 closed the board should then boot from SmartMedia.
This first version is very simple as U-Boot is linear on the SmartMedia and don't allows a filesystem. Later version may include placing U-Boot on a filesystem.
This patch also includes code for clearing the BSS segment. This is not the same code Larsen submitted this morning :-(
Bye,
Signature · 11 lines
Markus Pietrek FS Forth-Systeme GmbH Phone: +49 (7667) 908 145, FAX +49 (7667) 908 221 -------------- next part -------------- A non-text attachment was scrubbed... Name: patch.gz Type: application/x-gzip Size: 1525 bytes Desc: not available Url : http://lists.denx.de/pipermail/u-boot/attachments/20040109/c909c88d/attachment.bin
Howdy Markus,
I've taken a look at your patch and board/smdk2410/nandboot.S appears to be missing. Was it your intention to add this file, have I missed something from earlier on in the list, or will I need to create this myself?
Thanks.
--
Matt Matoushek
-----Original Message-----
From: [email protected] [mailto:u-boot-users-admin at lists.sourceforge.net] On Behalf Of Markus Pietrek
Sent: Friday, January 09, 2004 8:18 AM
To: u-boot-users at lists.sourceforge.net
Cc: David M?ller (ELSOFT AG)
Subject: [U-Boot-Users] Patch for NAND Booting on SMDK2410
Hi folks,
here is a patch to enable U-Boot 1.0 to boot from NAND/SmartMedia cards.
smdk2410.h must include the line '#define CONFIG_BOOT_NAND 1" and the resulting u-boot.bin must be copied to the first SmartMedia sectors (with a
JTAG tool for example). The first sector of the SmartMedia card should also
be marked as "Defect". With J33 and J34 closed the board should then boot
from SmartMedia.
This first version is very simple as U-Boot is linear on the SmartMedia and
don't allows a filesystem. Later version may include placing U-Boot on a
filesystem.
This patch also includes code for clearing the BSS segment. This is not the
same code Larsen submitted this morning :-(
Bye,
Signature · 3 lines
Markus Pietrek FS Forth-Systeme GmbH Phone: +49 (7667) 908 145, FAX +49 (7667) 908 221
Hi,
Quoted 4 lines
I've taken a look at your patch and
board/smdk2410/nandboot.Sappears to be missing. Was it your intention to add this file, have I missed something from earlier on in the list, or will I need to create this myself?
Oops, sorry. As this file didn't exist originally, my "cvs diff -c -D" must have skipped this file. Here it is.
Bye,
Signature · 148 lines
Markus Pietrek FS Forth-Systeme GmbH Phone: +49 (7667) 908 145, FAX +49 (7667) 908 221 -------------- next part -------------- /*********************************************************************** * * Copyright (C) 2003 by FS Forth-Systeme GmbH. * All rights reserved. * * @Author: Markus Pietrek * @Descr: Supports only 512 bytes media with no bad-block management * @References: [1] S3C2410X User's Manual Rev. 1 * [2] Toshiba's NAND Flash Applications Design Guide Rev. 1.0 * [3] vivi/arch/s3c2420/head.S, Rev. 1.18 (initialization) * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ #include <config.h> #ifdef CONFIG_BOOT_NAND .globl _nandboot /*********************************************************************** * @Function: _nandboot (unsigned int unStartBlock, * unsigned int* punDest, unsigned int unLength) * @Return: always, no error handling * @Descr: copies blocks from NAND to RAM (punDest) until unLength data has been * read. unStartBlock ***********************************************************************/ #define rNF_BASE (0x4e000000) #define oNF_CONF (0x00) #define oNF_CMD (0x04) #define oNF_ADDR (0x08) #define oNF_DATA (0x0c) #define oNF_STAT (0x10) #define oNF_ECC (0x14) #define vNF_CONF_RESET (0xf830) /* NAND Controller enable, enable chip, TWRPH0 = 3 */ _nandboot: ldr r6, =0x200 @ page size mov r3, #rNF_BASE @ reset NAND Controller ldr r4, =vNF_CONF_RESET str r4, [r3, #oNF_CONF] ldr r4, [r3, #oNF_CONF] bic r4, r4, #0x800 @ enable chip str r4, [r3, #oNF_CONF] mov r4, #0xff @ send reset to NAND strb r4, [r3, #oNF_CMD] mov r4, #0 @ wait 1: add r4, r4, #0x1 cmp r4, #0xa blt 1b 2: ldr r4, [r3, #oNF_STAT] @ wait ready tst r4, #0x1 beq 2b ldr r4, [r3, #oNF_CONF] orr r4, r4, #0x800 @ disable chip str r4, [r3, #oNF_CONF] _nandboot_read_page: @ read one page ldr r4, [r3, #oNF_CONF] bic r4, r4, #0x800 @ enable chip str r4, [r3, #oNF_CONF] mov r4, #0 @ wait 4: add r4, r4, #0x1 cmp r4, #0xa blt 4b mov r4, #0x0 @ READ0 strb r4, [r3, #oNF_CMD] mov r4, r0 @ ADDR strb r4, [r3, #oNF_ADDR] mov r4, r4, lsr #9 strb r4, [r3, #oNF_ADDR] mov r4, r4, lsr #9 strb r4, [r3, #oNF_ADDR] mov r4, r4, lsr #9 strb r4, [r3, #oNF_ADDR] 5: ldr r4, [r3, #oNF_STAT] @ wait idle tst r4, #0x1 beq 5b @ copy at max 512 bytes @ r2 is number of bytes overall left after this copy @ r5 is number in page left cmp r2, r6 subge r2, r2, r6 movge r5, r6 movlt r5, r2 movlt r2, #0 _nandboot_page_copy_to_mem: @ copy page to memory cmp r5, #0 beq 7f sub r5, r5, #1 ldrb r4, [r3, #oNF_DATA] strb r4, [r1], #1 b _nandboot_page_copy_to_mem 7: ldr r4, [r3, #oNF_CONF] orr r4, r4, #0x800 @ disable chip str r4, [r3, #oNF_CONF] cmp r2, #0 addne r0, r0, r6 @ select next page bne _nandboot_read_page @ finished, all bytes read mov r4, #0 str r4, [r3, #oNF_CONF] @ disable NAND Controller mov pc, lr #endif /* CONFIG_BOOT_NAND */
Howdy Markus and u-boot users,
Quoted 2 lines
Oops, sorry. As this file didn't exist originally, my "cvs diff -c -D" must have skipped this file. Here it is.
Thanks. That helps. Now I'm curious as to how you are using this new functionality. I am developing a platform based on the s3c2410 and have been using U-boot (booting from NOR) as a development boot-loader since I can easily tftp new code, file systems, etc.
For production use I have intended on using a modification of the ADAM boot-loader provided by Samsung, mainly because CFG_CMD_NAND isn't implemented yet in U-boot for the smdk2410. The NAND boot patch gives me a potential alternative.
Am I correct about status of CFG_CMD_NAND for u-boot and the smdk2410? If I am correct, is there anyone out there working on this? If so, would you like any help with that development?
--
Matt Matoushek
Invocon, Inc.
www.invocon.com
281-292-9903
mmatoushek at invocon.com
Hi Matt,
Quoted 4 lines
Thanks. That helps. Now I'm curious as to how you are using this new functionality. I am developing a platform based on the s3c2410 and have been using U-boot (booting from NOR) as a development boot-loader since I can easily tftp new code, file systems, etc.
We are also developing a board based on the s3c2410 but intended to use only NAND flash. With this patch I demonstrated that we are able to boot from it. But I haven't started yet to port cmd_nand.c to the s3c2410 hardware nand support feature. This will come up in about two months again.
cmd_nand.c though needs to be rewritten, mainly the commands NanD_Command, NaND_Address, nand_write_ecc, nand_read_oob etc.
Bye,
Signature · 3 lines
Markus Pietrek FS Forth-Systeme GmbH Phone: +49 (7667) 908 145, FAX +49 (7667) 908 221
Dear Markus,
Quoted 8 lines · in message <[email protected]> you wrote:
here is a patch to enable U-Boot 1.0 to boot from NAND/SmartMedia cards.
smdk2410.hmust include the line '#defineCONFIG_BOOT_NAND1" and the resulting u-boot.bin must be copied to the first SmartMedia sectors (with a JTAG tool for example). The first sector of the SmartMedia card should also be marked as "Defect". With J33 and J34 closed the board should then boot from SmartMedia.
Quoted 6 lines
This first version is very simple as U-Boot is linear on the SmartMedia and don't allows a filesystem. Later version may include placing U-Boot on a filesystem.
This patch also includes code for clearing the BSS segment. This is not the same code Larsen submitted this morning :-(
Can you please re-submit your patch after syncing against the CVS tree? I checked in Anders Larsens patch, which broke yours. Please make sure to include nandboot.S in the new patch.
Thanks a lot.
Best regards,
Wolfgang Denk
Signature · 4 lines
See us @ Embedded World, Nuremberg, Feb 17 - 19, Hall 12.0 Booth 440 Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de Many Myths are based on truth -- Spock, "The Way to Eden", stardate 5832.3