public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] Q about automatic dram size detection in sdram_init()
@ 2004-07-15  1:00 "SYLee"
  2004-07-15  7:30 ` Stefan Roese
  2004-07-15  7:35 ` Wolfgang Denk
  0 siblings, 2 replies; 5+ messages in thread
From: "SYLee" @ 2004-07-15  1:00 UTC (permalink / raw)
  To: u-boot

An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20040715/7cc7d929/attachment.htm 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Q about automatic dram size detection in sdram_init()
  2004-07-15  1:00 [U-Boot-Users] Q about automatic dram size detection in sdram_init() "SYLee"
@ 2004-07-15  7:30 ` Stefan Roese
  2004-07-15  7:55   ` Wolfgang Denk
  2004-07-15  7:35 ` Wolfgang Denk
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Roese @ 2004-07-15  7:30 UTC (permalink / raw)
  To: u-boot

SYLee!

The code works fine on all different memory configutations. This is
because of the mirroring of the written values. For example on a system
with 64MByte SDRAM a write to "ADDR_64MB" will mirror to one of the
smaller addresses and the current test will fail! So this is perfectly
OK.

Best regards,
Stefan Roese

-----Original Message-----
From: u-boot-users-admin@lists.sourceforge.net [mailto:u-boot-users-
admin at lists.sourceforge.net] On Behalf Of SYLee
Sent: Thursday, July 15, 2004 3:00 AM
To: u-boot-users at lists.sourceforge.net
Subject: [U-Boot-Users] Q about automatic dram size detection in
sdram_init()


Hi, 

In cpu/ppc4xx/sdram.c, in sdram_init(), the following seems to be
wrong. 

/* 
* Test if 128 MByte are equipped (mirror test) 
*/ 
*(volatile ulong *)ADDR_ZERO = MAGIC0; 
*(volatile ulong *)ADDR_08MB = MAGIC1; 
*(volatile ulong *)ADDR_16MB = MAGIC2; 
*(volatile ulong *)ADDR_32MB = MAGIC3; 
*(volatile ulong *)ADDR_64MB = MAGIC4; 

if ((*(volatile ulong *)ADDR_ZERO == MAGIC0) && 
    (*(volatile ulong *)ADDR_08MB == MAGIC1) && 
    (*(volatile ulong *)ADDR_16MB == MAGIC2) && 
    (*(volatile ulong *)ADDR_32MB == MAGIC3)) { 
/* 
* OK, 128MB detected -> all done 
*/ 
return; 
} 

I think the following conditional expression must be inserted at if
statement: 
(*(volatile ulong *)ADDR_64MB == MAGIC4) 

The above case is also applied to 64MB and 32MB detection. 

Thanks. 
SYLee. 


Get your own 200MB free email at http://www.empal.com
NH????u\x10n??????u?????y?l??????vv

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Q about automatic dram size detection in sdram_init()
  2004-07-15  1:00 [U-Boot-Users] Q about automatic dram size detection in sdram_init() "SYLee"
  2004-07-15  7:30 ` Stefan Roese
@ 2004-07-15  7:35 ` Wolfgang Denk
  1 sibling, 0 replies; 5+ messages in thread
From: Wolfgang Denk @ 2004-07-15  7:35 UTC (permalink / raw)
  To: u-boot

In message <20040715100012.40f5d71c00027b490053c837.188@empal.com> you wrote:
> PGh0bWw+CjxoZWFkPgo8dGl0bGU+PC90aXRsZT4KPC9oZWFkPgo8Ym9keT4KSGksIA08YnI+Cg08
> YnI+CkluIGNwdS9wcGM0eHgvc2RyYW0uYywgaW4gc2RyYW1faW5pdCgpLCB0aGUgZm9sbG93aW5n
> IHNlZW1zIHRvIGJlIHdyb25nLiANPGJyPgoNPGJyPgovKiANPGJyPgoqIFRlc3QgaWYgMTI4IE1C
> eXRlIGFyZSBlcXVpcHBlZCAobWlycm9yIHRlc3QpIA08YnI+CiovIA08YnI+Cioodm9sYXRpbGUg
> dWxvbmcgKilBRERSX1pFUk8gPSBNQUdJQzA7IA08YnI+Cioodm9sYXRpbGUgdWxvbmcgKilBRERS
> XzA4TUIgPSBNQUdJQzE7IA08YnI+Cioodm9sYXRpbGUgdWxvbmcgKilBRERSXzE2TUIgPSBNQUdJ
> QzI7IA08YnI+Cioodm9sYXRpbGUgdWxvbmcgKilBRERSXzMyTUIgPSBNQUdJQzM7IA08YnI+Cioo
> dm9sYXRpbGUg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193aW4x
> Ij5odHRwOi8vd3d3LmVtcGFsLmNvbTwvYT48YnI+CjwhLS0gRW1wYWwgU2xvZ2FuIEVuZCAtLT4K
> PC9ib2R5Pgo8L2h0bWw+Cg==

Please do not send base 64 encoded messages.

Please do not send HTML messages.

Please send plain text only.

Message unreadable, ignored. Sorry.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Q about automatic dram size detection in sdram_init()
  2004-07-15  7:30 ` Stefan Roese
@ 2004-07-15  7:55   ` Wolfgang Denk
  2004-07-15  8:40     ` Stefan Roese
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2004-07-15  7:55 UTC (permalink / raw)
  To: u-boot

In message <001501c46a3d$9705b720$0212000a@PCSTEFAN> you wrote:
> 
> The code works fine on all different memory configutations. This is
> because of the mirroring of the written values. For example on a system
> with 64MByte SDRAM a write to "ADDR_64MB" will mirror to one of the
> smaller addresses and the current test will fail! So this is perfectly
> OK.

If you have a 64MB system, I'd  expect  that  a  write  to  ADDR_64MB
succeeds?

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
Quantum Mechanics is God's version of "Trust me."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Q about automatic dram size detection in sdram_init()
  2004-07-15  7:55   ` Wolfgang Denk
@ 2004-07-15  8:40     ` Stefan Roese
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Roese @ 2004-07-15  8:40 UTC (permalink / raw)
  To: u-boot

Wolfgang!

> > The code works fine on all different memory configutations. This is
> > because of the mirroring of the written values. For example 
> on a system
> > with 64MByte SDRAM a write to "ADDR_64MB" will mirror to one of the
> > smaller addresses and the current test will fail! So this 
> is perfectly
> > OK.
> 
> If you have a 64MB system, I'd  expect  that  a  write  to  ADDR_64MB
> succeeds?

The memory controller is previously setup to 128MB. So a write to 64MB
is OK, and _will_ be mirrored to a lower address on a 64MB system!

I agree that the code is pretty ugly and I am thinking about reworking
it.

Best regards,
Stefan Roese

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-07-15  8:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-15  1:00 [U-Boot-Users] Q about automatic dram size detection in sdram_init() "SYLee"
2004-07-15  7:30 ` Stefan Roese
2004-07-15  7:55   ` Wolfgang Denk
2004-07-15  8:40     ` Stefan Roese
2004-07-15  7:35 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox