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