[U-Boot-Users] Re: Some puzzles on dram_size()

Wolfgang Denk wd at denx.de
Tue Jan 6 18:27:43 CET 2004

Hi Chris,

in message <OF5B21F0A5.A3EF40B7-ON85256E13.0056838C at nanometrics.ca> you wrote:
> Your problem with dram_size() may be that it tests memory
> beyond the maxsize given.

No. His max value as defined in the board config file was 64 MB, with
an actual 16 MB of RAM. Accesses at 64 MB and 32 MB  (=  non-existend
addresses)  worked,  but  when  accessing  existing  RAM  at 16 MB he

> The reason it usually works is that most boards make the
> AM (address mask) in the OR (option register) of the memory
> controller specify more memory than they actually need.

Let's put this right: the board config file  is  required  to  define
SDRAM_MAX_SIZE  greater  than or equal to the maximum RAM size of the

> This may be the easy way to fix it, however I would say the correct
> way would be to change the lines

This is not how the memory sizing algorithm is intended to work.

> Unfortunately it appears in many board specific versions.

Not much longer. I will clean this up within the next few  hours  (or

> While I'm at it, the entire function should be moved to a file in
> the common directory and the function definition changed to
>      long int dram_size (long int *base, long int maxsize)

That's what I'll do.

Best regards,

Wolfgang Denk

Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
It is dangerous to be sincere unless you are also stupid.
                                                - George Bernard Shaw

More information about the U-Boot mailing list