2 /* This was originally for the e7500, modified for e7501
3 * The primary differences are that 7501 apparently can
4 * support single channel RAM (i haven't tested),
5 * CAS1.5 is no longer supported, The ECC scrubber
6 * now supports a mode to zero RAM and init ECC in one step
7 * and the undocumented registers at 0x80 require new
8 * (undocumented) values determined by guesswork and
9 * comparison w/ OEM BIOS values.
10 * Steven James 02/06/2003
13 /* converted to C 6/2004 yhlu */
15 #define DEBUG_RAM_CONFIG 0
17 #define dumpnorth() dump_pci_device(PCI_DEV(0, 0, 0))
19 /* DDR DIMM Mode register Definitions */
21 #define BURST_2 (1<<0)
22 #define BURST_4 (2<<0)
23 #define BURST_8 (3<<0)
25 #define BURST_SEQUENTIAL (0<<3)
26 #define BURST_INTERLEAVED (1<<3)
28 #define CAS_2_0 (0x2<<4)
29 #define CAS_3_0 (0x3<<4)
30 #define CAS_1_5 (0x5<<4)
31 #define CAS_2_5 (0x6<<4)
33 #define MODE_NORM (0 << 7)
34 #define MODE_DLL_RESET (2 << 7)
35 #define MODE_TEST (1 << 7)
37 #define BURST_LENGTH BURST_4
38 #define BURST_TYPE BURST_INTERLEAVED
39 #define CAS_LATENCY CAS_2_0
40 //#define CAS_LATENCY CAS_2_5
41 //#define CAS_LATENCY CAS_1_5
43 #define MRS_VALUE (MODE_NORM | CAS_LATENCY | BURST_TYPE | BURST_LENGTH)
44 #define EMRS_VALUE 0x000
48 #define RAM_COMMAND_NONE 0x0
49 #define RAM_COMMAND_NOP 0x1
50 #define RAM_COMMAND_PRECHARGE 0x2
51 #define RAM_COMMAND_MRS 0x3
52 #define RAM_COMMAND_EMRS 0x4
53 #define RAM_COMMAND_CBR 0x6
54 #define RAM_COMMAND_NORMAL 0x7
57 static inline void do_ram_command (const struct mem_controller *ctrl, uint32_t value) {
62 #if DEBUG_RAM_CONFIG >= 2
64 print_debug_hex8(value);
67 /* %ecx - initial address to read from */
68 /* Compute the offset */
71 /* Set the ram command */
72 byte = pci_read_config8(ctrl->d0, 0x7c);
74 byte |= (uint8_t)(value & 0xff);
75 pci_write_config8(ctrl->d0, 0x7c, byte);
77 /* Assert the command to the memory */
78 #if DEBUG_RAM_CONFIG >= 2
80 print_debug_hex32(dword);
84 result = read32(dword);
86 /* Go to the next base address */
91 /* The command has been sent to all dimms so get out */
95 static inline void RAM_CMD(const struct mem_controller *ctrl, uint32_t command, uint32_t offset) {
96 uint32_t value = ((offset) << (MD_SHIFT + 16))|((command << 4) & 0x70) ;
97 do_ram_command(ctrl, value);
100 #define RAM_NOP(ctrl) RAM_CMD(ctrl, RAM_COMMAND_NOP, 0)
101 #define RAM_PRECHARGE(ctrl) RAM_CMD(ctrl, RAM_COMMAND_PRECHARGE, 0)
102 #define RAM_CBR(ctrl) RAM_CMD(ctrl, RAM_COMMAND_CBR, 0)
103 #define RAM_EMRS(ctrl) RAM_CMD(ctrl, RAM_COMMAND_EMRS, EMRS_VALUE)
105 static const uint8_t ram_cas_latency[] = {
106 CAS_2_5, CAS_2_0, CAS_1_5, CAS_2_5
109 static inline void ram_mrs(const struct mem_controller *ctrl, uint32_t value){
110 /* Read the cas latency setting */
113 byte = pci_read_config8(ctrl->d0, 0x78);
114 /* Transform it into the form expected by SDRAM */
115 dword = ram_cas_latency[(byte>>4) & 3];
117 value |= (dword<<(16+MD_SHIFT));
119 value |= (MODE_NORM | BURST_TYPE | BURST_LENGTH) << (16+MD_SHIFT);
121 do_ram_command(ctrl, value);
124 #define RAM_MRS(ctrl, dll_reset) ram_mrs( ctrl, (dll_reset << (8+MD_SHIFT+ 16)) | ((RAM_COMMAND_MRS <<4)& 0x70) )
126 static void RAM_NORMAL(const struct mem_controller *ctrl) {
128 byte = pci_read_config8(ctrl->d0, 0x7c);
130 byte |= (RAM_COMMAND_NORMAL << 4);
131 pci_write_config8(ctrl->d0, 0x7c, byte);
134 static void RAM_RESET_DDR_PTR(const struct mem_controller *ctrl) {
136 byte = pci_read_config8(ctrl->d0, 0x88);
138 pci_write_config8(ctrl->d0, 0x88, byte);
139 byte = pci_read_config8(ctrl->d0, 0x88);
141 pci_write_config8(ctrl->d0, 0x88, byte);
144 static void ENABLE_REFRESH(const struct mem_controller *ctrl)
147 dword = pci_read_config32(ctrl->d0, 0x7c);
149 pci_write_config32(ctrl->d0, 0x7c, dword);
153 * Table: constant_register_values
155 static const long register_values[] = {
156 /* SVID - Subsystem Vendor Identification Register
158 * [15:00] Subsytem Vendor ID (Indicates system board vendor)
160 /* SID - Subsystem Identification Register
162 * [15:00] Subsystem ID
164 // 0x2c, 0, (0x15d9 << 0) | (0x3580 << 16),
168 * This register has something to do with CAS latencies,
169 * possibily this is the real chipset control.
170 * At 0x00 CAS latency 1.5 works.
171 * At 0x06 CAS latency 2.5 works.
172 * At 0x01 CAS latency 2.0 works.
174 /* This is still undocumented in e7501, but with different values
175 * CAS 2.0 values taken from Intel BIOS settings, others are a guess
176 * and may be terribly wrong. Old values preserved as comments until I
177 * figure this out for sure.
178 * e7501 docs claim that CAS1.5 is unsupported, so it may or may not
180 * Steven James 02/06/2003
182 #if CAS_LATENCY == CAS_2_5
183 // 0x80, 0xfffffe00, 0x06 /* Intel E7500 recommended */
184 0x80, 0xfffff000, 0x0662, /* from Factory Bios */
185 #elif CAS_LATENCY == CAS_2_0
186 // 0x80, 0xfffffe00, 0x0d /* values for register 0x80 */
187 0x80, 0xfffff000, 0x0bb1, /* values for register 0x80 */
189 000 = HI_A Stop Grant generated after 1 Stop Grant
190 001 = HI_A Stop Grant generated after 2 Stop Grant
191 010 = HI_A Stop Grant generated after 3 Stop Grant
192 011 = HI_A Stop Grant generated after 4 Stop Grant*/
193 0x50, 0xffff1fff, 0x00006000,
196 /* Enable periodic memory recalibration */
197 0x88, 0xffffff00, 0x80,
199 /* FDHC - Fixed DRAM Hole Control
202 * 0 == No memory Hole
203 * 1 == Memory Hole from 15MB to 16MB
206 * PAM - Programmable Attribute Map
207 * 0x59 [1:0] Reserved
208 * 0x59 [5:4] 0xF0000 - 0xFFFFF
209 * 0x5A [1:0] 0xC0000 - 0xC3FFF
210 * 0x5A [5:4] 0xC4000 - 0xC7FFF
211 * 0x5B [1:0] 0xC8000 - 0xCBFFF
212 * 0x5B [5:4] 0xCC000 - 0xCFFFF
213 * 0x5C [1:0] 0xD0000 - 0xD3FFF
214 * 0x5C [5:4] 0xD4000 - 0xD7FFF
215 * 0x5D [1:0] 0xD8000 - 0xDBFFF
216 * 0x5D [5:4] 0xDC000 - 0xDFFFF
217 * 0x5E [1:0] 0xE0000 - 0xE3FFF
218 * 0x5E [5:4] 0xE4000 - 0xE7FFF
219 * 0x5F [1:0] 0xE8000 - 0xEBFFF
220 * 0x5F [5:4] 0xEC000 - 0xEFFFF
221 * 00 == DRAM Disabled (All Access go to memory mapped I/O space)
222 * 01 == Read Only (Reads to DRAM, Writes to memory mapped I/O space)
223 * 10 == Write Only (Writes to DRAM, Reads to memory mapped I/O space)
224 * 11 == Normal (All Access go to DRAM)
226 0x58, 0xcccccf7f, (0x00 << 0) | (0x30 << 8) | (0x33 << 16) | (0x33 << 24),
227 0x5C, 0xcccccccc, (0x33 << 0) | (0x33 << 8) | (0x33 << 16) | (0x33 << 24),
229 /* DRB - DRAM Row Boundary Registers
231 * An array of 8 byte registers, which hold the ending
232 * memory address assigned to each pair of DIMMS, in 64MB
235 /* Conservatively say each row has 64MB of ram, we will fix this up later */
236 0x60, 0x00000000, (0x01 << 0) | (0x02 << 8) | (0x03 << 16) | (0x04 << 24),
237 0x64, 0x00000000, (0x05 << 0) | (0x06 << 8) | (0x07 << 16) | (0x08 << 24),
241 /* DRA - DRAM Row Attribute Register
246 * [7:7] Device width for Odd numbered rows
247 * 0 == 8 bits wide x8
248 * 1 == 4 bits wide x4
249 * [6:4] Row Attributes for Odd numbered rows
255 * [3:3] Device width for Even numbered rows
256 * 0 == 8 bits wide x8
257 * 1 == 4 bits wide x4
258 * [2:0] Row Attributes for Even numbered rows
262 * 101 == 64KB (This page size appears broken)
266 (((0<<3)|(0<<0))<< 0) |
267 (((0<<3)|(0<<0))<< 4) |
268 (((0<<3)|(0<<0))<< 8) |
269 (((0<<3)|(0<<0))<<12) |
270 (((0<<3)|(0<<0))<<16) |
271 (((0<<3)|(0<<0))<<20) |
272 (((0<<3)|(0<<0))<<24) |
273 (((0<<3)|(0<<0))<<28),
276 /* DRT - DRAM Time Register
279 * [29:29] Back to Back Write-Read Turn Around
280 * 0 == 3 clocks between WR-RD commands
281 * 1 == 2 clocks between WR-RD commands
282 * [28:28] Back to Back Read-Write Turn Around
283 * 0 == 5 clocks between RD-WR commands
284 * 1 == 4 clocks between RD-WR commands
285 * [27:27] Back to Back Read Turn Around
286 * 0 == 4 clocks between RD commands
287 * 1 == 3 clocks between RD commands
288 * [26:24] Read Delay (tRD)
294 * [18:16] DRAM idle timer
296 * 011 == 16 dram clocks
297 * 001 == Datasheet says reserved, but Intel BIOS sets it
299 * [10:09] Active to Precharge (tRAS)
305 * [05:04] Cas Latency (tCL)
310 * [03:03] Write Ras# to Cas# Delay (tRCD)
313 * [02:01] Read RAS# to CAS# Delay (tRCD)
316 * 10 == 3 DRAM Clocks
317 * 11 == 2 DRAM Clocks
318 * [00:00] DRAM RAS# to Precharge (tRP)
322 #define DRT_CAS_2_5 (0<<4)
323 #define DRT_CAS_2_0 (1<<4)
324 #define DRT_CAS_1_5 (2<<4)
325 #define DRT_CAS_MASK (3<<4)
327 #if CAS_LATENCY == CAS_2_5
328 #define DRT_CL DRT_CAS_2_5
329 #elif CAS_LATENCY == CAS_2_0
330 #define DRT_CL DRT_CAS_2_0
331 #elif CAS_LATENCY == CAS_1_5
332 #define DRT_CL DRT_CAS_1_5
335 /* Most aggressive settings possible */
336 // 0x78, 0xc0fff8c4, (1<<29)|(1<<28)|(1<<27)|(2<<24)|(2<<9)|DRT_CL|(1<<3)|(1<<1)|(1<<0),
337 // 0x78, 0xc0f8f8c0, (1<<29)|(1<<28)|(1<<27)|(1<<24)|(1<<16)|(2<<9)|DRT_CL|(1<<3)|(3<<1)|(1<<0),
338 0x78, 0xc0f8f9c0, (1<<29)|(1<<28)|(1<<27)|(1<<24)|(1<<16)|(2<<9)|DRT_CL|(1<<3)|(3<<1)|(1<<0),
340 /* FIXME why was I attempting to set a reserved bit? */
343 /* DRC - DRAM Contoller Mode Register
346 * [29:29] Initialization Complete
351 * 0 == Single channel
353 * [21:20] DRAM Data Integrity Mode
354 * 00 == Disabled, no ECC
356 * 10 == Error checking, using chip-kill, with correction
360 * [17:17] (Intel Undocumented) should always be set to 1
361 * [16:16] Command Per Clock - Address/Control Assertion Rule (CPC)
365 * [10:08] Refresh mode select
366 * 000 == Refresh disabled
367 * 001 == Refresh interval 15.6 usec
368 * 010 == Refresh interval 7.8 usec
369 * 011 == Refresh interval 64 usec
370 * 111 == Refresh every 64 clocks (fast refresh)
372 * [06:04] Mode Select (SMS)
373 * 000 == Self Refresh Mode
375 * 010 == All Banks Precharge
376 * 011 == Mode Register Set
377 * 100 == Extended Mode Register Set
380 * 111 == Normal Operation
383 // .long 0x7c, 0xffcefcff, (1<<22)|(2 << 20)|(1 << 16)| (0 << 8),
384 // .long 0x7c, 0xff8cfcff, (1<<22)|(2 << 20)|(1 << 17)|(1 << 16)| (0 << 8),
385 // .long 0x7c, 0xff80fcff, (1<<22)|(2 << 20)|(1 << 18)|(1 << 17)|(1 << 16)| (0 << 8),
386 0x7c, 0xff82fcff, (1<<22)|(2 << 20)|(1 << 18)|(1 << 16)| (0 << 8),
389 /* Another Intel undocumented register */
390 0x88, 0x080007ff, (1<<31)|(1 << 30)|(1<<28)|(0 << 26)|(0x10 << 21)|(10 << 16)|(0x13 << 11),
392 /* CLOCK_DIS - CK/CK# Disable Register
408 0x8C, 0xfffffff0, 0xf,
410 /* TOLM - Top of Low Memory Register
412 * [15:11] Top of low memory (TOLM)
413 * The address below 4GB that should be treated as RAM,
414 * on a 128MB granularity.
417 /* REMAPBASE - Remap Base Address Regsiter
420 * [09:00] Remap Base Address [35:26] 64M aligned
421 * Bits [25:0] are assumed to be 0.
423 0xc4, 0xfc0007ff, (0x2000 << 0) | (0x3ff << 16),
424 /* REMAPLIMIT - Remap Limit Address Register
427 * [09:00] Remap Limit Address [35:26] 64M aligned
428 * When remaplimit < remapbase this register is disabled.
432 /* DVNP - Device Not Present Register
435 * [04:04] Device 4 Function 1 Present
438 * [03:03] Device 3 Function 1 Present
441 * [02:02] Device 2 Function 1 Present
445 * [00:00] Device 0 Function 1 Present
449 0xe0, 0xffffffe2, (1<<4)|(1<<3)|(1<<2)|(0<<0),
450 0xd8, 0xffff9fff, 0x00000000,
451 0xf4, 0x3f8ffffd, 0x40300002,
452 0x1050, 0xffffffcf, 0x00000030, // d2f0
457 * Routine: ram_set_registers
460 * Trashed: %eax, %ebx, %ecx, %edx, %esi, %eflags
461 * Effects: Do basic ram setup that does not depend on serial
462 * presence detect information.
463 * This sets PCI configuration registers to known good
464 * values based on the table:
465 * constant_register_values
466 * Which are a triple of configuration regiser, mask, and value.
469 /* from 1M or 512K */
470 #define RCOMP_MMIO 0x100000
472 /* DDR RECOMP table */
474 static const long ddr_rcomp_1[] = {
475 0x44332211, 0xc9776655, 0xffffffff, 0xffffffff,
476 0x22111111, 0x55444332, 0xfffca876, 0xffffffff,
478 static const long ddr_rcomp_2[] = {
479 0x00000000, 0x76543210, 0xffffeca8, 0xffffffff,
480 0x21000000, 0xa8765432, 0xffffffec, 0xffffffff,
482 static const long ddr_rcomp_3[] = {
483 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
484 0x88888888, 0x88888888, 0x88888888, 0x88888888,
487 #define rcomp_init_str "Setting RCOMP registers.\r\n"
489 static void write_8dwords(uint32_t src_addr, uint32_t dst_addr) {
493 dword = read32(src_addr);
494 write32(dst_addr, dword);
502 #define SLOW_DOWN_IO inb(0x80);
504 #define SLOW_DOWN_IO udelay(40);
507 /* Estimate that SLOW_DOWN_IO takes about 50&76us*/
508 /* delay for 200us */
511 static void do_delay(void)
514 for(i = 0; i < 16; i++) { SLOW_DOWN_IO }
516 #define DO_DELAY do_delay();
522 #define EXTRA_DELAY DO_DELAY
524 static void ram_set_rcomp_regs(const struct mem_controller *ctrl) {
527 print_debug(rcomp_init_str);
530 /*enable access to the rcomp bar */
531 dword = pci_read_config32(ctrl->d0, 0x0f4);
533 dword |=((1<<30)|1<<22);
534 pci_write_config32(ctrl->d0, 0x0f4, dword);
537 /* Set the MMIO address to 512K */
538 pci_write_config32(ctrl->d0, 0x14, RCOMP_MMIO);
540 dword = read32(RCOMP_MMIO + 0x20);
542 write32(RCOMP_MMIO + 0x20, dword);
545 /* Begin to write the RCOMP registers */
547 write8(RCOMP_MMIO + 0x2c, 0xff);
548 write32(RCOMP_MMIO + 0x30, 0x01040444);
549 write8(RCOMP_MMIO + 0x34, 0x04);
550 write32(RCOMP_MMIO + 0x40, 0);
551 write16(RCOMP_MMIO + 0x44, 0);
552 write16(RCOMP_MMIO + 0x48, 0);
553 write16(RCOMP_MMIO + 0x50, 0);
554 write_8dwords((uint32_t)ddr_rcomp_1, RCOMP_MMIO + 0x60);
555 write_8dwords((uint32_t)ddr_rcomp_2, RCOMP_MMIO + 0x80);
556 write_8dwords((uint32_t)ddr_rcomp_2, RCOMP_MMIO + 0xa0);
557 write_8dwords((uint32_t)ddr_rcomp_2, RCOMP_MMIO + 0x140);
558 write_8dwords((uint32_t)ddr_rcomp_2, RCOMP_MMIO + 0x1c0);
559 write_8dwords((uint32_t)ddr_rcomp_3, RCOMP_MMIO + 0x180);
561 dword = read32(RCOMP_MMIO + 0x20);
564 write32(RCOMP_MMIO + 0x20, dword);
569 /* unblock updates */
570 dword = read32(RCOMP_MMIO + 0x20);
572 write32(RCOMP_MMIO+0x20, dword);
574 write32(RCOMP_MMIO+0x20, dword);
576 write32(RCOMP_MMIO+0x20, dword);
581 /*disable access to the rcomp bar */
582 dword = pci_read_config32(ctrl->d0, 0x0f4);
584 pci_write_config32(ctrl->d0, 0x0f4, dword);
588 static void ram_set_d0f0_regs(const struct mem_controller *ctrl) {
594 max = sizeof(register_values)/sizeof(register_values[0]);
595 for(i = 0; i < max; i += 3) {
598 print_debug_hex32(register_values[i]);
600 print_debug_hex32(register_values[i+2]);
603 reg = pci_read_config32(ctrl->d0,register_values[i]);
604 reg &= register_values[i+1];
605 reg |= register_values[i+2] & ~(register_values[i+1]);
606 pci_write_config32(ctrl->d0,register_values[i], reg);
614 static void sdram_set_registers(const struct mem_controller *ctrl){
615 ram_set_rcomp_regs(ctrl);
616 ram_set_d0f0_regs(ctrl);
621 * Routine: sdram_spd_get_page_size
622 * Arguments: %bl SMBUS_MEM_DEVICE
624 * %edi log base 2 page size of DIMM side 1 in bits
625 * %esi log base 2 page size of DIMM side 2 in bits
627 * Preserved: %ebx (except %bh), %ebp
629 * Trashed: %eax, %bh, %ecx, %edx, %esp, %eflags
630 * Used: %eax, %ebx, %ecx, %edx, %esi, %edi, %esp, %eflags
632 * Effects: Uses serial presence detect to set %edi & %esi
633 * to the page size of a dimm.
635 * %bl SMBUS_MEM_DEVICE
636 * %edi holds the page size for the first side of the DIMM.
637 * %esi holds the page size for the second side of the DIMM.
638 * memory size is represent as a power of 2.
640 * This routine may be worth moving into generic code somewhere.
642 struct dimm_page_size {
647 static struct dimm_page_size sdram_spd_get_page_size(unsigned device) {
651 struct dimm_page_size pgsz;
656 value = spd_read_byte(device, 4); /* columns */
657 if(value < 0) goto hw_err;
658 pgsz.side1 = value & 0xf;
660 /* Get the module data width and convert it to a power of two */
661 value = spd_read_byte(device,7); /* (high byte) */
662 if(value < 0) goto hw_err;
666 value = spd_read_byte(device, 6); /* (low byte) */
667 if(value < 0) goto hw_err;
668 ecx |= (value & 0xff);
670 pgsz.side1 += log2(ecx); /* compute cheap log base 2 */
673 value = spd_read_byte(device, 5); /* number of physical banks */
674 if(value < 0) goto hw_err;
675 if(value==1) goto out;
676 if(value!=2) goto val_err;
678 /* Start with the symmetrical case */
679 pgsz.side2 = pgsz.side1;
680 value = spd_read_byte(device,4); /* columns */
681 if(value < 0) goto hw_err;
682 if((value & 0xf0)==0 ) goto out;
683 pgsz.side2 -=value & 0xf; /* Subtract out columns on side 1 */
684 pgsz.side2 +=(value>>4)& 0xf; /* Add in columns on side 2 */
688 die("Bad SPD value\r\n");
689 /* If an hw_error occurs report that I have no memory */
699 * Routine: sdram_spd_get_width
700 * Arguments: %bl SMBUS_MEM_DEVICE
702 * %edi width of SDRAM chips on DIMM side 1 in bits
703 * %esi width of SDRAM chips on DIMM side 2 in bits
705 * Preserved: %ebx (except %bh), %ebp
707 * Trashed: %eax, %bh, %ecx, %edx, %esp, %eflags
708 * Used: %eax, %ebx, %ecx, %edx, %esi, %edi, %esp, %eflags
710 * Effects: Uses serial presence detect to set %edi & %esi
711 * to the width of a dimm.
713 * %bl SMBUS_MEM_DEVICE
714 * %edi holds the width for the first side of the DIMM.
715 * %esi holds the width for the second side of the DIMM.
716 * memory size is represent as a power of 2.
718 * This routine may be worth moving into generic code somewhere.
725 static struct dimm_width sdram_spd_get_width(unsigned device) {
727 struct dimm_width wd;
733 value = spd_read_byte(device, 13); /* sdram width */
734 if(value < 0 ) goto hw_err;
737 wd.side1 = value & 0x7f;
740 value = spd_read_byte(device, 5); /* number of physical banks */
741 if(value < 0 ) goto hw_err;
742 if(value <=1 ) goto out;
744 /* Start with the symmetrical case */
747 if((ecx & 0x80)==0) goto out;
759 * Routine: sdram_spd_get_dimm_size
760 * Arguments: %bl SMBUS_MEM_DEVICE
762 * %edi log base 2 size of DIMM side 1 in bits
763 * %esi log base 2 size of DIMM side 2 in bits
765 * Preserved: %ebx (except %bh), %ebp
767 * Trashed: %eax, %bh, %ecx, %edx, %esp, %eflags
768 * Used: %eax, %ebx, %ecx, %edx, %esi, %edi, %esp, %eflags
770 * Effects: Uses serial presence detect to set %edi & %esi
771 * the size of a dimm.
773 * %bl SMBUS_MEM_DEVICE
774 * %edi holds the memory size for the first side of the DIMM.
775 * %esi holds the memory size for the second side of the DIMM.
776 * memory size is represent as a power of 2.
778 * This routine may be worth moving into generic code somewhere.
786 static struct dimm_size spd_get_dimm_size(unsigned device)
788 /* Calculate the log base 2 size of a DIMM in bits */
794 /* Note it might be easier to use byte 31 here, it has the DIMM size as
795 * a multiple of 4MB. The way we do it now we can size both
796 * sides of an assymetric dimm.
798 value = spd_read_byte(device, 3); /* rows */
799 if (value < 0) goto hw_err;
800 // if ((value & 0xf) == 0) goto val_err;
801 sz.side1 += value & 0xf;
803 value = spd_read_byte(device, 4); /* columns */
804 if (value < 0) goto hw_err;
805 // if ((value & 0xf) == 0) goto val_err;
806 sz.side1 += value & 0xf;
808 value = spd_read_byte(device, 17); /* banks */
809 if (value < 0) goto hw_err;
810 // if ((value & 0xff) == 0) goto val_err;
812 sz.side1 += log2(value);
814 /* Get the module data width and convert it to a power of two */
815 value = spd_read_byte(device, 7); /* (high byte) */
816 if (value < 0) goto hw_err;
820 low = spd_read_byte(device, 6); /* (low byte) */
821 if (low < 0) goto hw_err;
822 value |= (low & 0xff);
823 // if ((value != 72) && (value != 64)) goto val_err;
824 sz.side1 += log2(value);
827 value = spd_read_byte(device, 5); /* number of physical banks */
828 if (value < 0) goto hw_err;
829 if (value == 1) goto out;
830 // if (value != 2) goto val_err;
832 /* Start with the symmetrical case */
835 value = spd_read_byte(device, 3); /* rows */
836 if (value < 0) goto hw_err;
837 if ((value & 0xf0) == 0) goto out; /* If symmetrical we are done */
838 sz.side2 -= (value & 0x0f); /* Subtract out rows on side 1 */
839 sz.side2 += ((value >> 4) & 0x0f); /* Add in rows on side 2 */
841 value = spd_read_byte(device, 4); /* columns */
842 if (value < 0) goto hw_err;
843 // if ((value & 0xff) == 0) goto val_err;
844 sz.side2 -= (value & 0x0f); /* Subtract out columns on side 1 */
845 sz.side2 += ((value >> 4) & 0x0f); /* Add in columsn on side 2 */
849 die("Bad SPD value\r\n");
850 /* If an hw_error occurs report that I have no memory */
861 * This is a place holder fill this out
862 * Routine: spd_set_row_attributes
863 * Arguments: %bl SMBUS_MEM_DEVICE
865 * %edi log base 2 size of DIMM side 1 in bits
866 * %esi log base 2 size of DIMM side 2 in bits
868 * Preserved: %ebx (except %bh), %ebp
870 * Trashed: %eax, %bh, %ecx, %edx, %esp, %eflags
871 * Used: %eax, %ebx, %ecx, %edx, %esi, %edi, %esp, %eflags
873 * Effects: Uses serial presence detect to set %edi & %esi
874 * the size of a dimm.
876 * %bl SMBUS_MEM_DEVICE
877 * %edi holds the memory size for the first side of the DIMM.
878 * %esi holds the memory size for the second side of the DIMM.
879 * memory size is represent as a power of 2.
881 * This routine may be worth moving into generic code somewhere.
883 static long spd_set_row_attributes(const struct mem_controller *ctrl, long dimm_mask) {
889 /* Walk through all dimms and find the interesection of the support
890 * for ecc sdram and refresh rates
894 for(i = 0; i < DIMM_SOCKETS; i++) {
895 if (!(dimm_mask & (1 << i))) {
898 /* Test to see if I have ecc sdram */
899 struct dimm_page_size sz;
900 sz = sdram_spd_get_page_size(ctrl->channel0[i]); /* SDRAM type */
902 print_debug("page size =");
903 print_debug_hex32(sz.side1);
905 print_debug_hex32(sz.side2);
909 /* Test to see if the dimm is present */
912 /* Test for a valid dimm width */
913 if((sz.side1 <15) || (sz.side1>18) ) {
914 print_err("unsupported page size\r\n");
917 /* double because I have 2 channels */
920 /* Convert to the format needed for the DRA register */
923 /* Place in the %ebp the dra place holder */ //i
924 dword |= sz.side1<<(i<<3);
926 /* Test to see if the second side is present */
930 /* Test for a valid dimm width */
931 if((sz.side2 <15) || (sz.side2>18) ) {
932 print_err("unsupported page size\r\n");
935 /* double because I have 2 channels */
938 /* Convert to the format needed for the DRA register */
941 /* Place in the %ebp the dra place holder */ //i
942 dword |= sz.side2<<((i<<3) + 4 );
947 /* Now add the SDRAM chip width to the DRA */
948 struct dimm_width wd;
949 wd = sdram_spd_get_width(ctrl->channel0[i]);
952 print_debug("width =");
953 print_debug_hex32(wd.side1);
955 print_debug_hex32(wd.side2);
959 if(wd.side1 == 0) continue;
961 /* Enable an x4 device */
962 dword |= 0x08 << (i<<3);
965 if(wd.side2 == 0) continue;
967 /* Enable an x4 device */
968 dword |= 0x08 << ((i<<3 ) + 4);
971 /* go to the next DIMM */
974 /* Write the new row attributes register */
975 pci_write_config32(ctrl->d0, 0x70, dword);
981 #define spd_pre_init "Reading SPD data...\r\n"
982 #define spd_pre_set "setting based on SPD data...\r\n"
983 #define spd_post_init "done\r\n"
986 static const uint32_t refresh_rate_rank[]= {
987 /* Refresh rates ordered from most conservative (lowest)
988 * to most agressive (highest)
989 * disabled 0 -> rank 3
990 * 15.6usec 1 -> rank 1
991 * 7.8 usec 2 -> rank 0
995 static const uint32_t refresh_rate_index[] = {
996 /* Map the spd refresh rates to memory controller settings
1006 #define MAX_SPD_REFRESH_RATE 5
1008 static long spd_set_dram_controller_mode (const struct mem_controller *ctrl, long dimm_mask) {
1016 /* Read the inititial state */
1017 dword = pci_read_config32(ctrl->d0, 0x7c);
1020 /* Test if ECC cmos option is enabled */
1021 movb $RTC_BOOT_BYTE, %al
1026 /* Clear the ecc enable */
1027 andl $~(3 << 20), %esi
1032 /* Walk through all dimms and find the interesection of the support
1033 * for ecc sdram and refresh rates
1037 for(i = 0; i < DIMM_SOCKETS; i++) {
1038 if (!(dimm_mask & (1 << i))) {
1041 /* Test to see if I have ecc sdram */
1042 value = spd_read_byte(ctrl->channel0[i], 11); /* SDRAM type */
1043 if(value < 0) continue;
1045 /* Clear the ecc enable */
1046 dword &= ~(3 << 20);
1048 value = spd_read_byte(ctrl->channel0[i], 12); /* SDRAM refresh rate */
1049 if(value < 0 ) continue;
1051 if(value > MAX_SPD_REFRESH_RATE) { print_err("unsupported refresh rate\r\n");}
1052 // if(value == 0xff) { print_err("unsupported refresh rate\r\n");}
1054 ecx = refresh_rate_index[value];
1056 /* Isolate the old refresh rate setting */
1057 /* Load the refresh rate ranks */
1058 edx = refresh_rate_rank[(dword >> 8) & 3]<<8;
1059 edx |= refresh_rate_rank[ecx] & 0xff;
1061 /* See if the new refresh rate is more conservative than the old
1062 * refresh rate setting. (Lower ranks are more conservative)
1064 if((edx & 0xff)< ((edx >> 8) & 0xff) ) {
1065 /* Clear the old refresh rate */
1067 /* Move in the new refresh rate */
1071 value = spd_read_byte(ctrl->channel0[i], 33); /* Address and command hold time after clock */
1072 if(value < 0) continue;
1073 if(value >= 0xa0) { /* At 133Mhz this constant should be 0x75 */
1074 dword &= ~(1<<16); /* Use two clock cyles instead of one */
1077 /* go to the next DIMM */
1080 /* Now write the controller mode */
1081 pci_write_config32(ctrl->d0, 0x7c, dword);
1086 static long spd_enable_clocks(const struct mem_controller *ctrl, long dimm_mask)
1092 /* Read the inititial state */
1093 dword = pci_read_config32(ctrl->d0, 0x8c);
1095 # Intel clears top bit here, should we?
1096 # No the default is on and for normal timming it should be on. Tom Z
1101 for(i = 0; i < DIMM_SOCKETS; i++) {
1102 if (!(dimm_mask & (1 << i))) {
1105 /* Read any spd byte to see if the dimm is present */
1106 value = spd_read_byte(ctrl->channel0[i], 5); /* Physical Banks */
1107 if(value < 0) continue;
1112 pci_write_config32(ctrl->d0, 0x8c, dword);
1117 static const uint16_t cas_latency_80[] = {
1118 /* For cas latency 2.0 0x01 works and until I see a large test sample
1119 * I am not prepared to change this value, to the intel recommended value
1120 * of 0x0d. Eric Biederman
1122 /* The E7501 requires b1 rather than 01 for CAS2 or memory will be hosed
1123 * CAS 1.5 is claimed to be unsupported, will try to test that
1124 * will need to determine correct values for other CAS values
1125 * (perhaps b5, b1, b6?)
1126 * Steven James 02/06/2003
1129 //# .byte 0x05, 0x01, 0x06
1130 //# .byte 0xb5, 0xb1, 0xb6
1131 0x0, 0x0bb1, 0x0662 /* RCVEN */
1133 static const uint16_t cas_latency_80_4dimms[] = {
1138 static const uint8_t cas_latency_78[] = {
1139 DRT_CAS_1_5, DRT_CAS_2_0, DRT_CAS_2_5
1142 static long spd_set_cas_latency(const struct mem_controller *ctrl, long dimm_mask) {
1143 /* Walk through all dimms and find the interesection of the
1144 * supported cas latencies.
1147 /* Initially allow cas latencies 2.5, 2.0
1148 * which the chipset supports.
1150 uint32_t dword = (1<<3)| (1<<2);// esi
1159 for(i = 0; i < DIMM_SOCKETS; i++) {
1160 if (!(dimm_mask & (1 << i))) {
1163 value = spd_read_byte(ctrl->channel0[i], 18);
1164 if(value < 0) continue;
1165 /* Find the highest supported cas latency */
1166 ecx = log2(value & 0xff);
1169 /* Remember the supported cas latencies */
1170 ecx = (value & 0xff);
1172 /* Verify each cas latency at 133Mhz */
1173 /* Verify slowest/highest CAS latency */
1174 value = spd_read_byte(ctrl->channel0[i], 9);
1175 if(value < 0 ) continue;
1177 /* The bus is too fast so we cannot support this case latency */
1181 /* Verify the highest CAS latency - 0.5 clocks */
1184 value = spd_read_byte(ctrl->channel0[i], 23);
1185 if(value < 0 ) continue;
1187 /* The bus is too fast so we cannot support this cas latency */
1192 /* Verify the highest CAS latency - 1.0 clocks */
1195 value = spd_read_byte(ctrl->channel0[i], 25);
1196 if(value < 0 ) continue;
1198 /* The bus is too fast so we cannot support this cas latency */
1203 /* Now find which cas latencies are supported for the bus */
1205 /* go to the next DIMM */
1208 /* After all of the arduous calculation setup with the fastest
1209 * cas latency I can use.
1211 value = log2f(dword); // bsrl = log2 how about bsfl?
1212 if(value ==0 ) return -1;
1215 byte = pci_read_config8(ctrl->d0, 0x78);
1216 byte &= ~(DRT_CAS_MASK);
1217 byte |= cas_latency_78[ecx];
1218 pci_write_config8(ctrl->d0,0x78, byte);
1220 /* set master DLL reset */
1221 dword = pci_read_config32(ctrl->d0, 0x88);
1224 /* the rest of the references are words */
1225 // ecx<<=1; // don't need shift left, because we already define that in u16 array
1226 pci_write_config32(ctrl->d0, 0x88, dword);
1229 dword &= 0x0c0000ff; /* patch try register 88 is undocumented tnz */
1230 dword |= 0xd2109800;
1232 pci_write_config32(ctrl->d0, 0x88, dword);
1234 word = pci_read_config16(ctrl->d0, 0x80);
1236 word |= cas_latency_80[ecx];
1238 dword = pci_read_config32(ctrl->d0, 0x70);
1240 if((dword & 0xff) !=0 ) {
1242 if((dword & 0xff)!=0) {
1244 if((dword & 0xff)!=0) {
1246 if( (dword & 0xff)!=0) {
1247 word &=~(0x0fff); /* we have dimms in all 4 slots */
1248 word |=cas_latency_80_4dimms[ecx];
1254 pci_write_config16(ctrl->d0, 0x80, word);
1256 dword = pci_read_config32(ctrl->d0, 0x88); /* reset master DLL reset */
1258 pci_write_config32(ctrl->d0, 0x88, dword);
1260 RAM_RESET_DDR_PTR(ctrl);
1266 static long spd_set_dram_timing(const struct mem_controller *ctrl, long dimm_mask) {
1267 /* Walk through all dimms and find the interesection of the
1268 * supported dram timings.
1275 /* Read the inititial state */
1276 dword = pci_read_config32(ctrl->d0, 0x78);
1278 # Intel clears top bit here, should we?
1279 # No the default is on and for normal timming it should be on. Tom Z
1284 for(i = 0; i < DIMM_SOCKETS; i++) {
1285 if (!(dimm_mask & (1 << i))) {
1289 value = spd_read_byte(ctrl->channel0[i], 27);
1290 if(value < 0) continue;
1291 if(value > (15<<2)) {
1292 /* At 133Mhz if row precharge time is above than 15ns than we
1293 * need 3 clocks not 2 clocks.
1298 value = spd_read_byte(ctrl->channel0[i],29);
1299 if(value < 0 ) continue;
1300 if(value > (15<<2)) {
1301 /* At 133Mhz if the Minimum ras to cas delay is about 15ns we
1302 * need 3 clocks not 2 clocks.
1304 dword &= ~((1<<3)|(1<<1));
1307 value = spd_read_byte(ctrl->channel0[i],30);
1308 if(value < 0 ) continue;
1309 /* Convert tRAS from ns to 133Mhz clock cycles */
1310 value <<=1; /* mult by 2 to make 7.5 15 */
1311 value += 15; /* Make certain we round up */
1313 value &= 0xff; /* Clear the upper bits of eax */
1316 /* Don't even process small timings */
1319 /* Die if the value is to large */
1321 die ("unsupported_rcd\r\n");
1323 /* Convert to clocks - 5 */
1325 /* Convert the existing value into clocks - 5 */
1326 tmp = (~((dword>>9) & 3) - 1) & 3;
1327 /* See if we need a slower timing */
1329 /* O.k. put in our slower timing */
1331 dword |= ((~(value + 1)) & 3)<<9 ;
1336 /* Set to a 7 clock read delay. This is for 133Mhz
1337 * with a CAS latency of 2.5 if 2.0 a 6 clock
1339 if( (pci_read_config8(ctrl->d0, 0x78) & 0x30) ==0 ){
1340 dword &= ~(7<<24); /* CAS latency is 2.5, make 7 clks */
1344 * Back to Back Read Turn Around
1346 /* Set to a 3 clock back to back read turn around. This
1347 * is good for CAS latencys 2.5 and 2.0 */
1350 * Back to Back Read-Write Turn Around
1352 /* Set to a 5 clock back to back read to write turn around.
1353 * 4 is a good delay if the CAS latency is 2.0 */
1354 if( ( pci_read_config8(ctrl->d0, 0x78) & (1<<4)) == 0) {
1358 * Back to Back Write-Read Turn Around
1360 /* Set to a 2 clock back to back write to read turn around.
1361 * This is good for 2.5 and 2.0 CAS Latencies. */
1365 pci_write_config32(ctrl->d0, 0x78, dword);
1370 static unsigned int spd_detect_dimms(const struct mem_controller *ctrl)
1375 #if DEBUG_RAM_CONFIG
1376 print_debug("spd_detect_dimms:\r\n");
1378 for(i = 0; i < DIMM_SOCKETS; i++) {
1381 #if DEBUG_RAM_CONFIG
1382 print_debug_hex32(i);
1383 print_debug("\r\n");
1385 device = ctrl->channel0[i];
1387 byte = spd_read_byte(ctrl->channel0[i], 2); /* Type */
1389 dimm_mask |= (1 << i);
1393 device = ctrl->channel1[i];
1395 byte = spd_read_byte(ctrl->channel1[i], 2);
1397 dimm_mask |= (1 << (i + DIMM_SOCKETS));
1403 i = (dimm_mask>>DIMM_SOCKETS);
1404 if(i != (dimm_mask & ( (1<<DIMM_SOCKETS) - 1) ) ) {
1405 die("now we only support dual channel\r\n");
1413 static uint32_t set_dimm_size(const struct mem_controller *ctrl, struct dimm_size sz, uint32_t memsz, unsigned index)
1416 uint32_t base0, base1;
1420 /* Double the size if we are using dual channel memory */
1421 // if (is_dual_channel(ctrl)) {
1422 /* Since I have 2 identical channels double the sizes */
1427 if (sz.side1 != sz.side2) {
1431 /* Make certain side1 of the dimm is at least 64MB */
1432 if (sz.side1 >= (25 + 4)) {
1433 memsz += (1 << (sz.side1 - (25 + 4)) ) ;
1435 /* Write the size of side 1 of the dimm */
1437 pci_write_config8(ctrl->d0, 0x60+(index<<1), byte);
1439 /* Make certain side2 of the dimm is at least 64MB */
1440 if (sz.side2 >= (25 + 4)) {
1441 memsz += (1 << (sz.side2 - (25 + 4)) ) ;
1444 /* Write the size of side 2 of the dimm */
1446 pci_write_config8(ctrl->d0, 0x61+(index<<1), byte);
1448 /* now, fill in DRBs where no physical slot exists */
1450 for(i=index+1;i<4;i++) {
1451 pci_write_config8(ctrl->d0, 0x60+(i<<1),byte);
1452 pci_write_config8(ctrl->d0, 0x61+(i<<1),byte);
1459 /* LAST_DRB_SLOT is a constant for any E7500 board */
1460 #define LAST_DRB_SLOT 0x67
1462 static long spd_set_ram_size(const struct mem_controller *ctrl, long dimm_mask)
1468 for(i = 0; i < DIMM_SOCKETS; i++) {
1469 struct dimm_size sz;
1470 if (!(dimm_mask & (1 << i))) {
1473 sz = spd_get_dimm_size(ctrl->channel0[i]);
1474 #if DEBUG_RAM_CONFIG
1475 print_debug("dimm size =");
1476 print_debug_hex32(sz.side1);
1478 print_debug_hex32(sz.side2);
1479 print_debug("\r\n");
1482 if (sz.side1 == 0) {
1483 return -1; /* Report SPD error */
1485 memsz = set_dimm_size(ctrl, sz, memsz, i);
1487 /* For now hardset everything at 128MB boundaries */
1488 /* %ebp has the ram size in multiples of 64MB */
1489 // cmpl $0, %ebp /* test if there is no mem - smbus went bad */
1490 // jz no_memory_bad_smbus
1492 /* I should really adjust all of this in C after I have resources
1493 * to all of the pcie devices.
1496 /* Round up to 128M granularity */
1501 pci_write_config16(ctrl->d0, 0xc4, word);
1504 /* FIXME will this work with 3.5G of ram? */
1505 /* Put TOLM at 3G */
1506 pci_write_config16(ctrl->d0, 0xc4, 0xc000);
1507 /* Hard code a 1G remap window, right after the ram */
1509 word = 0x40; /* Ensure we are over 4G */
1513 pci_write_config16(ctrl->d0, 0xc6, word);
1515 pci_write_config16(ctrl->d0, 0xc8, word);
1522 static void sdram_set_spd_registers(const struct mem_controller *ctrl) {
1524 #if DEBUG_RAM_CONFIG
1525 print_debug(spd_pre_init);
1527 //activate_spd_rom(ctrl);
1528 dimm_mask = spd_detect_dimms(ctrl);
1529 if (!(dimm_mask & ((1 << DIMM_SOCKETS) - 1))) {
1530 print_debug("No memory for this controller\n");
1533 dimm_mask = spd_enable_clocks(ctrl, dimm_mask);
1536 //spd_verify_dimms(ctrl);
1537 #if DEBUG_RAM_CONFIG
1538 print_debug(spd_pre_set);
1540 dimm_mask = spd_set_row_attributes(ctrl,dimm_mask);
1543 dimm_mask = spd_set_dram_controller_mode(ctrl,dimm_mask);
1546 dimm_mask = spd_set_cas_latency(ctrl,dimm_mask);
1549 dimm_mask = spd_set_dram_timing(ctrl,dimm_mask);
1552 #if DEBUG_RAM_CONFIG
1553 print_debug(spd_post_init);
1556 spd_set_ram_size(ctrl, dimm_mask);
1559 /* Unrecoverable error reading SPD data */
1560 print_err("SPD error - reset\r\n");
1566 #define ecc_pre_init "Initializing ECC state...\r\n"
1567 #define ecc_post_init "ECC state initialized.\r\n"
1568 static void dram_finish(const struct mem_controller *ctrl)
1572 /* Test to see if ECC support is enabled */
1573 dword = pci_read_config32(ctrl->d0, 0x7c);
1578 #if DEBUG_RAM_CONFIG
1579 print_debug(ecc_pre_init);
1581 /* Initialize ECC bits , use ECC zero mode (new to 7501)*/
1582 pci_write_config8(ctrl->d0, 0x52, 0x06);
1583 pci_write_config8(ctrl->d0, 0x52, 0x07);
1585 byte = pci_read_config8(ctrl->d0, 0x52);
1587 } while ( (byte & 0x08 ) == 0);
1589 pci_write_config8(ctrl->d0, 0x52, byte & 0xfc);
1590 #if DEBUG_RAM_CONFIG
1591 print_debug(ecc_post_init);
1594 /* Clear the ECC error bits */
1595 pci_write_config8(ctrl->d0f1, 0x80, 0x03); /* dev 0, function 1, offset 80 */
1596 pci_write_config8(ctrl->d0f1, 0x82, 0x03); /* dev 0, function 1, offset 82 */
1598 pci_write_config32(ctrl->d0f1, 0x40, 1<<18); /* clear dev 0, function 1, offset 40; bit 18 by writing a 1 to it */
1599 pci_write_config32(ctrl->d0f1, 0x44, 1<<18); /* clear dev 0, function 1, offset 44; bit 18 by writing a 1 to it */
1601 pci_write_config8(ctrl->d0, 0x52, 0x0d);
1604 dword = pci_read_config32(ctrl->d0, 0x7c); /* FCS_EN */
1606 pci_write_config32(ctrl->d0, 0x7c, dword);
1609 #if DEBUG_RAM_CONFIG
1616 #if ASM_CONSOLE_LOGLEVEL > BIOS_DEBUG
1617 #define ram_enable_1 "Ram Enable 1\r\n"
1618 #define ram_enable_2 "Ram Enable 2\r\n"
1619 #define ram_enable_3 "Ram Enable 3\r\n"
1620 #define ram_enable_4 "Ram Enable 4\r\n"
1621 #define ram_enable_5 "Ram Enable 5\r\n"
1622 #define ram_enable_6 "Ram Enable 6\r\n"
1623 #define ram_enable_7 "Ram Enable 7\r\n"
1624 #define ram_enable_8 "Ram Enable 8\r\n"
1625 #define ram_enable_9 "Ram Enable 9\r\n"
1626 #define ram_enable_10 "Ram Enable 10\r\n"
1627 #define ram_enable_11 "Ram Enable 11\r\n"
1630 static void sdram_enable(int controllers, const struct mem_controller *ctrl)
1633 /* 1 & 2 Power up and start clocks */
1634 #if DEBUG_RAM_CONFIG
1635 print_debug(ram_enable_1);
1636 print_debug(ram_enable_2);
1639 /* A 200us delay is needed */
1645 #if DEBUG_RAM_CONFIG
1646 print_debug(ram_enable_3);
1651 /* 4 Precharge all */
1652 #if DEBUG_RAM_CONFIG
1653 print_debug(ram_enable_4);
1655 RAM_PRECHARGE(ctrl);
1658 /* wait until the all banks idle state... */
1659 /* 5. Issue EMRS to enable DLL */
1660 #if DEBUG_RAM_CONFIG
1661 print_debug(ram_enable_5);
1667 #if DEBUG_RAM_CONFIG
1668 print_debug(ram_enable_6);
1673 /* Ensure a 200us delay between the DLL reset in step 6 and the final
1674 * mode register set in step 9.
1675 * Infineon needs this before any other command is sent to the ram.
1680 /* 7 Precharge all */
1681 #if DEBUG_RAM_CONFIG
1682 print_debug(ram_enable_7);
1684 RAM_PRECHARGE(ctrl);
1687 /* 8 Now we need 2 AUTO REFRESH / CBR cycles to be performed */
1688 #if DEBUG_RAM_CONFIG
1689 print_debug(ram_enable_8);
1695 /* And for good luck 6 more CBRs */
1709 /* 9 mode register set */
1710 #if DEBUG_RAM_CONFIG
1711 print_debug(ram_enable_9);
1716 /* 10 DDR Receive FIFO RE-Sync */
1717 #if DEBUG_RAM_CONFIG
1718 print_debug(ram_enable_10);
1720 RAM_RESET_DDR_PTR(ctrl);
1723 /* 11 normal operation */
1724 #if DEBUG_RAM_CONFIG
1725 print_debug(ram_enable_11);
1730 /* Finally enable refresh */
1731 ENABLE_REFRESH(ctrl);
1733 //SPECIAL_FINISHUP();