summaryrefslogtreecommitdiff
path: root/src/northbridge/amd/lx/pll_reset.c
blob: be92e9b90d49ffe4aaf3732c4822f5c82a488eb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#define POST_CODE(x) outb(0x80, x)

static void pll_reset(void)
{
	msr_t msrGlcpSysRstpll;

        msrGlcpSysRstpll = rdmsr(GLCP_SYS_RSTPLL);
	
        print_debug("MSR GLCP_SYS_RSTPLL (");
		print_debug_hex32(GLCP_SYS_RSTPLL);
		print_debug(") value is: ");
		print_debug_hex32(msrGlcpSysRstpll.hi);
		print_debug(":");
		print_debug_hex32(msrGlcpSysRstpll.lo);
		print_debug("\n");
	
        msrGlcpSysRstpll.lo &= 0x80000000;

	// If the "we've already been here" flag is set, don't reconfigure the pll
        if ( !(msrGlcpSysRstpll.lo) )
	{ // we haven't configured the PLL; do it now
                POST_CODE(0x77);
	
               /*
                *    64 - 32 	    |  31-0 
                * 
                *      (03FB)
                * 0000 0011 1111 1011 | 1000 0000 1101 1110 0000 0000 1000 0001
                * 
                *      (039C)
                * 0000 0011 1001 1100 | 1000 0000 1101 1110 0000 0000 1000 0001
                * 
                *       (029C)
                * 0000 0010 1001 1100 | 1000 0000 1101 1110 0000 0000 1000 0001
                * 
                *       (02CB)
                * 0000 0010 1100 1011 | 1000 0000 1101 1110 0000 0000 1000 0001
                * 
                * 00101		1			00101 		1 		| 100000	0		0		11011110 	0000 0000 1000 0001
                * GLIUMULT	GLIUDIV		COREMULT	COREDIV	| SWFLAGS	(RO)	(RO)	HOLD_COUNT	
                */

                /* ### 02CB  ###
                 * GLIUMULT = 6
                 * GLIUDIV = 2
                 * COREMULT = 6
                 * COREDIV = 2
                 * 
                 * ### 03FB  ###
                 * GLIUMULT = 8
                 * GLIUDIV = 2
                 * COREMULT = 30
                 * COREDIV = 2
                 * 
                 * ### 039C  ###  bad... why?
                 * GLIUMULT = 8
                 * GLIUDIV = 0
                 * COREMULT = 15
                 * COREDIV = 0
                 * 
                 * ### 029C  ###  good...
                 * GLIUMULT = 6
                 * GLIUDIV = 0
                 * COREMULT = 15
                 * COREDIV = 0
                 * 
                 *  CLOCK = 33 MHz
                 *
                 */

			/* CPU and GLIU mult/div (GLMC_CLK = GLIU_CLK / 2)  */
			msrGlcpSysRstpll.hi = 0x0000029C;

			/* Hold Count - how long we will sit in reset */
			msrGlcpSysRstpll.lo = 0x00DE0000;

			/* Use SWFLAGS to remember: "we've already been here"  */
			msrGlcpSysRstpll.lo |= 0x80000000;

			/* "reset the chip" value */
			msrGlcpSysRstpll.lo |= 0x00000001;

		wrmsr(GLCP_SYS_RSTPLL, msrGlcpSysRstpll);
	}
}