public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Daniel Ann <ktdann@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] get_ram_size() returns wrong value
Date: Wed, 6 Apr 2005 22:05:52 +0900	[thread overview]
Message-ID: <9b7ca65705040606052cdbe838@mail.gmail.com> (raw)
In-Reply-To: <4253D5A9.6090705@smiths-aerospace.com>

On Apr 6, 2005 9:27 PM, Jerry Van Baren <gerald.vanbaren@smiths-
> Its a memory problem.  Ultimately yes, it is a timing problem.  The
> question is where...
>   * Is it your SDRAM initialization?

Yeah looks alot like it. Previously I left bank 1 disabled. See below,
#define CFG_BANK1_ENABLE    0

I believe SDRAM is on 64bit mode, and schematics shows two chip
selects. I've sort of wrote about this prior to this email.

>   * Is it a hardware/layout problem?
>     * Are the address line lengths close to the same length?
>     * Are the data line lengths close to the same length?
>     * Is it a termination resistor problem (missing/wrong value)?
>   * Is it the SDRAM itself?

Bit hard to confirm at this stage. I guess I have to do everything I
can on the software side first. Hardware people are little reluctant
about looking up on these things.. :P

> Note that, with your printf(), you are repeatedly reading the memory at
> your boundary case address as well as changing the timing.  You are also
> doing a side-effect assignment to "addr" which gets discarded on the
> next line.
> For identifying and debugging memory problems, those are bad practices.

Thanks. I knew I was doing wrong :) Just didnt know what and why.
Didnt think my printf was a magic one :)

> My suggestion:
> 
>     for (cnt = 1; cnt < maxsize / sizeof (long); cnt <<= 1) {
>         addr = base + cnt;  /* pointer arith! */
>         val = *addr;
>         *addr = save[--i];
>         if (val != ~cnt) {
> printf("*addr %08X => %04X != %04X\n",addr,val,~cnt);
>             size = cnt * sizeof (long);
>             /* Restore the original data before leaving the function.
>              */
>             for (cnt <<= 1; cnt < maxsize / sizeof (long); cnt <<= 1) {
>                 addr  = base + cnt;
>                 *addr = save[--i];
>             }
>             return (size);
>         }
>     }

Thanks for your input. As for now, since the mistake came from
misconfiguration, I'm going to dig up on that first.

-- 
Daniel

      reply	other threads:[~2005-04-06 13:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-06 10:18 [U-Boot-Users] get_ram_size() returns wrong value Daniel Ann
2005-04-06 10:42 ` Wolfgang Denk
2005-04-06 12:52   ` Daniel Ann
2005-04-06 13:20     ` Wolfgang Denk
2005-04-07  4:33       ` Daniel Ann
2005-04-07 22:21         ` Wolfgang Denk
2005-04-06 12:27 ` Jerry Van Baren
2005-04-06 13:05   ` Daniel Ann [this message]

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=9b7ca65705040606052cdbe838@mail.gmail.com \
    --to=ktdann@gmail.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