📄 u-boot-2410-20060703.patch
字号:
@@ -1152,7 +1155,7 @@ data = (ulong)hdr + sizeof(image_header_t); len = ntohl(hdr->ih_size); - puts (" Verifying Checksum ... ");+ puts (" Verifying Checksum . "); if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) { puts (" Bad Data CRC\n"); }diff -Naur u-boot-20060523.org/common/cmd_nand.c u-boot/common/cmd_nand.c--- u-boot-20060523.org/common/cmd_nand.c 2006-03-12 09:00:48.000000000 +0800+++ u-boot/common/cmd_nand.c 2006-06-15 16:24:03.000000000 +0800@@ -10,7 +10,6 @@ #include <common.h> - #ifndef CFG_NAND_LEGACY /* *@@ -756,6 +755,9 @@ "loadAddr dev\n" ); +++ #endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */ #endif /* CFG_NAND_LEGACY */diff -Naur u-boot-20060523.org/common/env_nand.c u-boot/common/env_nand.c--- u-boot-20060523.org/common/env_nand.c 2006-05-04 00:02:27.000000000 +0800+++ u-boot/common/env_nand.c 2006-06-15 15:53:30.000000000 +0800@@ -32,7 +32,7 @@ #include <common.h> #if defined(CFG_ENV_IS_IN_NAND) /* Environment is in Nand Flash */-+//#include <s3c2410.h> #include <command.h> #include <environment.h> #include <linux/stddef.h>@@ -53,13 +53,17 @@ #error CONFIG_INFERNO not supported yet #endif -int nand_legacy_rw (struct nand_chip* nand, int cmd,+extern int nand_legacy_rw (struct nand_chip* nand, int cmd, size_t start, size_t len, size_t * retlen, u_char * buf);+extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE];+extern int nand_legacy_erase(struct nand_chip *nand, size_t ofs,+ size_t len, int clean); -/* info for NAND chips, defined in drivers/nand/nand.c */-extern nand_info_t nand_info[]; +/* info for NAND chips, defined in drivers/nand/nand.c */+//extern nand_info_t nand_info[];+nand_info_t nand_info[CFG_MAX_NAND_DEVICE]; /* references to names in env_common.c */ extern uchar default_environment[]; extern int default_environment_size;@@ -94,6 +98,8 @@ */ int env_init(void) {+// S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();+// gpio->GPFDAT = (gpio->GPFDAT & ~(0xf<<4))|((~(0x3) & 0xf)<<4); gd->env_addr = (ulong)&default_environment[0]; gd->env_valid = 1; @@ -146,12 +152,18 @@ int ret = 0; puts ("Erasing Nand...");- if (nand_erase(&nand_info[0], CFG_ENV_OFFSET, CFG_ENV_SIZE))+// if (nand_erase(&nand_info[0], CFG_ENV_OFFSET, CFG_ENV_SIZE))+ if (nand_legacy_erase(nand_dev_desc + 0, CFG_ENV_OFFSET, CFG_ENV_SIZE, 0))+ return 1; puts ("Writing to Nand... "); total = CFG_ENV_SIZE;- ret = nand_write(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);+// ret = nand_write(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);+ ret = nand_legacy_rw(nand_dev_desc + 0,+ 0x00 | 0x02, CFG_ENV_OFFSET, CFG_ENV_SIZE,+ &total, (u_char*)env_ptr);+ if (ret || total != CFG_ENV_SIZE) return 1; @@ -173,7 +185,6 @@ tmp_env1 = (env_t *) malloc(CFG_ENV_SIZE); tmp_env2 = (env_t *) malloc(CFG_ENV_SIZE);- nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*) tmp_env1); nand_read(&nand_info[0], CFG_ENV_OFFSET_REDUND, &total,@@ -226,7 +237,9 @@ int ret; total = CFG_ENV_SIZE;- ret = nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);+ //ret = nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);+ ret = nand_legacy_rw(nand_dev_desc + 0, 0x01 | 0x02, CFG_ENV_OFFSET, CFG_ENV_SIZE, &total, (u_char*)env_ptr);+ if (ret || total != CFG_ENV_SIZE) return use_default(); diff -Naur u-boot-20060523.org/config.mk u-boot/config.mk--- u-boot-20060523.org/config.mk 2006-05-17 20:34:47.000000000 +0800+++ u-boot/config.mk 2006-05-09 19:54:33.000000000 +0800@@ -143,15 +143,14 @@ endif endif -AFLAGS_DEBUG := -Wa,-gstabs- # turn jbsr into jsr for m68k ifeq ($(ARCH),m68k) ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4) AFLAGS_DEBUG := -Wa,-gstabs,-S endif+else+AFLAGS_DEBUG := -Wa,-gstabs endif- AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS) LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)diff -Naur u-boot-20060523.org/cpu/arm920t/s3c24x0/interrupts.c u-boot/cpu/arm920t/s3c24x0/interrupts.c--- u-boot-20060523.org/cpu/arm920t/s3c24x0/interrupts.c 2005-04-06 07:32:25.000000000 +0800+++ u-boot/cpu/arm920t/s3c24x0/interrupts.c 2006-05-24 08:27:59.000000000 +0800@@ -55,7 +55,7 @@ int interrupt_init (void) { S3C24X0_TIMERS * const timers = S3C24X0_GetBase_TIMERS();-+ S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO(); /* use PWM Timer 4 because it has no output */ /* prescaler for Timer 4 is 16 */ timers->TCFG0 = 0x0f00;@@ -76,6 +76,9 @@ timers->TCON = (timers->TCON & ~0x0700000) | 0x500000; timestamp = 0; + gpio->GPFDAT = (gpio->GPFDAT & ~(0xf<<4))|((~(0xe) & 0xf)<<4);+ + return (0); } diff -Naur u-boot-20060523.org/cpu/arm920t/s3c24x0/serial.c u-boot/cpu/arm920t/s3c24x0/serial.c--- u-boot-20060523.org/cpu/arm920t/s3c24x0/serial.c 2006-05-04 00:02:34.000000000 +0800+++ u-boot/cpu/arm920t/s3c24x0/serial.c 2006-05-22 10:30:05.000000000 +0800@@ -51,6 +51,8 @@ void serial_setbrg (void) { S3C24X0_UART * const uart = S3C24X0_GetBase_UART(UART_NR);++ int i; unsigned int reg = 0; @@ -82,8 +84,12 @@ */ int serial_init (void) {- serial_setbrg ();+ + S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();//hema + serial_setbrg ();+ gpio->GPFDAT = (gpio->GPFDAT & ~(0xf<<4))|((~(0x4) & 0xf)<<4);+ return (0); } diff -Naur u-boot-20060523.org/cpu/arm920t/start.S u-boot/cpu/arm920t/start.S--- u-boot-20060523.org/cpu/arm920t/start.S 2006-05-04 00:02:31.000000000 +0800+++ u-boot/cpu/arm920t/start.S 2006-06-26 10:51:11.000000000 +0800@@ -220,6 +220,20 @@ /* END stuff after relocation */ #endif +#ifdef CONFIG_S3C2410_NAND_BOOT+ bl copy_myself+ + @ jump to ram+ ldr r1, =on_the_ram+ add pc, r1, #0+ nop+ nop+1: b 1b @ infinite loop+ + on_the_ram:+#endif+ + ldr pc, _start_armboot _start_armboot: .word start_armboot@@ -236,6 +250,108 @@ ************************************************************************* */ +#ifdef CONFIG_S3C2410_NAND_BOOT+copy_myself:+ mov r10, lr+@ reset NAND+ mov r1, #NAND_CTL_BASE+ ldr r2, =0xf830 @ initial value+ str r2, [r1, #oNFCONF]+ ldr r2, [r1, #oNFCONF]+ bic r2, r2, #0x800 @ enable chip+ str r2, [r1, #oNFCONF]+ mov r2, #0xff @ RESET command+ strb r2, [r1, #oNFCMD]+ mov r3, #0 @ wait++1: add r3, r3, #0x1+ cmp r3, #0xa+ blt 1b+2: ldr r2, [r1, #oNFSTAT] @ wait ready+ tst r2, #0x1+ beq 2b+ ldr r2, [r1, #oNFCONF]+ orr r2, r2, #0x800 @ disable chip+ str r2, [r1, #oNFCONF]++ @ get read to call C functions (for nand_read())+ ldr sp, DW_STACK_START @ setup stack pointer+ mov fp, #0 @ no previous frame, so fp=0++@ copy vivi to RAM+ ldr r0, =UBOOT_RAM_BASE+ mov r1, #0x0+ mov r2, #0x30000+ bl nand_read_ll+ tst r0, #0x0+ beq ok_nand_read++#ifdef CONFIG_DEBUG_LL+ bad_nand_read:+ ldr r0, STR_FAIL+ ldr r1, SerBase+ bl PrintWord+1: b 1b @ infinite loop+#endif++ ok_nand_read:+#ifdef CONFIG_DEBUG_LL+ ldr r0, STR_OK+ ldr r1, SerBase+ bl PrintWord+#endif++@ verify+ mov r0, #0+ ldr r1, =UBOOT_RAM_BASE+ mov r2, #0x400 @ 4 bytes * 1024 = 4K-bytes+ go_next:+ ldr r3, [r0], #4+ ldr r4, [r1], #4+ teq r3, r4+ bne notmatch+ subs r2, r2, #4+ beq done_nand_read+ bne go_next++ notmatch:+#ifdef CONFIG_DEBUG_LL+ sub r0, r0, #4+ ldr r1, SerBase+ bl PrintHexWord+ ldr r0, STR_FAIL+ ldr r1, SerBase+ bl PrintWord+#endif+1: b 1b+ done_nand_read:+#ifdef CONFIG_DEBUG_LL+ ldr r0, STR_OK+ ldr r1, SerBase+ bl PrintWord+#endif+ mov pc, r10+@ clear memory+@ r0: start address+@ r1: length+ mem_clear:+ mov r2, #0+ mov r3, r2+ mov r4, r2+ mov r5, r2+ mov r6, r2+ mov r7, r2+ mov r8, r2+ mov r9, r2++clear_loop:+ stmia r0!, {r2-r9}+ subs r1, r1, #(8 * 4)+ bne clear_loop+ mov pc, lr++#endif @ CONFIG_S3C2410_NAND_BOOT+ #ifndef CONFIG_SKIP_LOWLEVEL_INIT cpu_init_crit:@@ -432,3 +548,8 @@ bl do_fiq #endif+#ifdef CONFIG_S3C2410_NAND_BOOT+ .align 2+ DW_STACK_START:+ .word STACK_BASE+STACK_SIZE-4+#endif diff -Naur u-boot-20060523.org/drivers/nand/nand_base.c u-boot/drivers/nand/nand_base.c--- u-boot-20060523.org/drivers/nand/nand_base.c 2006-05-04 00:08:26.000000000 +0800+++ u-boot/drivers/nand/nand_base.c 2006-06-16 12:44:39.000000000 +0800@@ -1124,17 +1124,14 @@ DEBUG (MTD_DEBUG_LEVEL3, "nand_read_ecc: from = 0x%08x, len = %i\n", (unsigned int) from, (int) len);- /* Do not allow reads past end of device */ if ((from + len) > mtd->size) { DEBUG (MTD_DEBUG_LEVEL0, "nand_read_ecc: Attempt read beyond end of device\n"); *retlen = 0; return -EINVAL; }- /* Grab the lock and see if the device is available */ nand_get_device (this, mtd ,FL_READING);- /* use userspace supplied oobinfo, if zero */ if (oobsel == NULL) oobsel = &mtd->oobinfo;@@ -1205,6 +1202,7 @@ oob_data = &this->data_buf[end]; eccsteps = this->eccsteps;+ puts("4 "); switch (eccmode) { case NAND_ECC_NONE: { /* No ECC, Read in a page */@@ -2269,6 +2267,7 @@ int i, j, nand_maf_id, nand_dev_id, busw; struct nand_chip *this = mtd->priv; + printk("nand_scan\n"); /* Get buswidth to select the correct functions*/ busw = this->options & NAND_BUSWIDTH_16; @@ -2307,16 +2306,20 @@ if (!this->scan_bbt) this->scan_bbt = nand_default_bbt; + /* Select the device */ this->select_chip(mtd, 0);+ /* Select the device */ /* Send the command for reading device ID */ this->cmdfunc (mtd, NAND_CMD_READID, 0x00, -1);+ /* Select the device */ /* Read manufacturer and device IDs */ nand_maf_id = this->read_byte(mtd); nand_dev_id = this->read_byte(mtd); + printk("%x %x",nand_dev_id, nand_maf_id); /* Print and store flash device information */ for (i = 0; nand_flash_ids[i].name != NULL; i++) { diff -Naur u-boot-20060523.org/drivers/nand/nand.c u-boot/drivers/nand/nand.c--- u-boot-20060523.org/drivers/nand/nand.c 2006-05-04 00:08:26.000000000 +0800+++ u-boot/drivers/nand/nand.c 2006-06-15 10:48:19.000000000 +0800@@ -26,7 +26,6 @@ #if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY) #include <nand.h>- #ifndef CFG_NAND_BASE_LIST #define CFG_NAND_BASE_LIST { CFG_NAND_BASE } #endif@@ -48,6 +47,7 @@ nand->IO_ADDR_R = nand->IO_ADDR_W = (void __iomem *)base_addr; board_nand_init(nand);+ printf("nand_init\n"); if (nand_scan(mtd, 1) == 0) { if (!mtd->name)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -