7 /* Turn on BTM for early debug based on setup. */
8 // if (getnvram( TOKEN_BTM_DIAG_MODE) & 3) {
9 /* The following is only for diagnostics mode; do not use for OLPC */
11 /* Set Diagnostic Mode */
12 msrnum = CPU_GLD_MSR_DIAG;
14 msr.lo = DIAG_SEL1_SET | DIAG_SET0_SET;
17 /* Set up GLCP to grab BTM data. */
18 msrnum = 0x04C00000C; /* GLCP_DBGOUT MSR */
20 msr.lo = 0x08; /* reset value (SCOPE_SEL = 0) causes FIFO toshift out, */
21 wrmsr(msrnum, msr); /* exchange it to anything else to prevent this */
23 /* Turn off debug clock */
24 msrnum = 0x04C000016; /* DBG_CLK_CTL */
25 msr.lo = 0x00; /* No clock */
29 /* Set debug clock to CPU */
30 msrnum = 0x04C000016; /* DBG_CLK_CTL */
31 msr.lo = 0x01; /* CPU CLOCK */
35 /* Set fifo ctl to BTM bits wide */
36 msrnum = 0x04C00005E; /* FIFO_CTL */
37 msr.lo = 0x003880000; /* Bit [25:24] are size (11=BTM, 10 = 64 bit, 01= 32 bit, 00 = 16bit) */
38 wrmsr(msrnum, msr); /* Bit [23:21] are position (100 = CPU downto0) */
39 /* Bit [19] sets it up in slow data mode. */
41 /* enable fifo loading - BTM sizing will constrain */
42 /* only valid BTM packets to load - this action should always be on */
43 msrnum = 0x04C00006F; /* GLCP ACTION7 - load fifo */
44 msr.lo = 0x00000F000; /* Any nibble all 1's will always trigger */
48 /* start storing diag data in the fifo */
49 msrnum = 0x04C00005F; /* DIAG CTL */
50 msr.lo = 0x080000000; /* enable actions */
54 /* Set up delay on data lines, so that the hold time */
56 msrnum = 0x04C00000D ; /* GLCP IO DELAY CONTROLS */
58 msr.hi = 0x080ad6b57; /* RGB delay = 0x07 */
61 /* Set up DF to output diag information on DF pins. */
62 msrnum = DF_GLD_MSR_MASTER_CONF;
67 msrnum = 0x04C00000C ; /* GLCP_DBGOUT MSR */
69 msr.lo = 0x0; /* reset value (SCOPE_SEL = 0) causes FIFO to shift out, */
71 /* end of code for BTM */
74 /* Enable Suspend on Halt */
75 msrnum = CPU_XC_CONFIG;
77 msr.lo |= XC_CONFIG_SUSP_ON_HLT;
80 /* ENable SUSP and allow TSC to run in Suspend */
81 /* to keep speed detection happy */
82 msrnum = CPU_BC_CONF_0;
84 msr.lo |= TSC_SUSP_SET | SUSP_EN_SET;
87 /* Setup throttling to proper mode if it is ever enabled. */
93 /* Only do this if we are building for 5535 */
96 /* Enable CIS mode B in FooGlue */
97 msrnum = MSR_FG + 0x10;
100 msr.lo |= 2; /* ModeB */
104 /* Disable DOT PLL. Graphics init will enable it if needed. */
105 msrnum = GLCP_DOTPLL;
107 msr.lo |= DOTPPL_LOWER_PD_SET;
117 /* I hate to put this check here but it doesn't really work in cpubug.asm */
118 msrnum = MSR_GLCP+0x17;
120 if (msr.lo >= CPU_REV_2_1){
121 msrnum = CPU_PF_BTB_CONF;
123 msr.lo |= BTB_ENABLE_SET | RETURN_STACK_ENABLE_SET;
127 /* FPU impercise exceptions bit */
128 //if (getnvram( TOKEN_FPU_IE_ENABLE) != TVALUE_DISABLE) {
130 msrnum = CPU_FPU_MSR_MODE;
132 msr.lo |= FPU_IE_SET;
138 /* This code disables the data cache. Don't execute this
139 * unless you're testing something.
141 /* Allow NVRam to override DM Setup */
142 //if (getnvram( TOKEN_CACHE_DM_MODE) != 1) {
144 msrnum = CPU_DM_CONFIG0;
146 msr.lo |= DM_CONFIG0_LOWER_DCDIS_SET;
149 /* This code disables the instruction cache. Don't execute
150 * this unless you're testing something.
152 /* Allow NVRam to override IM Setup */
153 //if (getnvram( TOKEN_CACHE_IM_MODE) ==1) {
155 msrnum = CPU_IM_CONFIG;
157 msr.lo |= IM_CONFIG_LOWER_ICD_SET;