[U-Boot-Users] A question about sdram_init

Frank Young young726 at hotmail.com
Fri May 14 01:12:21 CEST 2004

>In message <BAY2-F150B8F0GuRQm600014934 at hotmail.com> you wrote:
> > To explain the problem easier, I stripped down the sdram_init() to three 
> > instructions:
>I guess this is on a MIPS64 system? Or ARM9? Or x86, or what?

I am using PPC405 on a custom board, similiar as WALNUT.

> > 1. The sdram() hanged after 2nd line, i.e. after set up 4MB. But it 
> > go through 3rd line and didn't return.
>How did you know where it hangs? Did you use a debugger?

I don't have a debugger. But I do have LEDs on the board, so I simply use 
LEDs to indicate where the program stops. I turn on a yellow LED right 
before the 2nd line and a green LED right after the 2nd line. Yellow LED was 
turned on but nothing happened to green one.

I am using IOC to control LED. The code to control LED is pretty simple. For 
example, to turn on yellow LED:
lis 20, 0xF0000030 at h
ori 20, 20, 0xF0000030 at l
li21, 0xC0
stb 21, 0(20)

I have been using this LED control for a while. Never got any problem with 

> > 2. If the 1st line is commented, i.e. not disable everything, sdram() 
> > return.
>How do you know your code is correct?

I didn't write any code. All these three lines were in original 
sdram_init(). Original sdram_init() tried to detect sdram with different 
size. I have 8MB SDRAM on my board, so I just eliminated all the code for 
128M, 64M, ..., but keep the code for 4M SDRAM. The codes left only have 
three lines:
void sdram(void) {
/*1st*/ mtsdram0(mem_mcopt1, 0x00000000);
/*2nd*/ mtsdram0(mem_mb0cf, 0x00008001);
/*3rd*/ mtsdram0(mem_mcopt1, 0x80800000);

BTW, I commented out udelay(200). But I don't think it will have any affect.

> > 3. Since sdram() is called from start.S, I rewrote all these code in 
> > 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.

That is why I am confused... ;*(

My doubt is the first line:
/*1st*/ mtsdram0(mem_mcopt1, 0x00000000);

It disabled the memory controller. Will this cause any memory problem?


FREE pop-up blocking with the new MSN Toolbar – get it now! 

More information about the U-Boot mailing list