Stefan Roese | 566806c | 2007-10-05 17:11:30 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * (C) Copyright 2007 |
| 3 | * Stefan Roese, DENX Software Engineering, sr@denx.de. |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 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. |
| 12 | * |
| 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. |
| 17 | * |
| 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 |
| 22 | */ |
| 23 | |
| 24 | #include <common.h> |
| 25 | #include <asm/processor.h> |
| 26 | #include <i2c.h> |
| 27 | |
| 28 | void sdram_init(void) |
| 29 | { |
| 30 | return; |
| 31 | } |
| 32 | |
| 33 | long int initdram(int board_type) |
| 34 | { |
| 35 | return (CFG_MBYTES_SDRAM << 20); |
| 36 | } |
| 37 | |
| 38 | #if defined(CFG_DRAM_TEST) |
| 39 | int testdram (void) |
| 40 | { |
| 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; |
| 48 | |
| 49 | for (p = pstart; p < pend; p++) { |
| 50 | *p = 0xaaaaaaaa; |
| 51 | } |
| 52 | |
| 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; |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | for (p = pstart; p < pend; p++) { |
| 63 | *p = 0x55555555; |
| 64 | } |
| 65 | |
| 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; |
| 72 | } |
| 73 | } |
| 74 | #if !defined (CONFIG_NAND_SPL) |
| 75 | printf ("SDRAM test passed!!!\n"); |
| 76 | #endif |
| 77 | return 0; |
| 78 | } |
| 79 | #endif |