All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] added autodetect of sdram size and nr of banks for ixp
Date: Mon, 15 Sep 2008 14:33:46 +0200	[thread overview]
Message-ID: <200809151433.46886.sr@denx.de> (raw)
In-Reply-To: <4CD35CD1F8085945B597F80EEC8942130192DEC8@exc01.bk.prodrive.nl>

Hi Martijn,

On Monday 15 September 2008, Martijn de Gouw wrote:
> > > +#ifdef CFG_SDR_CONFIG
> > >  	mov	r1, #CFG_SDR_CONFIG
> > > +	mov	r9, #0xff
> > > +#else
> > > +	mov	r1, #0x1d /* 256 MB, two banks of 128 MB */
> > > +	mov	r9, #0
> > > +#endif
> >
> > I don't want such $ifdef's in global code. Why do you thinkthat 2 x
> > 128 MB would be a default configuration for all IXP based boards?
>
> When CFG_SDR_CONFIG is defined, it holds the memory size, which is set
> in the config.h
> When this value is not set, autodetection is assumed.
> Setting up the board as 2 x 128Mb is used for the autodetection.

Understood. Nevertheless the resulting code is quite complex hard to read.

> > > +sdr_init:
>
> /* snip */
>
> > > +sdr_init_done:
> >
> > This whole test makes not much sense to me. I think the code should be
> > changed to use the standard get_ram_size() funciton instead (see
> > common/memsize.c).
>
> get_ram_size will nog set the memory controller to the correct size.
> The ixp can not run C code when memory is not initialized.

Because of the missing C environment (stack etc)? We could probably use a part 
of the QueueManager SRAM for a temorary initial stack, so that we could run C 
code very early. And do the SDRAM initialization and autodetection in C 
instead of assembler (as done for PPC).

If we could run this SDRAM setup code in C, you could implement a weak default 
init function that could be overwritten by a board specific version (in your 
case). This way we wouldn't add more custom stuff into the common/generic 
source files.

What do you think? 

> Maybe it could be used as a replacement for the code in pdnb.c yes.

Yes. This should be replaced.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

  parent reply	other threads:[~2008-09-15 12:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-13 11:08 [U-Boot] [PATCH] added autodetect of sdram size and nr of banks for ixp Martijn de Gouw
2008-09-13 12:12 ` Wolfgang Denk
2008-09-15 11:16   ` Martijn de Gouw
2008-09-15 12:30     ` Wolfgang Denk
2008-09-15 12:33     ` Stefan Roese [this message]
2008-09-15 14:42       ` Martijn de Gouw

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=200809151433.46886.sr@denx.de \
    --to=sr@denx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.