2 * This file is part of the coreboot project.
4 * Copyright (C) 2007-2009 coresystems GmbH
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #include "cx700_registers.h"
26 /* Debugging macros. */
27 #if CONFIG_DEBUG_RAM_SETUP
28 #define PRINTK_DEBUG(x...) printk(BIOS_DEBUG, x)
30 #define PRINTK_DEBUG(x...)
33 #define RAM_COMMAND_NORMAL 0x0
34 #define RAM_COMMAND_NOP 0x1
35 #define RAM_COMMAND_PRECHARGE 0x2
36 #define RAM_COMMAND_MRS 0x3
37 #define RAM_COMMAND_CBR 0x4
39 #define HOSTCTRL PCI_DEV(0, 0, 2)
40 #define MEMCTRL PCI_DEV(0, 0, 3)
44 #ifdef MEM_WIDTH_32BIT_MODE
45 #define SDRAM1X_RA_14 30
46 #define SDRAM1X_RA_13 29
47 #define SDRAM1X_RA_12 28
48 #define SDRAM1X_RA_12_8bk 26
49 #define SDRAM1X_CA_12 15
50 #define SDRAM1X_CA_11 14
51 #define SDRAM1X_CA_09 11
52 #define SDRAM1X_CA_09_8bk 11
53 #define SDRAM1X_BA1 13
54 #define SDRAM1X_BA2_8bk 14
55 #define SDRAM1X_BA1_8bk 13
57 #define SDRAM1X_RA_14 31
58 #define SDRAM1X_RA_13 30
59 #define SDRAM1X_RA_12 29
60 #define SDRAM1X_RA_12_8bk 27
61 #define SDRAM1X_CA_12 16
62 #define SDRAM1X_CA_11 15
63 #define SDRAM1X_CA_09 12
64 #define SDRAM1X_CA_09_8bk 12
65 #define SDRAM1X_BA1 14
66 #define SDRAM1X_BA2_8bk 15
67 #define SDRAM1X_BA1_8bk 14
70 #define MA_Column 0x06
73 #define MA_4_Bank 0x00
74 #define MA_8_Bank 0x08
75 #define MA_12_Row 0x00
76 #define MA_13_Row 0x10
77 #define MA_14_Row 0x20
78 #define MA_15_Row 0x30
79 #define MA_9_Column 0x00
80 #define MA_10_Column 0x02
81 #define MA_11_Column 0x04
82 #define MA_12_Column 0x06
84 #define GET_SPD(i, val, tmp, reg) \
88 for(i = 0; i < 2; i++) { \
89 if(pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_REG_BASE + (i << 1)))) { \
90 tmp = get_spd_data(ctrl, i, reg); \
97 #define REGISTERPRESET(bus,dev,fun,bdfspec) \
99 for (j=0; j<(sizeof((bdfspec))/sizeof(struct regmask)); j++) { \
100 printk(BIOS_DEBUG, "Writing bus " #bus " dev " #dev " fun " #fun " register "); \
101 printk(BIOS_DEBUG, "%02x", (bdfspec)[j].reg); \
102 printk(BIOS_DEBUG, "\n"); \
103 reg = pci_read_config8(PCI_DEV((bus), (dev), (fun)), (bdfspec)[j].reg); \
104 reg &= (bdfspec)[j].mask; \
105 reg |= (bdfspec)[j].val; \
106 pci_write_config8(PCI_DEV((bus), (dev), (fun)), (bdfspec)[j].reg, reg); \
110 static const u8 Reg_Val[] = {
145 /* Host registers initial value */
146 static const u8 Host_Reg_Val[] = {
158 static const u8 Mem_Reg_Init[] = {
172 0x67, 0x00, 0x50, /* OR 0x00 ?? */
185 0x86, 0xff, 0x2c, /* OR 0x28 if we don't want enable top 1M SM memory */
196 static const u8 Dram_Driving_ODT_CTRL[] = {
206 #define Rank0_ODT 0x00
207 #define Rank1_ODT 0x01
208 #define Rank2_ODT 0x02
209 #define Rank3_ODT 0x03
211 #define NB_ODT_75ohm 0x00
212 #define NB_ODT_150ohm 0x01
213 #define DDR2_ODT_75ohm 0x20
214 #define DDR2_ODT_150ohm 0x40
216 static const u8 ODT_TBL[] = {
217 /* RankMap, ODT Control Bits, DRAM & NB ODT setting */
218 0x01, ((NA_ODT << 6) | (NA_ODT << 4) | (NA_ODT << 2) | Rank0_ODT), (DDR2_ODT_150ohm | NB_ODT_75ohm),
219 0x03, ((NA_ODT << 6) | (NA_ODT << 4) | (Rank0_ODT << 2) | Rank1_ODT), (DDR2_ODT_150ohm | NB_ODT_75ohm),
220 0x04, ((NA_ODT << 6) | (Rank2_ODT << 4) | (NA_ODT << 2) | NA_ODT), (DDR2_ODT_150ohm | NB_ODT_75ohm),
221 0x05, ((NA_ODT << 6) | (Rank0_ODT << 4) | (NA_ODT << 2) | Rank2_ODT), (DDR2_ODT_75ohm | NB_ODT_150ohm),
222 0x07, ((NA_ODT << 6) | (Rank0_ODT << 4) | (Rank2_ODT << 2) | Rank2_ODT), (DDR2_ODT_75ohm | NB_ODT_150ohm),
223 0x0c, ((Rank2_ODT << 6) | (Rank3_ODT << 4) | (NA_ODT << 2) | NA_ODT), (DDR2_ODT_150ohm | NB_ODT_75ohm),
224 0x0d, ((Rank0_ODT << 6) | (Rank0_ODT << 4) | (NA_ODT << 2) | Rank2_ODT), (DDR2_ODT_75ohm | NB_ODT_150ohm),
225 0x0f, ((Rank0_ODT << 6) | (Rank0_ODT << 4) | (Rank2_ODT << 2) | Rank2_ODT), (DDR2_ODT_75ohm | NB_ODT_150ohm),
228 static const u8 DQS_DQ_TBL[] = {
229 /* RxE0: DRAM Timing DQS */
230 /* RxE2: DRAM Timing DQ */
238 static const u8 Duty_Control_DDR2[] = {
239 /* RxEC, RxED, RxEE, RXEF */
240 /* DDRII533 1~2 rank, DDRII400 */
241 0x84, 0x10, 0x00, 0x10,
242 /* DDRII533 3~4 rank */
243 0x44, 0x10, 0x00, 0x10,
246 static const u8 ChA_Clk_Phase_DDR2_Table[] = {
247 /* Rx91, Rx92, Rx93 */
248 /* DDRII533 1 rank */
250 /* DDRII533 2~4 rank */
256 static const u8 DQ_DQS_Table[] = {
258 /* DRAM DQ/DQS Output Delay Control */
262 /* DRAM DQ/DQS input Capture Control */
268 static const u8 DQSOChA_DDR2_Driving_Table[] = {
270 /* DDRII533 1~2 rank */
272 /* DDRII533 3~4 rank */
274 /* DDRII400 1~2 rank */
276 /* DDRII400 3~4 rank */
280 /************************************************************************/
281 /* Chipset Performance UP and other setting after DRAM Sizing Registers */
282 /************************************************************************/
283 static const u8 Dram_Table[] = {
293 static const u8 Host_Table[] = {
301 static const u8 Init_Rank_Reg_Table[] = {
302 /* Rank Ending Address Registers */
303 0x40, 0x41, 0x42, 0x43,
304 /* Rank Beginning Address Registers */
305 0x48, 0x49, 0x4a, 0x4b,
306 /* Physical-to-Virtual Rank Mapping Registers */
310 static const u16 DDR2_MRS_table[] = {
312 0x150, 0x1d0, 0x250, 0x2d0, /* BL=4 ;Use 1X-bandwidth MA table to init DRAM */
313 0x158, 0x1d8, 0x258, 0x2d8, /* BL=8 ;Use 1X-bandwidth MA table to init DRAM */
316 #define MRS_DDR2_TWR2 ((0 << 15) | (0 << 20) | (1 << 12))
317 #define MRS_DDR2_TWR3 ((0 << 15) | (1 << 20) | (0 << 12))
318 #define MRS_DDR2_TWR4 ((0 << 15) | (1 << 20) | (1 << 12))
319 #define MRS_DDR2_TWR5 ((1 << 15) | (0 << 20) | (0 << 12))
320 static const u32 DDR2_Twr_table[] = {
327 static const u8 DQSI_Rate_Table[] = {
336 static const u8 REFC_Table[] = {
337 0x65, 0x32, /* DDRII 100 */
338 0x86, 0x43, /* DDRII 266 */
339 0xa8, 0x54, /* DDRII 333 */
340 0xca, 0x65, /* DDRII 400 */
341 0xca, 0x86, /* DDRII 533 */
342 0xca, 0xa8, /* DDRII 666 */
345 static void do_ram_command(const struct mem_controller *ctrl, u8 command)
349 reg = pci_read_config8(MEMCTRL, 0x6b);
350 reg &= 0xf8; /* Clear bits 2-0. */
352 pci_write_config8(MEMCTRL, 0x6b, reg);
354 PRINTK_DEBUG(" Sending RAM command 0x%02x\n", reg);
357 // TODO factor out to another file
358 static void c7_cpu_setup(const struct mem_controller *ctrl)
361 size = sizeof(Reg_Val) / sizeof(Reg_Val[0]);
362 for (i = 0; i < size; i += 2)
363 pci_write_config8(HOSTCTRL, Reg_Val[i], Reg_Val[i + 1]);
366 static void ddr_detect(const struct mem_controller *ctrl)
368 /* FIXME: Only supports 2 ranks per DIMM */
373 for (dimm = 0; dimm < DIMM_SOCKETS; dimm++) {
374 val = get_spd_data(ctrl, dimm, 0);
375 if ((val == 0x80) || (val == 0xff)) {
377 rsize = get_spd_data(ctrl, dimm, SPD_RANK_SIZE);
379 rsize = (rsize << 3) | (rsize >> 5);
381 get_spd_data(ctrl, dimm,
382 SPD_MOD_ATTRIB_RANK) & SPD_MOD_ATTRIB_RANK_NUM_MASK;
385 pci_write_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK_1 + (dimm << 1)),
387 rmap |= (1 << ((dimm << 1) + 1));
390 pci_write_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK_0 + (dimm << 1)),
392 rmap |= (1 << (dimm << 1));
397 pci_write_config8(PCI_DEV(0, 0, 4), SCRATCH_DIMM_NUM, ndimm);
398 pci_write_config8(PCI_DEV(0, 0, 4), SCRATCH_RANK_NUM, nrank);
399 pci_write_config8(PCI_DEV(0, 0, 4), SCRATCH_RANK_MAP, rmap);
402 static void sdram_set_safe_values(const struct mem_controller *ctrl)
404 /* The purpose of this function is to set initial values for the dram
405 * size and timings. It will be replaced with the SPD based function
406 * once the RAM commands are working with these values.
408 u8 regs, val, t, dimm;
411 regs = pci_read_config8(MEMCTRL, 0x6c);
413 printk(BIOS_DEBUG, "DDR2 Detected.\n");
415 die("ERROR: DDR1 memory detected but not supported by coreboot.\n");
419 pci_write_config8(MEMCTRL, 0x6c, regs);
421 /* SPD 5 # of ranks */
422 pci_write_config8(MEMCTRL, 0x6d, 0xc0);
424 /**********************************************/
425 /* Set DRAM Freq (DDR2 533) */
426 /**********************************************/
427 /* SPD 9 SDRAM Cycle Time */
428 GET_SPD(dimm, spds, regs, 9);
430 printk(BIOS_DEBUG, "\nDDRII ");
432 printk(BIOS_DEBUG, "533");
435 } else if (spds <= 0x50) {
436 printk(BIOS_DEBUG, "400");
439 } else if (spds <= 0x60) {
440 printk(BIOS_DEBUG, "333");
443 } else if (spds <= 0x75) {
444 printk(BIOS_DEBUG, "266");
448 printk(BIOS_DEBUG, "200");
452 /* To store DDRII frequence */
453 pci_write_config8(PCI_DEV(0, 0, 4), SCRATCH_DRAM_FREQ, val);
455 /* Manual reset and adjust DLL when DRAM change frequency
456 * This is a necessary sequence.
459 regs = pci_read_config8(MEMCTRL, 0x90);
461 pci_write_config8(MEMCTRL, 0x90, regs);
463 regs = pci_read_config8(MEMCTRL, 0x90);
466 pci_write_config8(MEMCTRL, 0x90, regs);
468 regs = pci_read_config8(MEMCTRL, 0x6b);
471 pci_write_config8(MEMCTRL, 0x6b, regs);
474 pci_write_config8(MEMCTRL, 0x6b, regs);
477 pci_write_config8(MEMCTRL, 0x6b, regs);
478 regs = pci_read_config8(MEMCTRL, 0x6f);
480 pci_write_config8(MEMCTRL, 0x6f, regs);
482 /**********************************************/
483 /* Set DRAM Timing Setting (DDR2 533) */
484 /**********************************************/
485 /* SPD 9 18 23 25 CAS Latency NB3DRAM_REG62[2:0] */
486 /* Read SPD byte 18 CAS Latency */
487 GET_SPD(dimm, spds, regs, SPD_CAS_LAT);
488 printk(BIOS_DEBUG, "\nCAS Supported ");
489 if (spds & SPD_CAS_LAT_2)
490 printk(BIOS_DEBUG, "2 ");
491 if (spds & SPD_CAS_LAT_3)
492 printk(BIOS_DEBUG, "3 ");
493 if (spds & SPD_CAS_LAT_4)
494 printk(BIOS_DEBUG, "4 ");
495 if (spds & SPD_CAS_LAT_5)
496 printk(BIOS_DEBUG, "5 ");
497 if (spds & SPD_CAS_LAT_6)
498 printk(BIOS_DEBUG, "6");
500 /* We don't consider CAS = 6, because CX700 doesn't support it */
501 printk(BIOS_DEBUG, "\n CAS:");
502 if (spds & SPD_CAS_LAT_5) {
503 printk(BIOS_DEBUG, "Starting at CL5");
505 /* See whether we can improve it */
506 GET_SPD(dimm, tmp, regs, SPD_CAS_LAT_MIN_X_1);
507 if ((spds & SPD_CAS_LAT_4) && (tmp < 0x50)) {
508 printk(BIOS_DEBUG, "\n... going to CL4");
511 GET_SPD(dimm, tmp, regs, SPD_CAS_LAT_MIN_X_2);
512 if ((spds & SPD_CAS_LAT_3) && (tmp < 0x50)) {
513 printk(BIOS_DEBUG, "\n... going to CL3");
517 printk(BIOS_DEBUG, "Starting at CL4");
519 GET_SPD(dimm, tmp, regs, SPD_CAS_LAT_MIN_X_1);
520 if ((spds & SPD_CAS_LAT_3) && (tmp < 0x50)) {
521 printk(BIOS_DEBUG, "\n... going to CL3");
524 GET_SPD(dimm, tmp, regs, SPD_CAS_LAT_MIN_X_2);
525 if ((spds & SPD_CAS_LAT_2) && (tmp < 0x50)) {
526 printk(BIOS_DEBUG, "\n... going to CL2");
530 regs = pci_read_config8(MEMCTRL, 0x62);
533 pci_write_config8(MEMCTRL, 0x62, regs);
535 /* SPD 27 Trp NB3DRAM_REG64[3:2] */
536 GET_SPD(dimm, spds, regs, SPD_TRP);
537 printk(BIOS_DEBUG, "\nTrp %d", spds);
539 for (val = 2; val <= 5; val++) {
540 if (spds <= (val * t / 10)) {
546 regs = pci_read_config8(MEMCTRL, 0x64);
549 pci_write_config8(MEMCTRL, 0x64, regs);
551 /* SPD 29 Trcd NB3DRAM_REG64[7:6] */
552 GET_SPD(dimm, spds, regs, SPD_TRCD);
553 printk(BIOS_DEBUG, "\nTrcd %d", spds);
555 for (val = 2; val <= 5; val++) {
556 if (spds <= (val * t / 10)) {
562 regs = pci_read_config8(MEMCTRL, 0x64);
565 pci_write_config8(MEMCTRL, 0x64, regs);
567 /* SPD 30 Tras NB3DRAM_REG62[7:4] */
568 GET_SPD(dimm, spds, regs, SPD_TRAS);
569 printk(BIOS_DEBUG, "\nTras %d", spds);
570 for (val = 5; val <= 20; val++) {
571 if (spds <= (val * t / 10)) {
577 regs = pci_read_config8(MEMCTRL, 0x62);
580 pci_write_config8(MEMCTRL, 0x62, regs);
582 /* SPD 42 SPD 40 Trfc NB3DRAM_REG61[5:0] */
583 GET_SPD(dimm, spds, regs, SPD_TRFC);
584 printk(BIOS_DEBUG, "\nTrfc %d", spds);
586 GET_SPD(dimm, spds, regs, SPD_EX_TRC_TRFC);
591 for (val = 8; val <= 71; val++) {
592 if (tmp <= (val * t / 10)) {
597 regs = pci_read_config8(MEMCTRL, 0x61);
600 pci_write_config8(MEMCTRL, 0x61, regs);
602 /* SPD 28 Trrd NB3DRAM_REG63[7:6] */
603 GET_SPD(dimm, spds, regs, SPD_TRRD);
604 for (val = 2; val <= 5; val++) {
605 if (spds <= (val * t / 10)) {
611 printk(BIOS_DEBUG, "\nTrrd val = 0x%x", val);
612 regs = pci_read_config8(MEMCTRL, 0x63);
615 pci_write_config8(MEMCTRL, 0x63, regs);
617 /* SPD 36 Twr NB3DRAM_REG61[7:6] */
618 GET_SPD(dimm, spds, regs, SPD_TWR);
619 for (val = 2; val <= 5; val++) {
620 if (spds <= (val * t / 10)) {
626 printk(BIOS_DEBUG, "\nTwr val = 0x%x", val);
628 regs = pci_read_config8(MEMCTRL, 0x61);
631 pci_write_config8(MEMCTRL, 0x61, regs);
633 /* SPD 37 Twtr NB3DRAM_REG63[1] */
634 GET_SPD(dimm, spds, regs, SPD_TWTR);
636 printk(BIOS_DEBUG, "\nTwtr 0x%x", spds);
637 if (spds <= (t * 2 / 10))
642 printk(BIOS_DEBUG, "\nTwtr val = 0x%x", val);
644 regs = pci_read_config8(MEMCTRL, 0x63);
647 pci_write_config8(MEMCTRL, 0x63, regs);
649 /* SPD 38 Trtp NB3DRAM_REG63[3] */
650 GET_SPD(dimm, spds, regs, SPD_TRTP);
652 printk(BIOS_DEBUG, "\nTrtp 0x%x", spds);
653 if (spds <= (t * 2 / 10))
658 printk(BIOS_DEBUG, "\nTrtp val = 0x%x", val);
660 regs = pci_read_config8(MEMCTRL, 0x63);
663 pci_write_config8(MEMCTRL, 0x63, regs);
665 /**********************************************/
666 /* Set DRAM DRDY Setting */
667 /**********************************************/
668 /* Write slowest value to register */
669 tmp = sizeof(Host_Reg_Val) / sizeof(Host_Reg_Val[0]);
670 for (val = 0; val < tmp; val += 2)
671 pci_write_config8(HOSTCTRL, Host_Reg_Val[val], Host_Reg_Val[val + 1]);
673 /* F2_RX51[7]=0, disable DRDY timing */
674 regs = pci_read_config8(HOSTCTRL, 0x51);
676 pci_write_config8(HOSTCTRL, 0x51, regs);
678 /**********************************************/
679 /* Set DRAM BurstLength */
680 /**********************************************/
681 regs = pci_read_config8(MEMCTRL, 0x6c);
682 for (dimm = 0; dimm < DIMM_SOCKETS; dimm++) {
683 if (pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_REG_BASE + (dimm << 1)))) {
684 spds = get_spd_data(ctrl, dimm, 16);
691 pci_write_config8(MEMCTRL, 0x6c, regs);
692 val = pci_read_config8(HOSTCTRL, 0x54);
696 pci_write_config8(HOSTCTRL, 0x54, val);
698 /**********************************************/
699 /* Set DRAM Driving Setting */
700 /**********************************************/
701 /* DRAM Timing ODT */
702 tmp = sizeof(Dram_Driving_ODT_CTRL) / sizeof(Dram_Driving_ODT_CTRL[0]);
703 for (val = 0; val < tmp; val += 2)
704 pci_write_config8(MEMCTRL, Dram_Driving_ODT_CTRL[val],
705 Dram_Driving_ODT_CTRL[val + 1]);
707 regs = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_RANK_NUM);
708 val = pci_read_config8(MEMCTRL, 0xd5);
718 regs = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_DIMM_NUM);
721 pci_write_config8(MEMCTRL, 0xd5, val);
723 regs = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_DIMM_NUM);
724 val = pci_read_config8(MEMCTRL, 0xd6);
728 pci_write_config8(MEMCTRL, 0xd6, val);
730 regs = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_RANK_MAP);
731 tmp = sizeof(ODT_TBL) / sizeof(ODT_TBL[0]);
732 for (val = 0; val < tmp; val += 3) {
733 if (regs == ODT_TBL[val]) {
734 pci_write_config8(MEMCTRL, 0xd8, ODT_TBL[val + 1]);
735 /* Store DRAM & NB ODT setting in d0f4_Rxd8 */
736 pci_write_config8(PCI_DEV(0, 0, 4), SCRATCH_DRAM_NB_ODT, ODT_TBL[val + 2]);
741 pci_write_config8(MEMCTRL, 0xd9, 0x0a);
742 regs = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_RANK_NUM);
745 pci_write_config8(MEMCTRL, 0xe0, DQS_DQ_TBL[regs++]);
746 pci_write_config8(MEMCTRL, 0xe2, DQS_DQ_TBL[regs]);
749 pci_write_config8(MEMCTRL, 0xe4, 0x66);
751 /* DRAM Timing MAA */
753 for (dimm = 0; dimm < DIMM_SOCKETS; dimm++) {
754 if (pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_REG_BASE + (dimm << 1)))) {
755 spds = get_spd_data(ctrl, dimm, SPD_PRI_WIDTH);
758 (PCI_DEV(0, 0, 4), (SCRATCH_REG_BASE + (dimm << 1) + 1)))
763 printk(BIOS_DEBUG, "\nchip #%d", val);
768 pci_write_config8(MEMCTRL, 0xe8, regs);
770 /* DRAM Timing MAB */
771 pci_write_config8(MEMCTRL, 0xe9, 0x0);
773 /* DRAM Timing DCLK VT8454C always 0x66 */
774 pci_write_config8(MEMCTRL, 0xe6, 0xaa);
776 /**********************************************/
777 /* Set DRAM Duty Control */
778 /**********************************************/
779 regs = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_RANK_NUM);
782 case 2: /* 1~2 rank */
786 case 4: /* 3~4 rank */
787 regs = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_DRAM_FREQ);
788 if (regs == DDRII_533)
795 for (t = 0; t < 4; t++) {
796 pci_write_config8(MEMCTRL, regs, Duty_Control_DDR2[val]);
801 /**********************************************/
802 /* Set DRAM Clock Control */
803 /**********************************************/
804 /* Write Data Phase */
805 val = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_DRAM_FREQ);
806 regs = pci_read_config8(MEMCTRL, 0x75);
810 pci_write_config8(MEMCTRL, 0x74, 0x07);
815 pci_write_config8(MEMCTRL, 0x74, 0x05);
819 pci_write_config8(MEMCTRL, 0x75, regs);
820 pci_write_config8(MEMCTRL, 0x76, 0x80);
822 /* Clock Phase Control for FeedBack Mode */
823 regs = pci_read_config8(MEMCTRL, 0x90);
825 pci_write_config8(MEMCTRL, 0x90, regs);
827 regs = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_DRAM_FREQ);
830 regs = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_RANK_NUM);
841 regs = pci_read_config8(MEMCTRL, 0x91);
844 pci_write_config8(MEMCTRL, 0x91, regs);
846 for (t = 0; t < 3; t++) {
847 dimm = pci_read_config8(MEMCTRL, regs);
849 dimm |= ChA_Clk_Phase_DDR2_Table[val];
850 pci_write_config8(MEMCTRL, regs, dimm);
855 pci_write_config8(MEMCTRL, 0x97, 0x12);
856 pci_write_config8(MEMCTRL, 0x98, 0x33);
858 regs = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_RANK_0);
859 val = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_RANK_2);
861 pci_write_config8(MEMCTRL, 0x9d, 0x00);
863 pci_write_config8(MEMCTRL, 0x9d, 0x0f);
865 tmp = sizeof(DQ_DQS_Table) / sizeof(DQ_DQS_Table[0]);
866 for (val = 0; val < tmp; val += 2)
867 pci_write_config8(MEMCTRL, DQ_DQS_Table[val], DQ_DQS_Table[val + 1]);
868 regs = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_DRAM_FREQ);
869 if (regs == DDRII_533)
870 pci_write_config8(MEMCTRL, 0x7b, 0xa0);
872 pci_write_config8(MEMCTRL, 0x7b, 0x10);
874 /***************************************************/
875 /* Set necessary register before DRAM initialize */
876 /***************************************************/
877 tmp = sizeof(Mem_Reg_Init) / sizeof(Mem_Reg_Init[0]);
878 for (val = 0; val < tmp; val += 3) {
879 regs = pci_read_config8(MEMCTRL, Mem_Reg_Init[val]);
880 regs &= Mem_Reg_Init[val + 1];
881 regs |= Mem_Reg_Init[val + 2];
882 pci_write_config8(MEMCTRL, Mem_Reg_Init[val], regs);
884 regs = pci_read_config8(HOSTCTRL, 0x51);
885 regs &= 0xbf; // Clear bit 6 Disable Read Around Write
886 pci_write_config8(HOSTCTRL, 0x51, regs);
888 regs = pci_read_config8(HOSTCTRL, 0x54);
890 val = pci_read_config8(HOSTCTRL, 0x57);
900 pci_write_config8(HOSTCTRL, 0x57, val);
902 regs = pci_read_config8(HOSTCTRL, 0x51);
904 pci_write_config8(HOSTCTRL, 0x51, regs);
906 regs = pci_read_config8(MEMCTRL, 0x90);
911 regs = pci_read_config8(MEMCTRL, 0x76);
914 pci_write_config8(MEMCTRL, 0x76, regs);
916 regs = pci_read_config8(MEMCTRL, 0x6f);
918 pci_write_config8(MEMCTRL, 0x6f, regs);
920 /***************************************************/
921 /* Find suitable DQS value for ChA and ChB */
922 /***************************************************/
923 // Set DQS output delay for Channel A
924 regs = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_DRAM_FREQ);
925 val = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_RANK_NUM);
941 for (t = 0; t < 2; t++)
942 pci_write_config8(MEMCTRL, (0x70 + t), DQSOChA_DDR2_Driving_Table[val + t]);
943 // Set DQS output delay for Channel B
944 pci_write_config8(MEMCTRL, 0x72, 0x0);
946 regs = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_RANK_0);
947 val = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_RANK_2);
949 pci_write_config8(MEMCTRL, 0x73, 0xfd);
951 pci_write_config8(MEMCTRL, 0x73, 0x01);
954 static void sdram_set_registers(const struct mem_controller *ctrl)
958 sdram_set_safe_values(ctrl);
961 static void step_20_21(const struct mem_controller *ctrl)
968 val = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_DRAM_NB_ODT);
969 if (val & DDR2_ODT_150ohm)
974 /* Step 21. Normal operation */
975 print_spew("RAM Enable 5: Normal operation\n");
976 do_ram_command(ctrl, RAM_COMMAND_NORMAL);
980 static void step_2_19(const struct mem_controller *ctrl)
986 val = pci_read_config8(MEMCTRL, 0x69);
988 pci_write_config8(MEMCTRL, 0x69, val);
990 /* Step 3 Apply NOP. */
991 print_spew("RAM Enable 1: Apply NOP\n");
992 do_ram_command(ctrl, RAM_COMMAND_NOP);
997 print_spew("SEND: ");
1004 /* 6. Precharge all. Wait tRP. */
1005 print_spew("RAM Enable 2: Precharge all\n");
1006 do_ram_command(ctrl, RAM_COMMAND_PRECHARGE);
1009 print_spew("SEND: ");
1013 /* Step 8. Mode register set. */
1014 print_spew("RAM Enable 4: Mode register set\n");
1015 do_ram_command(ctrl, RAM_COMMAND_MRS); //enable dll
1018 print_spew("SEND: ");
1020 val = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_DRAM_NB_ODT);
1021 if (val & DDR2_ODT_150ohm)
1022 read32(0x102200); //DDR2_ODT_150ohm
1028 print_spew("SEND: ");
1032 /* Step 11. Precharge all. Wait tRP. */
1033 print_spew("RAM Enable 2: Precharge all\n");
1034 do_ram_command(ctrl, RAM_COMMAND_PRECHARGE);
1037 print_spew("SEND: ");
1041 /* Step 13. Perform 8 refresh cycles. Wait tRC each time. */
1042 print_spew("RAM Enable 3: CBR\n");
1043 do_ram_command(ctrl, RAM_COMMAND_CBR);
1045 /* JEDEC says only twice, do 8 times for posterity */
1046 // Step 16: Repeat Step 14 and 15 another 7 times
1047 for (i = 0; i < 8; i++) {
1056 /* Step 17. Mode register set. Wait 200us. */
1057 print_spew("\nRAM Enable 4: Mode register set\n");
1059 //safe value for now, BL=8, WR=4, CAS=4
1060 do_ram_command(ctrl, RAM_COMMAND_MRS);
1063 /* Use Single Chanel temporarily */
1064 val = pci_read_config8(MEMCTRL, 0x6c);
1065 if (val & 0x8) { /* Burst Length = 8 */
1066 val = pci_read_config8(MEMCTRL, 0x62);
1068 i = DDR2_MRS_table[4 + val];
1070 val = pci_read_config8(MEMCTRL, 0x62);
1072 i = DDR2_MRS_table[val];
1076 val = pci_read_config8(MEMCTRL, 0x61);
1078 i |= DDR2_Twr_table[val];
1081 printk(BIOS_DEBUG, "MRS = %08x\n", i);
1086 val = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_DRAM_NB_ODT);
1087 if (val & DDR2_ODT_150ohm)
1088 read32(0x103e00); //EMRS OCD Default
1093 static void sdram_set_vr(const struct mem_controller *ctrl, u8 num)
1096 val = 0x54 + (num >> 1);
1097 reg = pci_read_config8(MEMCTRL, val);
1098 reg &= (0xf << (4 * (num & 0x1)));
1099 reg |= (((0x8 | num) << 4) >> (4 * (num & 0x1)));
1100 pci_write_config8(MEMCTRL, val, reg);
1102 static void sdram_ending_addr(const struct mem_controller *ctrl, u8 num)
1105 /* Set Ending Address */
1107 reg = pci_read_config8(MEMCTRL, val);
1109 pci_write_config8(MEMCTRL, val, reg);
1110 /* Set Beginning Address */
1112 pci_write_config8(MEMCTRL, val, 0x0);
1115 static void sdram_clear_vr_addr(const struct mem_controller *ctrl, u8 num)
1118 val = 0x54 + (num >> 1);
1119 reg = pci_read_config8(MEMCTRL, val);
1120 reg = ~(0x80 >> (4 * (num & 0x1)));
1121 pci_write_config8(MEMCTRL, val, reg);
1123 reg = pci_read_config8(MEMCTRL, val);
1125 pci_write_config8(MEMCTRL, val, reg);
1127 pci_write_config8(MEMCTRL, val, 0x0);
1130 /* Perform sizing DRAM by dynamic method */
1131 static void sdram_calc_size(const struct mem_controller *ctrl, u8 num)
1134 ba = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_FLAGS);
1138 write8((1 << SDRAM1X_RA_12_8bk), 0x0c);
1143 write8((1 << SDRAM1X_CA_09_8bk), 0x0c);
1148 write8((1 << SDRAM1X_BA2_8bk), 0x02);
1150 write8((1 << SDRAM1X_BA1_8bk), 0x01);
1155 write8((1 << SDRAM1X_RA_14), 0x0e);
1157 write8((1 << SDRAM1X_RA_13), 0x0d);
1159 write8((1 << SDRAM1X_RA_12), 0x0c);
1164 write8((1 << SDRAM1X_CA_12), 0x0b);
1166 write8((1 << SDRAM1X_CA_11), 0x0a);
1168 write8((1 << SDRAM1X_CA_09), 0x09);
1173 write8((1 << SDRAM1X_BA1), 0x01);
1177 if (ra < 10 || ra > 15)
1179 if (ca < 8 || ca > 12)
1181 if (ba < 1 || ba > 3)
1184 /* Calculate MA type save to scratch register */
1206 reg |= MA_10_Column;
1209 reg |= MA_11_Column;
1212 reg |= MA_12_Column;
1223 pci_write_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK0_MA_REG + num), reg);
1226 pci_write_config8(PCI_DEV(0, 0, 4), SCRATCH_DRAM_256M_BIT, 1);
1228 /* Calculate rank size save to scratch register */
1229 ra = ra + ca + ba + 3 - 26; /* 1 unit = 64M */
1231 pci_write_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK0_SIZE_REG + num), ra);
1234 static void sdram_enable(const struct mem_controller *ctrl)
1242 /* Init Present Bank */
1243 val = sizeof(Init_Rank_Reg_Table) / sizeof(Init_Rank_Reg_Table[0]);
1244 for (i = 0; i < val; i++)
1245 pci_write_config8(MEMCTRL, Init_Rank_Reg_Table[i], 0x0);
1247 /* Init other banks */
1248 for (i = 0; i < 4; i++) {
1249 reg8 = pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK_0 + i));
1251 sdram_set_vr(ctrl, i);
1252 sdram_ending_addr(ctrl, i);
1255 sdram_clear_vr_addr(ctrl, i);
1259 #ifdef MEM_WIDTH_32BIT_MODE
1260 /****************************************************************/
1261 /* Set Dram 32bit Mode */
1262 /****************************************************************/
1263 reg8 = pci_read_config8(MEMCTRL, 0x6c);
1265 pci_write_config(MEMCTRL, 0x6c, reg8);
1268 /****************************************************************/
1269 /* Find the DQSI Low/High bound and save it to Scratch register */
1270 /****************************************************************/
1271 for (dl = 0; dl < 0x3f; dl += 2) {
1273 reg8 |= 0x80; /* Set Manual Mode */
1274 pci_write_config8(MEMCTRL, 0x77, reg8);
1275 for (i = 0; i < 4; i++) {
1276 reg8 = pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK_0 + i));
1278 sdram_set_vr(ctrl, i);
1279 sdram_ending_addr(ctrl, i);
1280 write32(0, 0x55555555);
1281 write32(4, 0x55555555);
1283 if (read32(0) != 0x55555555)
1285 if (read32(4) != 0x55555555)
1287 write32(0, 0xaaaaaaaa);
1288 write32(4, 0xaaaaaaaa);
1290 if (read32(0) != 0xaaaaaaaa)
1292 if (read32(4) != 0xaaaaaaaa)
1294 sdram_clear_vr_addr(ctrl, i);
1300 sdram_clear_vr_addr(ctrl, i);
1302 printk(BIOS_DEBUG, "\nDQSI Low %08x", dl);
1303 for (dh = dl; dh < 0x3f; dh += 2) {
1305 reg8 |= 0x80; /* Set Manual Mode */
1306 pci_write_config8(MEMCTRL, 0x77, reg8);
1307 for (i = 0; i < 4; i++) {
1308 reg8 = pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK_0 + i));
1310 sdram_set_vr(ctrl, i);
1311 sdram_ending_addr(ctrl, i);
1313 write32(0, 0x55555555);
1314 write32(4, 0x55555555);
1316 if (read32(0) != 0x55555555)
1318 if (read32(4) != 0x55555555)
1320 write32(0, 0xaaaaaaaa);
1321 write32(4, 0xaaaaaaaa);
1323 if (read32(0) != 0xaaaaaaaa)
1325 if (read32(4) != 0xaaaaaaaa)
1327 sdram_clear_vr_addr(ctrl, i);
1331 sdram_clear_vr_addr(ctrl, i);
1335 printk(BIOS_DEBUG, "\nDQSI High %02x", dh);
1336 pci_write_config8(PCI_DEV(0, 0, 4), SCRATCH_CHA_DQSI_LOW_REG, dl);
1337 pci_write_config8(PCI_DEV(0, 0, 4), SCRATCH_CHA_DQSI_HIGH_REG, dh);
1338 reg8 = pci_read_config8(MEMCTRL, 0X90) & 0X7;
1339 val = DQSI_Rate_Table[reg8];
1344 pci_write_config8(PCI_DEV(0, 0, 4), SCRATCH_ChA_DQSI_REG, val);
1347 pci_write_config8(MEMCTRL, 0x77, reg8);
1349 /****************************************************************/
1350 /* Find out the lowest Bank Interleave and Set Register */
1351 /****************************************************************/
1354 reg8 = pci_read_config8(MEMCTRL, 0x69);
1356 reg8 |= 0x80; //8 banks
1357 pci_write_config8(MEMCTRL, 0x69, reg8);
1360 for (i = 0; i < 4; i++) {
1361 reg8 = pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK_0 + i));
1363 reg8 = get_spd_data(ctrl, (i >> 1), 17);
1364 sdram_set_vr(ctrl, i);
1365 sdram_ending_addr(ctrl, i);
1369 write8((1 << SDRAM1X_BA1), 0x01);
1374 write8((1 << SDRAM1X_BA2_8bk), 0x02);
1376 write8((1 << SDRAM1X_BA1_8bk), 0x01);
1381 sdram_clear_vr_addr(ctrl, i);
1385 reg8 = pci_read_config8(MEMCTRL, 0x69);
1388 pci_write_config8(MEMCTRL, 0x69, reg8);
1390 /****************************************************************/
1391 /* DRAM Sizing and Fill MA type */
1392 /****************************************************************/
1393 for (i = 0; i < 4; i++) {
1394 val = pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK_0 + i));
1396 reg8 = get_spd_data(ctrl, (i >> 1), 17);
1397 pci_write_config8(PCI_DEV(0, 0, 4), SCRATCH_FLAGS, reg8);
1399 /* Use MA Type 3 for DRAM sizing */
1400 reg8 = pci_read_config8(MEMCTRL, 0x50);
1403 pci_write_config8(MEMCTRL, 0x50, reg8);
1404 pci_write_config8(MEMCTRL, 0x51, reg8);
1406 /* Use MA Type 5 for DRAM sizing */
1407 reg8 = pci_read_config8(MEMCTRL, 0x50);
1410 pci_write_config8(MEMCTRL, 0x50, reg8);
1411 pci_write_config8(MEMCTRL, 0x51, reg8);
1412 reg8 = pci_read_config8(MEMCTRL, 0x53);
1415 pci_write_config8(MEMCTRL, 0x53, reg8);
1417 sdram_set_vr(ctrl, i);
1419 reg8 = pci_read_config8(MEMCTRL, val);
1420 /* max size 3G for new MA table */
1422 pci_write_config8(MEMCTRL, val, reg8);
1423 /* Set Beginning Address */
1425 pci_write_config8(MEMCTRL, val, 0x0);
1427 sdram_calc_size(ctrl, i);
1430 val = 0x54 + (i >> 1);
1431 reg8 = pci_read_config8(MEMCTRL, val);
1432 reg8 = ~(0x80 >> (4 * (i & 0x1)));
1433 pci_write_config8(MEMCTRL, val, reg8);
1435 reg8 = pci_read_config8(MEMCTRL, val);
1437 pci_write_config8(MEMCTRL, val, reg8);
1439 pci_write_config8(MEMCTRL, val, 0x0);
1444 reg8 = pci_read_config8(MEMCTRL, 0x50);
1446 pci_write_config8(MEMCTRL, 0x50, reg8);
1447 pci_write_config8(MEMCTRL, 0x51, reg8);
1448 reg8 = pci_read_config8(MEMCTRL, 0x6b);
1450 pci_write_config8(MEMCTRL, 0x6b, reg8);
1452 /****************************************************************/
1453 /* DRAM re-initialize for burst length */
1454 /****************************************************************/
1455 for (i = 0; i < 4; i++) {
1456 reg8 = pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK_0 + i));
1458 sdram_set_vr(ctrl, i);
1459 sdram_ending_addr(ctrl, i);
1462 sdram_clear_vr_addr(ctrl, i);
1466 /****************************************************************/
1467 /* Set the MA Type */
1468 /****************************************************************/
1469 reg8 = pci_read_config8(MEMCTRL, 0x50);
1471 pci_write_config8(MEMCTRL, 0x50, reg8);
1473 reg8 = pci_read_config8(MEMCTRL, 0x51);
1475 pci_write_config8(MEMCTRL, 0x51, reg8);
1477 reg8 = pci_read_config8(MEMCTRL, 0x6b);
1479 pci_write_config8(MEMCTRL, 0x6b, reg8);
1481 for (i = 0; i < 4; i += 2) {
1482 reg8 = pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK_0 + i));
1484 reg8 = pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK0_MA_REG + i));
1485 reg8 &= (MA_Bank + MA_Column);
1486 val = pci_read_config8(MEMCTRL, 0x50);
1493 pci_write_config8(MEMCTRL, 0x50, val);
1497 /****************************************************************/
1498 /* Set Start and Ending Address */
1499 /****************************************************************/
1500 dl = 0; /* Begin Address */
1501 dh = 0; /* Ending Address */
1502 for (i = 0; i < 4; i++) {
1503 reg8 = pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK_0 + i));
1505 reg8 = pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK0_SIZE_REG + i));
1509 pci_write_config8(MEMCTRL, (0x40 + i), dh);
1510 pci_write_config8(MEMCTRL, (0x48 + i), dl);
1515 // F7_Rx57 Ending address mirror register
1516 pci_write_config8(PCI_DEV(0, 0, 7), 0x57, dh);
1517 dev = pci_locate_device(PCI_ID(0x1106, 0x324e), 0);
1518 pci_write_config8(dev, 0x57, dh);
1520 pci_write_config8(MEMCTRL, 0x88, dh);
1521 pci_write_config8(MEMCTRL, 0x85, dh);
1522 // also program vlink mirror
1523 pci_write_config8(PCI_DEV(0, 0, 7), 0xe5, dh);
1525 /****************************************************************/
1526 /* Set Physical to Virtual Rank mapping */
1527 /****************************************************************/
1528 pci_write_config32(MEMCTRL, 0x54, 0x0);
1529 for (i = 0; i < 4; i++) {
1530 reg8 = pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK_0 + i));
1532 reg8 = pci_read_config8(MEMCTRL, (0x54 + (i >> 1)));
1533 if (i & 0x1) { /* Odd Rank */
1536 } else { /* Even Rank */
1539 reg8 |= ((0x8 | i) << 4);
1541 pci_write_config8(MEMCTRL, (0x54 + (i >> 1)), reg8);
1545 /****************************************************************/
1546 /* Set DRAM Refresh Counter */
1547 /****************************************************************/
1548 val = pci_read_config8(MEMCTRL, 0X90) & 0X7;
1550 reg8 = pci_read_config8(PCI_DEV(0, 0, 4), SCRATCH_DRAM_256M_BIT);
1553 pci_write_config8(MEMCTRL, 0x6a, REFC_Table[val]);
1555 /****************************************************************/
1556 /* Chipset Performance UP and other setting after DRAM Sizing */
1557 /****************************************************************/
1558 /* Dram Registers */
1559 val = sizeof(Dram_Table) / sizeof(Dram_Table[0]);
1560 for (i = 0; i < val; i += 3) {
1561 reg8 = pci_read_config8(MEMCTRL, Dram_Table[i]);
1562 reg8 &= Dram_Table[i + 1];
1563 reg8 |= Dram_Table[i + 2];
1564 pci_write_config8(MEMCTRL, Dram_Table[i], reg8);
1567 /* Host Registers */
1568 val = sizeof(Host_Table) / sizeof(Host_Table[0]);
1569 for (i = 0; i < val; i += 3) {
1570 reg8 = pci_read_config8(HOSTCTRL, Host_Table[i]);
1571 reg8 &= Host_Table[i + 1];
1572 reg8 |= Host_Table[i + 2];
1573 pci_write_config8(HOSTCTRL, Host_Table[i], reg8);
1577 #ifdef SETUP_PM_REGISTERS
1578 val = sizeof(PM_Table) / sizeof(PM_Table[0]);
1579 for (i = 0; i < val; i += 3) {
1580 reg8 = pci_read_config8(PCI_DEV(0, 0, 4), PM_Table[i]);
1581 reg8 &= PM_Table[i + 1];
1582 reg8 |= PM_Table[i + 2];
1583 pci_write_config8(PCI_DEV(0, 0, 4), PM_Table[i], reg8);
1586 pci_write_config8(HOSTCTRL, 0x5d, 0xb2);
1588 /****************************************************************/
1589 /* UMA registers for N-series projects */
1590 /****************************************************************/
1592 /* Manual setting frame buffer bank */
1593 for (i = 0; i < 4; i++) {
1594 reg8 = pci_read_config8(PCI_DEV(0, 0, 4), (SCRATCH_RANK_0 + i));
1598 pci_write_config8(MEMCTRL, 0xb0, val);
1599 reg8 = 0x40; // Frame buffer size 64M
1600 reg8 |= 0x80; // VGA Enable
1601 reg8 |= 0x0a; // A[31:28] = 1010b
1602 pci_write_config8(MEMCTRL, 0xa1, reg8);
1606 outl(0x80000180, 0xcf8);
1609 outl(0x80000188, 0xcf8);
1612 reg8 = pci_read_config8(PCI_DEV(0, 0, 0), 0xa5);
1614 pci_write_config8(PCI_DEV(0, 0, 0), 0xa5, reg8);
1616 reg8 = pci_read_config8(PCI_DEV(0, 0, 0), 0x91);
1618 pci_write_config8(PCI_DEV(0, 0, 0), 0x91, reg8);
1621 static const struct regmask {
1626 { 0x40, 0x00, 0x8b},
1627 { 0x41, 0x80, 0x43},
1628 { 0x42, 0x00, 0x62},
1629 { 0x43, 0x00, 0x44},
1630 { 0x44, 0x00, 0x34},
1633 { 0x53, 0xf0, 0x0f},
1634 { 0x60, 0x00, 0x03},
1635 { 0x65, 0x00, 0xd9},
1636 { 0x66, 0x00, 0x80},
1637 { 0x67, 0x00, 0x00},
1638 { 0x68, 0x00, 0x01},
1639 { 0x69, 0xe0, 0x03},
1640 { 0x6b, 0x00, 0x10},
1641 { 0x6c, 0xc1, 0x08},
1642 { 0x6e, 0x00, 0x89},
1643 { 0x6f, 0x00, 0x51},
1644 { 0x75, ~0x40, 0x40},
1645 { 0x76, 0x8f, 0x00},
1646 { 0x7b, 0x00, 0xa0},
1647 { 0x86, 0x01, 0x24},
1648 { 0x86, 0x04, 0x29},
1649 { 0x8c, 0x00, 0x00},
1650 { 0x8d, 0x00, 0x00},
1651 { 0x95, ~0x40, 0x00},
1652 { 0xa2, 0x00, 0x44},
1655 { 0x4d, 0x00, 0x24},
1656 { 0x4f, 0x00, 0x01},
1657 { 0xbc, 0x00, 0x21},
1658 { 0xbe, 0x00, 0x00},
1661 { 0x40, ~0x01, 0x01}, // enable timer/counter shadow registers
1662 { 0x67, ~0x03, 0x01},
1663 { 0x5b, ~0x01, 0x00},
1664 { 0x8d, ~0x02, 0x02},
1665 { 0x97, 0x7f, 0x00},
1666 { 0xd2, ~0x18, 0x00},
1667 { 0xe2, ~0x36, 0x06},
1668 { 0xe4, 0x7f, 0x00},
1669 { 0xe5, 0x00, 0x40},
1670 { 0xe6, 0x00, 0x20},
1671 { 0xe7, 0x2f, 0xc0},
1672 { 0xec, ~0x08, 0x00}
1674 { 0x4e, 0x7f, 0x80},
1675 { 0x4f, ~(1 << 6), 1 << 6 }, /* PG_CX700: 14.1.1 enable P2P Bridge Header for External PCI Bus */
1676 { 0x74, ~0x00, 0x04}, /* PG_CX700: 14.1.2 APIC FSB directly up to snmic, not on pci */
1677 { 0x7c, ~0x00, 0x02}, /* PG_CX700: 14.1.1 APIC FSB directly up to snmic, not on pci */
1678 { 0xe6, 0x0, 0x04} // MSI post
1679 }, b0d19f0[] = { /* P2PE */
1680 { 0x42, ~0x08, 0x08}, // Disable HD Audio,
1681 { 0x40, 0x3f, 0x80} // 14.1.3.1.1 of the PG: extended cfg mode for pcie. enable capability, but don't activate
1683 { 0x50, ~0x40, 0x88},
1684 { 0x51, 0x80, 0x7b},
1685 { 0x52, 0x90, 0x6f},
1686 { 0x53, 0x00, 0x88},
1687 { 0x54, 0xe4, 0x16},
1688 { 0x55, 0xf2, 0x04},
1689 { 0x56, 0x0f, 0x00},
1690 { 0x57, ~0x04, 0x00},
1691 { 0x5d, 0x00, 0xb2},
1692 { 0x5e, 0x00, 0x88},
1693 { 0x5f, 0x00, 0xc7},
1697 REGISTERPRESET(0, 0, 0, b0d0f0);
1698 REGISTERPRESET(0, 0, 2, b0d0f2);
1699 REGISTERPRESET(0, 0, 3, b0d0f3);
1700 REGISTERPRESET(0, 1, 0, b0d1f0);
1701 REGISTERPRESET(0, 17, 0, b0d17f0);
1702 REGISTERPRESET(0, 17, 7, b0d17f7);
1703 REGISTERPRESET(0, 19, 0, b0d19f0);