Modified patch originates from Andy Green <andy@openmoko.com>
[u-boot-openmoko/mini2440.git] / board / amcc / kilauea / memory.c
blob1d7a3fad9794ac746b9a1eb715f6d7cdd0eb3810
1 /*
2 * (C) Copyright 2007
3 * Stefan Roese, DENX Software Engineering, sr@denx.de.
5 * See file CREDITS for list of people who contributed to this
6 * project.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
24 #include <common.h>
25 #include <asm/processor.h>
26 #include <i2c.h>
28 void sdram_init(void)
30 return;
33 long int initdram(int board_type)
35 return (CFG_MBYTES_SDRAM << 20);
38 #if defined(CFG_DRAM_TEST)
39 int testdram (void)
41 printf ("testdram\n");
42 #if defined (CONFIG_NAND_U_BOOT)
43 return 0;
44 #endif
45 uint *pstart = (uint *) 0x00000000;
46 uint *pend = (uint *) 0x00001000;
47 uint *p;
49 for (p = pstart; p < pend; p++) {
50 *p = 0xaaaaaaaa;
53 for (p = pstart; p < pend; p++) {
54 if (*p != 0xaaaaaaaa) {
55 #if !defined (CONFIG_NAND_SPL)
56 printf ("SDRAM test fails at: %08x\n", (uint) p);
57 #endif
58 return 1;
62 for (p = pstart; p < pend; p++) {
63 *p = 0x55555555;
66 for (p = pstart; p < pend; p++) {
67 if (*p != 0x55555555) {
68 #if !defined (CONFIG_NAND_SPL)
69 printf ("SDRAM test fails at: %08x\n", (uint) p);
70 #endif
71 return 1;
74 #if !defined (CONFIG_NAND_SPL)
75 printf ("SDRAM test passed!!!\n");
76 #endif
77 return 0;
79 #endif