2 /* ***************************************************************************/
4 /* ***************************************************************************/
9 /* Turn on BTM for early debug based on setup. */
10 /*if (getnvram( TOKEN_BTM_DIAG_MODE) & 3) {*/
12 * The following is only for diagnostics mode; do not use for OLPC
15 /* Set Diagnostic Mode */
16 msrnum = CPU_GLD_MSR_DIAG;
18 msr.lo = DIAG_SEL1_SET | DIAG_SET0_SET;
21 /* Set up GLCP to grab BTM data.*/
22 msrnum = 0x04C00000C; /* GLCP_DBGOUT MSR*/
24 msr.lo = 0x08; /* reset value (SCOPE_SEL = 0) causes FIFO toshift out,*/
25 wrmsr(msrnum, msr); /* exchange it to anything else to prevent this*/
27 /* ;Turn off debug clock*/
28 msrnum = 0x04C000016; /* DBG_CLK_CTL*/
29 msr.lo = 0x00; /* No clock*/
33 /* ;Set debug clock to CPU*/
34 msrnum = 0x04C000016; /* DBG_CLK_CTL*/
35 msr.lo = 0x01; /* CPU CLOCK*/
39 /* ;Set fifo ctl to BTM bits wide*/
40 msrnum = 0x04C00005E; /* FIFO_CTL*/
41 msr.lo = 0x003880000; /* Bit [25:24] are size (11=BTM, 10 = 64 bit, 01= 32 bit, 00 = 16bit)*/
42 wrmsr(msrnum, msr); /* Bit [23:21] are position (100 = CPU downto0)*/
43 /* Bit [19] sets it up in slow data mode.*/
45 /* ;enable fifo loading - BTM sizing will constrain*/
46 /* ; only valid BTM packets to load - this action should always be on*/
48 msrnum = 0x04C00006F; /* GLCP ACTION7 - load fifo*/
49 msr.lo = 0x00000F000; /* Any nibble all 1's will always trigger*/
50 msr.hi = 0x000000000; /* */
53 /* ;start storing diag data in the fifo*/
54 msrnum = 0x04C00005F; /* DIAG CTL*/
55 msr.lo = 0x080000000; /* enable actions*/
59 /* Set up delay on data lines, so that the hold time*/
61 msrnum = 0x04C00000D ; /* GLCP IO DELAY CONTROLS*/
63 msr.hi = 0x080ad6b57; /* RGB delay = 0x07*/
66 /* Set up DF to output diag information on DF pins.*/
67 msrnum = DF_GLD_MSR_MASTER_CONF;
72 msrnum = 0x04C00000C ; /* GLCP_DBGOUT MSR*/
74 msr.lo = 0x0; /* reset value (SCOPE_SEL = 0) causes FIFO to shift out,*/
76 /* end of code for BTM */
79 /* Enable Suspend on Halt*/
80 msrnum = CPU_XC_CONFIG;
82 msr.lo |= XC_CONFIG_SUSP_ON_HLT;
85 /* ENable SUSP and allow TSC to run in Suspend */
86 /* to keep speed detection happy*/
87 msrnum = CPU_BC_CONF_0;
89 msr.lo |= TSC_SUSP_SET | SUSP_EN_SET;
92 /* Setup throttling to proper mode if it is ever enabled.*/
99 /* Only do this if we are building for 5535*/
104 /* Enable CIS mode B in FooGlue*/
105 msrnum = MSR_FG + 0x10;
108 msr.lo |= 2; /* ModeB*/
113 /* Disable DOT PLL. Graphics init will enable it if needed.*/
115 msrnum = GLCP_DOTPLL;
117 msr.lo |= DOTPPL_LOWER_PD_SET;
131 /* I hate to put this check here but it doesn't really work in cpubug.asm*/
132 msrnum = MSR_GLCP+0x17;
134 if (msr.lo >= CPU_REV_2_1){
135 msrnum = CPU_PF_BTB_CONF;
137 msr.lo |= BTB_ENABLE_SET | RETURN_STACK_ENABLE_SET;
142 /* FPU impercise exceptions bit*/
144 /*if (getnvram( TOKEN_FPU_IE_ENABLE) != TVALUE_DISABLE) {*/
146 msrnum = CPU_FPU_MSR_MODE;
148 msr.lo |= FPU_IE_SET;
156 /* This code disables the data cache. Don't execute this
157 * unless you're testing something.
159 /* Allow NVRam to override DM Setup*/
160 /*if (getnvram( TOKEN_CACHE_DM_MODE) != 1) {*/
163 msrnum = CPU_DM_CONFIG0;
165 msr.lo |= DM_CONFIG0_LOWER_DCDIS_SET;
168 /* This code disables the instruction cache. Don't execute
169 * this unless you're testing something.
171 /* Allow NVRam to override IM Setup*/
172 /*if (getnvram( TOKEN_CACHE_IM_MODE) ==1) {*/
174 msrnum = CPU_IM_CONFIG;
176 msr.lo |= IM_CONFIG_LOWER_ICD_SET;