From mboxrd@z Thu Jan 1 00:00:00 1970 From: Frank Young Date: Thu, 13 May 2004 19:12:21 -0400 Subject: [U-Boot-Users] A question about sdram_init Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de >In message 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? 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 >didn't > > 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 it. > > 2. If the 1st line is commented, i.e. not disable everything, sdram() >could > > 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); return; } 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 >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. 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? Thanks! Frank _________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar ? get it now! http://toolbar.msn.com/go/onm00200415ave/direct/01/