#ifndef CONFIG_AT91RM9200
#ifndef CONFIG_SKIP_RELOCATE_UBOOT relocate: /* relocate U-Boot to RAM */ adr r0, _start /* r0 <- current position of code */ ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ cmp r0, r1 /* don't reloc during debug */ beq stack_setup
ldr r2, _armboot_start ldr r3, _bss_start sub r2, r3, r2 /* r2 <- size of armboot */ add r2, r0, r2 /* r2 <- source end address */
copy_loop: ldmia {r3-r10} /* copy from source address [r0] */ stmia {r3-r10} /* copy to target address [r1] */ cmp r0, r2 /* until source end addreee [r2] */ ble copy_loop #endif /* CONFIG_SKIP_RELOCATE_UBOOT */ #endif
//下面添加对 Nand Flash的支持,下面的这段代码主要实现的功能就把,4kb以后的程序可以复制的RAM中,调用了用C语言写的函数nand_read_ll(),128MB的NandFlash的读命令和64MB小页的读操作有所不同,必须还要发送一个0x30,的指令,在发送完地址指令后 #define NAND_CTL_BASE 0x4e000000 #ifdef CONFIG_S3C2440_NAND_BOOT @reset NAND #define oNFCONF 0x00 #define oNFCONT 0x04 #define oNFSTAT 0x08 #define oNFCMD 0x20 mov r1,#NAND_CTL_BASE ldr r2,=( (7<<12)|(7<<8)|(7<<4)|(0<<0)) str r2,[r1,#oNFCONF] ldr r2,[r1,#oNFCONF]
ldr r2,=((1<<4)|(0<<1)|(1<<0)) str r2,[r1,#oNFCONT] ldr r2,[r1,#oNFCONT]
ldr r2,=(0x6) str r2,[r1,#oNFSTAT] ldr r2,[r1,#oNFSTAT]
mov r2,#0xff strb r2,[r1,#oNFCMD] mov r3,#0 nand1: add r3,r3,#0x1 cmp r3,#0xa blt nand1 nand2: ldr r2,[r1,#oNFSTAT] tst r2,#0x4 beq nand2
ldr r2,[r1,#oNFCONT] orr r2,r2,#0x2 str r2,[r1,#oNFCONT] @get read to call C functions (for nand_read()) ldr sp,DW_STACK_START mov fp,#0 @copy U-Boot to Ram ldr r0,=TEXT_BASE mov r1,#0x0 mov r2,#0x60000 bl nand_read_ll tst r0,#0x0 beq ok_nand_read bad_nand_read: loop2: b loop2 ok_nand_read: @verify mov r0,#0 ldr r1,=TEXT_BASE mov r2,#0x400 go_next: ldr r3,[r0],#4 ldr r4,[r1],#4 teq r3,r4 bne notmatch subs r2,r2,#4 beq stack_setup bne go_next notmatch: loop3: b loop3 @CONFIG_S3C2440_NAND_BOOT #endif //添加结束
|