[U-Boot-Users] A question about sdram_init

To explain the problem easier, I stripped down the sdram_init() to three DCR instructions:
void sdram(void) { /*1st*/ mtsdram0(mem_mcopt1, 0x00000000); /*2nd*/ mtsdram0(mem_mb0cf, 0x00008001); /*3rd*/ mtsdram0(mem_mcopt1, 0x80800000); return; }
These three instructions is used to initialize 4MB sdram. But the phenomenon I had is: 1. The sdram() hanged after 2nd line, i.e. after set up 4MB. But it didn't go through 3rd line and didn't return. 2. If the 1st line is commented, i.e. not disable everything, sdram() could return. 3. Since sdram() is called from start.S, I rewrote all these code in start.S in assembly language and let them run in start.S (commented out "bl sdram_init"), these three lines can run without any problem. They didn't interfere each other.
So what could be a cause of this problem?
Thanks!
Frank
_________________________________________________________________ Express yourself with the new version of MSN Messenger! Download today - it's FREE! http://messenger.msn.com/go/onm00200471ave/direct/01/

In message BAY2-F150B8F0GuRQm600014934@hotmail.com you wrote:
To explain the problem easier, I stripped down the sdram_init() to three DCR instructions:
I guess this is on a MIPS64 system? Or ARM9? Or x86, or what?
- The sdram() hanged after 2nd line, i.e. after set up 4MB. But it didn't
go through 3rd line and didn't return.
How did you know where it hangs? Did you use a debugger?
- If the 1st line is commented, i.e. not disable everything, sdram() could
return.
How do you know your code is correct?
- Since sdram() is called from start.S, I rewrote all these code in start.S
in assembly language and let them run in start.S (commented out "bl sdram_init"), these three lines can run without any problem. They didn't interfere each other.
There is no difference between C code and assembly - unless you wrote different code.
Best regards,
Wolfgang Denk
participants (2)
-
Frank Young
-
Wolfgang Denk