public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: York Sun <yorksun@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Memory size detection on P1011
Date: Thu, 5 May 2011 21:29:28 +0800	[thread overview]
Message-ID: <1304602168.21927.16.camel@oslab-l1> (raw)
In-Reply-To: <4DC2A352.8080505@embedded-sol.com>

Felix,

On Thu, 2011-05-05 at 16:17 +0300, Felix Radensky wrote:
> Hi,
> 
> I'm working on a custom board based on P1011.
> There are 2 board flavours, with either 128MB or 256MB of soldered
> DDR2 SDRAM. Having u-boot image per board works fine, but I'd like
> to have a single image and use get_ram_size() to detect memory size
> at runtime. So far I had no luck.
> 
> The only significant difference between memory devices on these boards
> is the number of banks: 4 banks on 128MB board and 8 banks on 256MB
> board.
> 
> The memory size detection logic is loosely based on the code in
> boards/tqc/tqm85xx/sdram.c, but I use fsl_ddr_set_memctl_regs()
> to configure DDR controller registers and enable the controller.
> The sequence is:
> 
> 1. Configure TLBs for 2GB DDR
> 2. Configure LAWs for 2GB DDR
> 3. Configure DDR controller registers and enable DDR controller,
>      CS0_BNDS is set to 256MB.
> 4. Iterate over possible memory sizes starting from the largest.
>      Each iteration configures CS0_CONFIG (sets number of banks, rows 
> and columns)
>      and runs get_ram_size()
> 
> What I observe on 128MB board, is that only 32KB of RAM is detected in 
> both
> first and second iteration. So it seems that setting number of banks 
> to 8 on
> 4-bank devices is fatal, and cannot be changed even if CS0_CONFIG is 
> modified.
> 
> I've tried to rerun DDR controller initialization sequence with new 
> CS0_CONFIG
> value, but that just hangs the board. I've also tried to disable DDR 
> controller via
> RORDEVDISR register and then enable it and reconfigure DDR. That also 
> leads
> to hang.
> 
> I hope Freescale gurus on the list can help me to find a solution.
> 
> Thanks in advance.
> 

I don't think get_ram_size works for your case. If you want to test the
DDR to find the correct size, you have to initialize the DDR first. But
you cannot do this correctly without knowing the number of banks. You
may be able to blindly set the bank number and test the DDR to catch the
error if there is any, but you have to run this code somewhere else, for
example, in the flash (before relocation).

There might be another way. Do you have any board ID to distinguish
these two kinds?

York

  reply	other threads:[~2011-05-05 13:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05 13:17 [U-Boot] Memory size detection on P1011 Felix Radensky
2011-05-05 13:29 ` York Sun [this message]
2011-05-05 14:05   ` Felix Radensky
2011-05-05 18:24   ` Wolfgang Denk
2011-05-05 19:14     ` Felix Radensky
2011-05-05 19:43       ` Wolfgang Denk
2011-05-06  6:11         ` Felix Radensky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304602168.21927.16.camel@oslab-l1 \
    --to=yorksun@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox