- 论坛徽章:
- 0
|
本帖最后由 windays 于 2014-06-07 15:16 编辑
如题,按照网上流行的uboot移植尝试nandflash启动,
于是将程序烧进nand后执行,采用点灯来观察代码进度,发现
代码一直停留在 while (!(NFSTAT & NFSTAT_BUSY))
无法继续进行。
请教各位大神,现在问题有可能出在什么地方
static inline void nand_wait(void)
{
int i;
light1_2_3(); //debug
while (!(NFSTAT & NFSTAT_BUSY))
for (i=0; i<10; i++);
light1_2_3_4();//debug
}
nandflash的初始化代码如下:
#define LENGTH_UBOOT 0x30000
#define NAND_CTL_BASE 0x4E000000
#ifdef CONFIG_S3C2440
/* offset */
#define oNFCONF 0x00
#define oNFCONT 0x04
#define oNFCMD 0x08
#define oNFSTAT 0x20
//reset NAND
// 1 configure the NFCONF register
mov r1,#NAND_CTL_BASE
ldr r2,=( (0<<12)|(4<< |(2<<4)|(0<<0))// bug
str r2,[r1,#oNFCONF]
ldr r2,[r1,#oNFCONF]
// 2 configure NFCONT register
ldr r2,=((0<<13) | (0<<12) | (0<<10) | (0<<9) | (0<< | (1<<6)|(1<<5)|(1<<4)|(1<<1)|(1<<0)) //active low CE Control
str r2,[r1,#oNFCONT]
ldr r2,[r1,#oNFCONT]
// 3 RnB clear
ldr r2, =0x6 //RnB Clear 0x6 i think it's 0x4
str r2,[r1,#oNFSTAT]
ldr r2,[r1,#oNFSTAT]
// 4 reset command
ldr r2,[r1,#oNFCONT]
and r2,r2,#0xfffffffd //Flash Memory Chip Enable
str r2,[r1,#oNFCONT]
mov r2,#0xff //reset command
strb r2,[r1,#oNFCMD]
ldr r2,[r1,#oNFCONT]
orr r2,r2,#0x2 //Flash Memory Chip Disable
str r2,[r1,#oNFCONT]
mov r3,#0 // wait
// software delay nand1
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 //Flash Memory Chip Disable
str r2,[r1,#oNFCONT]
//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 uboot to RAM
ldr r0,=TEXT_BASE
mov r1,#0
mov r2,#LENGTH_UBOOT
bl nand_read_ll
teq r0,#0x0 // source tst r0,#0x0 is wrong
beq ok_nand_read
// debug 1 open led 1_2
bl light1_2_3
|
|