From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Thu, 15 Jul 2004 09:30:23 +0200 Subject: [U-Boot-Users] Q about automatic dram size detection in sdram_init() In-Reply-To: <20040715100012.40f5d71c00027b490053c837.188@empal.com> Message-ID: <001501c46a3d$9705b720$0212000a@PCSTEFAN> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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????un??????u?????y?l??????vv