wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2001 |
| 3 | * Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc. |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | /* sdram_init.c - automatic memory sizing */ |
| 9 | |
| 10 | #include <common.h> |
| 11 | #include <74xx_7xx.h> |
| 12 | #include <galileo/memory.h> |
| 13 | #include <galileo/pci.h> |
| 14 | #include <galileo/gt64260R.h> |
| 15 | #include <net.h> |
Wolfgang Denk | 56803d8 | 2011-11-09 09:28:59 +0000 | [diff] [blame] | 16 | #include <linux/compiler.h> |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 17 | |
| 18 | #include "eth.h" |
| 19 | #include "mpsc.h" |
| 20 | #include "i2c.h" |
| 21 | #include "64260.h" |
| 22 | |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 23 | DECLARE_GLOBAL_DATA_PTR; |
| 24 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 25 | /* #define DEBUG */ |
| 26 | #define MAP_PCI |
| 27 | |
| 28 | #ifdef DEBUG |
| 29 | #define DP(x) x |
| 30 | #else |
| 31 | #define DP(x) |
| 32 | #endif |
| 33 | |
| 34 | #define GB (1 << 30) |
| 35 | |
| 36 | /* structure to store the relevant information about an sdram bank */ |
| 37 | typedef struct sdram_info { |
| 38 | uchar drb_size; |
| 39 | uchar registered, ecc; |
| 40 | uchar tpar; |
| 41 | uchar tras_clocks; |
| 42 | uchar burst_len; |
| 43 | uchar banks, slot; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 44 | int size; /* detected size, not from I2C but from dram_size() */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 45 | } sdram_info_t; |
| 46 | |
| 47 | #ifdef DEBUG |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 48 | void dump_dimm_info (struct sdram_info *d) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 49 | { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 50 | static const char *ecc_legend[] = { "", " Parity", " ECC" }; |
| 51 | |
| 52 | printf ("dimm%s %sDRAM: %dMibytes:\n", |
| 53 | ecc_legend[d->ecc], |
| 54 | d->registered ? "R" : "", (d->size >> 20)); |
| 55 | printf (" drb=%d tpar=%d tras=%d burstlen=%d banks=%d slot=%d\n", |
| 56 | d->drb_size, d->tpar, d->tras_clocks, d->burst_len, |
| 57 | d->banks, d->slot); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 58 | } |
| 59 | #endif |
| 60 | |
| 61 | static int |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 62 | memory_map_bank (unsigned int bankNo, |
| 63 | unsigned int bankBase, unsigned int bankLength) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 64 | { |
| 65 | #ifdef DEBUG |
| 66 | if (bankLength > 0) { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 67 | printf ("mapping bank %d at %08x - %08x\n", |
| 68 | bankNo, bankBase, bankBase + bankLength - 1); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 69 | } else { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 70 | printf ("unmapping bank %d\n", bankNo); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 71 | } |
| 72 | #endif |
| 73 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 74 | memoryMapBank (bankNo, bankBase, bankLength); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 75 | |
| 76 | return 0; |
| 77 | } |
| 78 | |
| 79 | #ifdef MAP_PCI |
| 80 | static int |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 81 | memory_map_bank_pci (unsigned int bankNo, |
| 82 | unsigned int bankBase, unsigned int bankLength) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 83 | { |
| 84 | PCI_HOST host; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 85 | |
| 86 | for (host = PCI_HOST0; host <= PCI_HOST1; host++) { |
| 87 | const int features = |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 88 | PREFETCH_ENABLE | |
| 89 | DELAYED_READ_ENABLE | |
| 90 | AGGRESSIVE_PREFETCH | |
| 91 | READ_LINE_AGGRESSIVE_PREFETCH | |
| 92 | READ_MULTI_AGGRESSIVE_PREFETCH | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 93 | MAX_BURST_4 | PCI_NO_SWAP; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 94 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 95 | pciMapMemoryBank (host, bankNo, bankBase, bankLength); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 96 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 97 | pciSetRegionSnoopMode (host, bankNo, PCI_SNOOP_WB, bankBase, |
| 98 | bankLength); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 99 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 100 | pciSetRegionFeatures (host, bankNo, features, bankBase, |
| 101 | bankLength); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 102 | } |
| 103 | return 0; |
| 104 | } |
| 105 | #endif |
| 106 | |
| 107 | /* ------------------------------------------------------------------------- */ |
| 108 | |
| 109 | /* much of this code is based on (or is) the code in the pip405 port */ |
| 110 | /* thanks go to the authors of said port - Josh */ |
| 111 | |
| 112 | |
| 113 | /* |
| 114 | * translate ns.ns/10 coding of SPD timing values |
| 115 | * into 10 ps unit values |
| 116 | */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 117 | static inline unsigned short NS10to10PS (unsigned char spd_byte) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 118 | { |
| 119 | unsigned short ns, ns10; |
| 120 | |
| 121 | /* isolate upper nibble */ |
| 122 | ns = (spd_byte >> 4) & 0x0F; |
| 123 | /* isolate lower nibble */ |
| 124 | ns10 = (spd_byte & 0x0F); |
| 125 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 126 | return (ns * 100 + ns10 * 10); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 127 | } |
| 128 | |
| 129 | /* |
| 130 | * translate ns coding of SPD timing values |
| 131 | * into 10 ps unit values |
| 132 | */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 133 | static inline unsigned short NSto10PS (unsigned char spd_byte) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 134 | { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 135 | return (spd_byte * 100); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | #ifdef CONFIG_ZUMA_V2 |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 139 | static int check_dimm (uchar slot, sdram_info_t * info) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 140 | { |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 141 | /* assume 2 dimms, 2 banks each 256M - we dont have an |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 142 | * dimm i2c so rely on the detection routines later */ |
| 143 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 144 | memset (info, 0, sizeof (*info)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 145 | |
| 146 | info->slot = slot; |
| 147 | info->banks = 2; /* Detect later */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 148 | info->registered = 0; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 149 | info->drb_size = 32; /* 16 - 256MBit, 32 - 512MBit |
| 150 | but doesn't matter, both do same |
| 151 | thing in setup_sdram() */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 152 | info->tpar = 3; |
| 153 | info->tras_clocks = 5; |
| 154 | info->burst_len = 4; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 155 | #ifdef CONFIG_ECC |
| 156 | info->ecc = 0; /* Detect later */ |
| 157 | #endif /* CONFIG_ECC */ |
| 158 | return 0; |
| 159 | } |
| 160 | |
wdenk | 232fe0b | 2003-09-02 22:48:03 +0000 | [diff] [blame] | 161 | #elif defined(CONFIG_P3G4) |
| 162 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 163 | static int check_dimm (uchar slot, sdram_info_t * info) |
wdenk | 232fe0b | 2003-09-02 22:48:03 +0000 | [diff] [blame] | 164 | { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 165 | memset (info, 0, sizeof (*info)); |
wdenk | 232fe0b | 2003-09-02 22:48:03 +0000 | [diff] [blame] | 166 | |
| 167 | if (slot) |
| 168 | return 0; |
| 169 | |
| 170 | info->slot = slot; |
| 171 | info->banks = 1; |
| 172 | info->registered = 0; |
| 173 | info->drb_size = 4; |
| 174 | info->tpar = 3; |
| 175 | info->tras_clocks = 6; |
| 176 | info->burst_len = 4; |
| 177 | #ifdef CONFIG_ECC |
| 178 | info->ecc = 2; |
| 179 | #endif |
| 180 | return 0; |
| 181 | } |
| 182 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 183 | #else /* ! CONFIG_ZUMA_V2 && ! CONFIG_P3G4 */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 184 | |
| 185 | /* This code reads the SPD chip on the sdram and populates |
| 186 | * the array which is passed in with the relevant information */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 187 | static int check_dimm (uchar slot, sdram_info_t * info) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 188 | { |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 189 | uchar addr = slot == 0 ? DIMM0_I2C_ADDR : DIMM1_I2C_ADDR; |
| 190 | int ret; |
| 191 | uchar rows, cols, sdram_banks, supp_cal, width, cal_val; |
| 192 | ulong tmemclk; |
| 193 | uchar trp_clocks, trcd_clocks; |
| 194 | uchar data[128]; |
| 195 | |
| 196 | get_clocks (); |
| 197 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 198 | tmemclk = 1000000000 / (gd->bus_clk / 100); /* in 10 ps units */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 199 | |
| 200 | #ifdef CONFIG_EVB64260_750CX |
| 201 | if (0 != slot) { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 202 | printf ("check_dimm: The EVB-64260-750CX only has 1 DIMM,"); |
| 203 | printf (" called with slot=%d insetad!\n", slot); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 204 | return 0; |
| 205 | } |
| 206 | #endif |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 207 | DP (puts ("before i2c read\n")); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 208 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 209 | ret = i2c_read (addr, 0, 128, data, 0); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 210 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 211 | DP (puts ("after i2c read\n")); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 212 | |
| 213 | /* zero all the values */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 214 | memset (info, 0, sizeof (*info)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 215 | |
| 216 | if (ret) { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 217 | DP (printf ("No DIMM in slot %d [err = %x]\n", slot, ret)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 218 | return 0; |
| 219 | } |
| 220 | |
| 221 | /* first, do some sanity checks */ |
| 222 | if (data[2] != 0x4) { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 223 | printf ("Not SDRAM in slot %d\n", slot); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 224 | return 0; |
| 225 | } |
| 226 | |
| 227 | /* get various information */ |
| 228 | rows = data[3]; |
| 229 | cols = data[4]; |
| 230 | info->banks = data[5]; |
| 231 | sdram_banks = data[17]; |
| 232 | width = data[13] & 0x7f; |
| 233 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 234 | DP (printf |
| 235 | ("sdram_banks: %d, banks: %d\n", sdram_banks, info->banks)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 236 | |
| 237 | /* check if the memory is registered */ |
| 238 | if (data[21] & (BIT1 | BIT4)) |
| 239 | info->registered = 1; |
| 240 | |
| 241 | #ifdef CONFIG_ECC |
| 242 | /* check for ECC/parity [0 = none, 1 = parity, 2 = ecc] */ |
| 243 | info->ecc = (data[11] & 2) >> 1; |
| 244 | #endif |
| 245 | |
| 246 | /* bit 1 is CL2, bit 2 is CL3 */ |
| 247 | supp_cal = (data[18] & 0x6) >> 1; |
| 248 | |
| 249 | /* compute the relevant clock values */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 250 | trp_clocks = (NSto10PS (data[27]) + (tmemclk - 1)) / tmemclk; |
| 251 | trcd_clocks = (NSto10PS (data[29]) + (tmemclk - 1)) / tmemclk; |
| 252 | info->tras_clocks = (NSto10PS (data[30]) + (tmemclk - 1)) / tmemclk; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 253 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 254 | DP (printf ("trp = %d\ntrcd_clocks = %d\ntras_clocks = %d\n", |
| 255 | trp_clocks, trcd_clocks, info->tras_clocks)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 256 | |
| 257 | /* try a CAS latency of 3 first... */ |
| 258 | cal_val = 0; |
| 259 | if (supp_cal & 3) { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 260 | if (NS10to10PS (data[9]) <= tmemclk) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 261 | cal_val = 3; |
| 262 | } |
| 263 | |
| 264 | /* then 2... */ |
| 265 | if (supp_cal & 2) { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 266 | if (NS10to10PS (data[23]) <= tmemclk) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 267 | cal_val = 2; |
| 268 | } |
| 269 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 270 | DP (printf ("cal_val = %d\n", cal_val)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 271 | |
| 272 | /* bummer, did't work... */ |
| 273 | if (cal_val == 0) { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 274 | DP (printf ("Couldn't find a good CAS latency\n")); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 275 | return 0; |
| 276 | } |
| 277 | |
| 278 | /* get the largest delay -- these values need to all be the same |
| 279 | * see Res#6 */ |
| 280 | info->tpar = cal_val; |
| 281 | if (trp_clocks > info->tpar) |
| 282 | info->tpar = trp_clocks; |
| 283 | if (trcd_clocks > info->tpar) |
| 284 | info->tpar = trcd_clocks; |
| 285 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 286 | DP (printf ("tpar set to: %d\n", info->tpar)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 287 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 288 | #ifdef CONFIG_SYS_BROKEN_CL2 |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 289 | if (info->tpar == 2) { |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 290 | info->tpar = 3; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 291 | DP (printf ("tpar fixed-up to: %d\n", info->tpar)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 292 | } |
| 293 | #endif |
| 294 | /* compute the module DRB size */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 295 | info->drb_size = |
| 296 | (((1 << (rows + cols)) * sdram_banks) * width) / _16M; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 297 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 298 | DP (printf ("drb_size set to: %d\n", info->drb_size)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 299 | |
| 300 | /* find the burst len */ |
| 301 | info->burst_len = data[16] & 0xf; |
| 302 | if ((info->burst_len & 8) == 8) { |
| 303 | info->burst_len = 1; |
| 304 | } else if ((info->burst_len & 4) == 4) { |
| 305 | info->burst_len = 0; |
| 306 | } else { |
| 307 | return 0; |
| 308 | } |
| 309 | |
| 310 | info->slot = slot; |
| 311 | return 0; |
| 312 | } |
| 313 | #endif /* ! CONFIG_ZUMA_V2 */ |
| 314 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 315 | static int setup_sdram_common (sdram_info_t info[2]) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 316 | { |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 317 | ulong tmp; |
Wolfgang Denk | 56803d8 | 2011-11-09 09:28:59 +0000 | [diff] [blame] | 318 | int tpar = 2, tras_clocks = 5, registered = 1; |
| 319 | __maybe_unused int ecc = 2; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 320 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 321 | if (!info[0].banks && !info[1].banks) |
| 322 | return 0; |
| 323 | |
| 324 | if (info[0].banks) { |
| 325 | if (info[0].tpar > tpar) |
| 326 | tpar = info[0].tpar; |
| 327 | if (info[0].tras_clocks > tras_clocks) |
| 328 | tras_clocks = info[0].tras_clocks; |
| 329 | if (!info[0].registered) |
| 330 | registered = 0; |
wdenk | ef89394 | 2004-02-23 16:11:30 +0000 | [diff] [blame] | 331 | if (info[0].ecc != 2) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 332 | ecc = 0; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 333 | } |
| 334 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 335 | if (info[1].banks) { |
| 336 | if (info[1].tpar > tpar) |
| 337 | tpar = info[1].tpar; |
| 338 | if (info[1].tras_clocks > tras_clocks) |
| 339 | tras_clocks = info[1].tras_clocks; |
| 340 | if (!info[1].registered) |
| 341 | registered = 0; |
| 342 | if (info[1].ecc != 2) |
| 343 | ecc = 0; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 344 | } |
| 345 | |
| 346 | /* SDRAM configuration */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 347 | tmp = GTREGREAD (SDRAM_CONFIGURATION); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 348 | |
| 349 | /* Turn on physical interleave if both DIMMs |
| 350 | * have even numbers of banks. */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 351 | if ((info[0].banks == 0 || info[0].banks == 2) && |
| 352 | (info[1].banks == 0 || info[1].banks == 2)) { |
| 353 | /* physical interleave on */ |
| 354 | tmp &= ~(1 << 15); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 355 | } else { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 356 | /* physical interleave off */ |
| 357 | tmp |= (1 << 15); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | tmp |= (registered << 17); |
| 361 | |
| 362 | /* Use buffer 1 to return read data to the CPU |
| 363 | * See Res #12 */ |
| 364 | tmp |= (1 << 26); |
| 365 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 366 | GT_REG_WRITE (SDRAM_CONFIGURATION, tmp); |
| 367 | DP (printf ("SDRAM config: %08x\n", GTREGREAD (SDRAM_CONFIGURATION))); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 368 | |
| 369 | /* SDRAM timing */ |
| 370 | tmp = (((tpar == 3) ? 2 : 1) | |
| 371 | (((tpar == 3) ? 2 : 1) << 2) | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 372 | (((tpar == 3) ? 2 : 1) << 4) | (tras_clocks << 8)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 373 | |
| 374 | #ifdef CONFIG_ECC |
| 375 | /* Setup ECC */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 376 | if (ecc == 2) |
| 377 | tmp |= 1 << 13; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 378 | #endif /* CONFIG_ECC */ |
| 379 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 380 | GT_REG_WRITE (SDRAM_TIMING, tmp); |
| 381 | DP (printf ("SDRAM timing: %08x (%d,%d,%d,%d)\n", |
| 382 | GTREGREAD (SDRAM_TIMING), tpar, tpar, tpar, tras_clocks)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 383 | |
| 384 | /* SDRAM address decode register */ |
| 385 | /* program this with the default value */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 386 | GT_REG_WRITE (SDRAM_ADDRESS_DECODE, 0x2); |
| 387 | DP (printf ("SDRAM decode: %08x\n", |
| 388 | GTREGREAD (SDRAM_ADDRESS_DECODE))); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 389 | |
| 390 | return 0; |
| 391 | } |
| 392 | |
| 393 | /* sets up the GT properly with information passed in */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 394 | static int setup_sdram (sdram_info_t * info) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 395 | { |
Wolfgang Denk | 56803d8 | 2011-11-09 09:28:59 +0000 | [diff] [blame] | 396 | ulong tmp; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 397 | ulong *addr = 0; |
Wolfgang Denk | 56803d8 | 2011-11-09 09:28:59 +0000 | [diff] [blame] | 398 | __maybe_unused ulong check; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 399 | int i; |
| 400 | |
| 401 | /* sanity checking */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 402 | if (!info->banks) |
| 403 | return 0; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 404 | |
| 405 | /* ---------------------------- */ |
| 406 | /* Program the GT with the discovered data */ |
| 407 | |
| 408 | /* bank parameters */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 409 | tmp = (0xf << 16); /* leave all virt bank pages open */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 410 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 411 | DP (printf ("drb_size: %d\n", info->drb_size)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 412 | switch (info->drb_size) { |
| 413 | case 1: |
| 414 | tmp |= (1 << 14); |
| 415 | break; |
| 416 | case 4: |
| 417 | case 8: |
| 418 | tmp |= (2 << 14); |
| 419 | break; |
| 420 | case 16: |
| 421 | case 32: |
| 422 | tmp |= (3 << 14); |
| 423 | break; |
| 424 | default: |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 425 | printf ("Error in dram size calculation\n"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 426 | return 1; |
| 427 | } |
| 428 | |
| 429 | /* SDRAM bank parameters */ |
| 430 | /* the param registers for slot 1 (banks 2+3) are offset by 0x8 */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 431 | GT_REG_WRITE (SDRAM_BANK0PARAMETERS + (info->slot * 0x8), tmp); |
| 432 | GT_REG_WRITE (SDRAM_BANK1PARAMETERS + (info->slot * 0x8), tmp); |
| 433 | DP (printf |
| 434 | ("SDRAM bankparam slot %d (bank %d+%d): %08lx\n", info->slot, |
| 435 | info->slot * 2, (info->slot * 2) + 1, tmp)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 436 | |
| 437 | /* set the SDRAM configuration for each bank */ |
| 438 | for (i = info->slot * 2; i < ((info->slot * 2) + info->banks); i++) { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 439 | DP (printf ("*** Running a MRS cycle for bank %d ***\n", i)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 440 | |
| 441 | /* map the bank */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 442 | memory_map_bank (i, 0, GB / 4); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 443 | |
| 444 | /* set SDRAM mode */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 445 | GT_REG_WRITE (SDRAM_OPERATION_MODE, 0x3); |
| 446 | check = GTREGREAD (SDRAM_OPERATION_MODE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 447 | |
| 448 | /* dummy write */ |
| 449 | *addr = 0; |
| 450 | |
| 451 | /* wait for the command to complete */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 452 | while ((GTREGREAD (SDRAM_OPERATION_MODE) & (1 << 31)) == 0); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 453 | |
| 454 | /* switch back to normal operation mode */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 455 | GT_REG_WRITE (SDRAM_OPERATION_MODE, 0); |
| 456 | check = GTREGREAD (SDRAM_OPERATION_MODE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 457 | |
| 458 | /* unmap the bank */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 459 | memory_map_bank (i, 0, 0); |
| 460 | DP (printf ("*** MRS cycle for bank %d done ***\n", i)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 461 | } |
| 462 | |
| 463 | return 0; |
| 464 | } |
| 465 | |
| 466 | /* |
| 467 | * Check memory range for valid RAM. A simple memory test determines |
| 468 | * the actually available RAM size between addresses `base' and |
| 469 | * `base + maxsize'. Some (not all) hardware errors are detected: |
| 470 | * - short between address lines |
| 471 | * - short between data lines |
| 472 | */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 473 | static long int dram_size (long int *base, long int maxsize) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 474 | { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 475 | volatile long int *addr, *b = base; |
| 476 | long int cnt, val, save1, save2; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 477 | |
| 478 | #define STARTVAL (1<<20) /* start test at 1M */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 479 | for (cnt = STARTVAL / sizeof (long); cnt < maxsize / sizeof (long); |
| 480 | cnt <<= 1) { |
| 481 | addr = base + cnt; /* pointer arith! */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 482 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 483 | save1 = *addr; /* save contents of addr */ |
| 484 | save2 = *b; /* save contents of base */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 485 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 486 | *addr = cnt; /* write cnt to addr */ |
| 487 | *b = 0; /* put null at base */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 488 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 489 | /* check at base address */ |
| 490 | if ((*b) != 0) { |
| 491 | *addr = save1; /* restore *addr */ |
| 492 | *b = save2; /* restore *b */ |
| 493 | return (0); |
| 494 | } |
| 495 | val = *addr; /* read *addr */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 496 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 497 | *addr = save1; |
| 498 | *b = save2; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 499 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 500 | if (val != cnt) { |
| 501 | /* fix boundary condition.. STARTVAL means zero */ |
| 502 | if (cnt == STARTVAL / sizeof (long)) |
| 503 | cnt = 0; |
| 504 | return (cnt * sizeof (long)); |
| 505 | } |
| 506 | } |
| 507 | return maxsize; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 508 | } |
| 509 | |
| 510 | /* ------------------------------------------------------------------------- */ |
| 511 | |
| 512 | /* U-Boot interface function to SDRAM init - this is where all the |
| 513 | * controlling logic happens */ |
Becky Bruce | bd99ae7 | 2008-06-09 16:03:40 -0500 | [diff] [blame] | 514 | phys_size_t initdram (int board_type) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 515 | { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 516 | ulong checkbank[4] = {[0 ... 3] = 0 }; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 517 | int bank_no; |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 518 | ulong total; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 519 | int nhr; |
| 520 | sdram_info_t dimm_info[2]; |
| 521 | |
| 522 | |
| 523 | /* first, use the SPD to get info about the SDRAM */ |
| 524 | |
| 525 | /* check the NHR bit and skip mem init if it's already done */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 526 | nhr = get_hid0 () & (1 << 16); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 527 | |
| 528 | if (nhr) { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 529 | printf ("Skipping SDRAM setup due to NHR bit being set\n"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 530 | } else { |
| 531 | /* DIMM0 */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 532 | check_dimm (0, &dimm_info[0]); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 533 | |
| 534 | /* DIMM1 */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 535 | #ifndef CONFIG_EVB64260_750CX /* EVB64260_750CX has only 1 DIMM */ |
| 536 | check_dimm (1, &dimm_info[1]); |
| 537 | #else /* CONFIG_EVB64260_750CX */ |
| 538 | memset (&dimm_info[1], 0, sizeof (sdram_info_t)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 539 | #endif |
| 540 | |
| 541 | /* unmap all banks */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 542 | memory_map_bank (0, 0, 0); |
| 543 | memory_map_bank (1, 0, 0); |
| 544 | memory_map_bank (2, 0, 0); |
| 545 | memory_map_bank (3, 0, 0); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 546 | |
| 547 | /* Now, program the GT with the correct values */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 548 | if (setup_sdram_common (dimm_info)) { |
| 549 | printf ("Setup common failed.\n"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 550 | } |
| 551 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 552 | if (setup_sdram (&dimm_info[0])) { |
| 553 | printf ("Setup for DIMM1 failed.\n"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 554 | } |
| 555 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 556 | if (setup_sdram (&dimm_info[1])) { |
| 557 | printf ("Setup for DIMM2 failed.\n"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 558 | } |
| 559 | |
| 560 | /* set the NHR bit */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 561 | set_hid0 (get_hid0 () | (1 << 16)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 562 | } |
| 563 | /* next, size the SDRAM banks */ |
| 564 | |
| 565 | total = 0; |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 566 | if (dimm_info[0].banks > 0) |
| 567 | checkbank[0] = 1; |
| 568 | if (dimm_info[0].banks > 1) |
| 569 | checkbank[1] = 1; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 570 | if (dimm_info[0].banks > 2) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 571 | printf ("Error, SPD claims DIMM1 has >2 banks\n"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 572 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 573 | if (dimm_info[1].banks > 0) |
| 574 | checkbank[2] = 1; |
| 575 | if (dimm_info[1].banks > 1) |
| 576 | checkbank[3] = 1; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 577 | if (dimm_info[1].banks > 2) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 578 | printf ("Error, SPD claims DIMM2 has >2 banks\n"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 579 | |
| 580 | /* Generic dram sizer: works even if we don't have i2c DIMMs, |
| 581 | * as long as the timing settings are more or less correct */ |
| 582 | |
| 583 | /* |
| 584 | * pass 1: size all the banks, using first bat (0-256M) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 585 | * limitation: we only support 256M per bank due to |
| 586 | * us only having 1 BAT for all DRAM |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 587 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 588 | for (bank_no = 0; bank_no < CONFIG_SYS_DRAM_BANKS; bank_no++) { |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 589 | /* skip over banks that are not populated */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 590 | if (!checkbank[bank_no]) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 591 | continue; |
| 592 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 593 | DP (printf ("checking bank %d\n", bank_no)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 594 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 595 | memory_map_bank (bank_no, 0, GB / 4); |
| 596 | checkbank[bank_no] = dram_size (NULL, GB / 4); |
| 597 | memory_map_bank (bank_no, 0, 0); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 598 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 599 | DP (printf ("bank %d %08lx\n", bank_no, checkbank[bank_no])); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 600 | } |
| 601 | |
| 602 | /* |
| 603 | * pass 2: contiguously map each bank into physical address |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 604 | * space. |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 605 | */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 606 | dimm_info[0].banks = dimm_info[1].banks = 0; |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 607 | for (bank_no = 0; bank_no < CONFIG_SYS_DRAM_BANKS; bank_no++) { |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 608 | if (!checkbank[bank_no]) |
| 609 | continue; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 610 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 611 | dimm_info[bank_no / 2].banks++; |
| 612 | dimm_info[bank_no / 2].size += checkbank[bank_no]; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 613 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 614 | memory_map_bank (bank_no, total, checkbank[bank_no]); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 615 | #ifdef MAP_PCI |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 616 | memory_map_bank_pci (bank_no, total, checkbank[bank_no]); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 617 | #endif |
| 618 | total += checkbank[bank_no]; |
| 619 | } |
| 620 | |
| 621 | #ifdef CONFIG_ECC |
| 622 | #ifdef CONFIG_ZUMA_V2 |
| 623 | /* |
| 624 | * We always enable ECC when bank 2 and 3 are unpopulated |
| 625 | * If we 2 or 3 are populated, we CAN'T support ECC. |
| 626 | * (Zuma boards only support ECC in banks 0 and 1; assume that |
| 627 | * in that configuration, ECC chips are mounted, even for stacked |
| 628 | * chips) |
| 629 | */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 630 | if (checkbank[2] == 0 && checkbank[3] == 0) { |
| 631 | dimm_info[0].ecc = 2; |
| 632 | GT_REG_WRITE (SDRAM_TIMING, |
| 633 | GTREGREAD (SDRAM_TIMING) | (1 << 13)); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 634 | /* TODO: do we have to run MRS cycles again? */ |
| 635 | } |
| 636 | #endif /* CONFIG_ZUMA_V2 */ |
| 637 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 638 | if (GTREGREAD (SDRAM_TIMING) & (1 << 13)) { |
| 639 | puts ("[ECC] "); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 640 | } |
| 641 | #endif /* CONFIG_ECC */ |
| 642 | |
| 643 | #ifdef DEBUG |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 644 | dump_dimm_info (&dimm_info[0]); |
| 645 | dump_dimm_info (&dimm_info[1]); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 646 | #endif |
| 647 | /* TODO: return at MOST 256M? */ |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 648 | /* return total > GB/4 ? GB/4 : total; */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 649 | return total; |
| 650 | } |