1 /* Memory sub-system initialization code */
5 #include <asm/regdef.h>
6 #include <asm/au1x00.h>
7 #include <asm/mipsregs.h>
9 #define CP0_Config0 $16
10 #define MEM_1MS ((CFG_MHZ) * 1000)
11 #define GPIO_RJ1LY (1<<22)
12 #define GPIO_CFRESET (1<<10)
21 * Step 2) Establish Status Register
22 * (set BEV, clear ERL, clear EXL, clear IE)
28 * Step 3) Establish CP0 Config0
35 * Step 4) Disable Watchpoint facilities
41 * Step 5) Disable the performance counters
43 mtc0 zero, CP0_PERFORMANCE
47 * Step 6) Establish EJTAG Debug register
53 * Step 7) Establish Cause
59 /* Establish Wired (and Random) */
63 /* No workaround if running from ram */
67 bne t1, t3, noCacheJump
70 /*** From AMD YAMON ***/
72 * Step 8) Initialize the caches
85 /* Save return address */
88 /* Run from cacheable space now */
92 li t1, ~0x20000000 /* convert to KSEG0 */
94 addi t0, 5*4 /* 5 insns beyond cachehere */
98 /* Restore return address */
102 * Step 9) Initialize the TLB
104 li t0, 0 # index value
105 li t1, 0x00000000 # entryhi value
106 li t2, 32 # 32 entries
109 /* Probe TLB for matching EntryHi */
114 /* Examine Index[P], 1=no matching entry */
118 addiu t1, t1, 1 # increment t1 (asid)
119 beq zero, t3, tlbloop
122 /* Initialize the TLB entry */
124 mtc0 zero, CP0_ENTRYLO0
125 mtc0 zero, CP0_ENTRYLO1
126 mtc0 zero, CP0_PAGEMASK
134 /* First setup pll:s to make serial work ok */
135 /* We have a 12.5 MHz crystal */
137 li t1, 0x28 /* CPU clock, 500 MHz */
143 /* wait 1mS for clocks to settle */
151 sw t1, 0(t0) /* aux pll */
154 /* Static memory controller */
155 /* RCE0 - can not change while fetching, do so from icache */
156 move t2, ra /* Store return address */
162 move ra, t2 /* Move return addess back */
166 /*** /From YAMON ***/
170 /* Static memory controller */
172 /* RCE0 AMD 29LV800 Flash */
178 li t1, 0x040181D7 /* FIXME */
185 /* RCE1 PCMCIA 250ns */
200 li t1, 0x00000280 /* BE, EW */
208 li t1, 0x10c03f80 /* 1 MB */
213 li t1, 0x00000280 /* BE, EW */
221 li t1, 0x10e03f80 /* 1 MB */
226 /* Set peripherals to a known state */
252 li t0, IC0_FALLINGCLR
285 li t0, IC1_FALLINGCLR
305 li t0, SYS_PININPUTEN
327 /* wait 1mS before setup */
347 /* 64 MB SDRAM at addr 0 */
364 li t1, 0x880007A1 /* Disable */
379 li t1, 0x8A0007A1 /* Enable */
388 /* wait 1mS after setup */
394 /* Setup GPIO pins */
397 li t1, 0x00007025 /* 0x8080 */
401 li t1, 0xFFFFFFFF /* 0x1FFF */
404 /* Turn yellow front led on */
405 /* Release reset on CF */
410 li t1, GPIO_RJ1LY|GPIO_CFRESET
420 /* Fill memory with address */
422 li t1, 0xFFF000 /* 64 MB */
431 li t1, 0xFFF000 /* 64 MB */
445 li t1, 0xFFF000 /* 64 MB */