1 /* Memory sub-system initialization code */
4 #include <asm/regdef.h>
5 #include <asm/au1x00.h>
6 #include <asm/mipsregs.h>
8 #define CP0_Config0 $16
9 #define MEM_1MS ((CONFIG_SYS_MHZ) * 1000)
10 #define GPIO_RJ1LY (1<<22)
11 #define GPIO_CFRESET (1<<10)
20 * Step 2) Establish Status Register
21 * (set BEV, clear ERL, clear EXL, clear IE)
27 * Step 3) Establish CP0 Config0
34 * Step 4) Disable Watchpoint facilities
40 * Step 5) Disable the performance counters
42 mtc0 zero, CP0_PERFORMANCE
46 * Step 6) Establish EJTAG Debug register
52 * Step 7) Establish Cause
58 /* Establish Wired (and Random) */
62 /* No workaround if running from ram */
66 bne t1, t3, noCacheJump
69 /*** From AMD YAMON ***/
71 * Step 8) Initialize the caches
84 /* Save return address */
87 /* Run from cacheable space now */
91 li t1, ~0x20000000 /* convert to KSEG0 */
93 addi t0, 5*4 /* 5 insns beyond cachehere */
97 /* Restore return address */
101 * Step 9) Initialize the TLB
103 li t0, 0 # index value
104 li t1, 0x00000000 # entryhi value
105 li t2, 32 # 32 entries
108 /* Probe TLB for matching EntryHi */
113 /* Examine Index[P], 1=no matching entry */
117 addiu t1, t1, 1 # increment t1 (asid)
118 beq zero, t3, tlbloop
121 /* Initialize the TLB entry */
123 mtc0 zero, CP0_ENTRYLO0
124 mtc0 zero, CP0_ENTRYLO1
125 mtc0 zero, CP0_PAGEMASK
133 /* First setup pll:s to make serial work ok */
134 /* We have a 12.5 MHz crystal */
136 li t1, 0x28 /* CPU clock, 500 MHz */
142 /* wait 1mS for clocks to settle */
150 sw t1, 0(t0) /* aux pll */
153 /* Static memory controller */
154 /* RCE0 - can not change while fetching, do so from icache */
155 move t2, ra /* Store return address */
161 move ra, t2 /* Move return addess back */
165 /*** /From YAMON ***/
169 /* Static memory controller */
171 /* RCE0 AMD 29LV800 Flash */
177 li t1, 0x040181D7 /* FIXME */
184 /* RCE1 PCMCIA 250ns */
199 li t1, 0x00000280 /* BE, EW */
207 li t1, 0x10c03f80 /* 1 MB */
212 li t1, 0x00000280 /* BE, EW */
220 li t1, 0x10e03f80 /* 1 MB */
225 /* Set peripherals to a known state */
251 li t0, IC0_FALLINGCLR
284 li t0, IC1_FALLINGCLR
304 li t0, SYS_PININPUTEN
326 /* wait 1mS before setup */
346 /* 64 MB SDRAM at addr 0 */
363 li t1, 0x880007A1 /* Disable */
378 li t1, 0x8A0007A1 /* Enable */
387 /* wait 1mS after setup */
393 /* Setup GPIO pins */
396 li t1, 0x00007025 /* 0x8080 */
400 li t1, 0xFFFFFFFF /* 0x1FFF */
403 /* Turn yellow front led on */
404 /* Release reset on CF */
409 li t1, GPIO_RJ1LY|GPIO_CFRESET
419 /* Fill memory with address */
421 li t1, 0xFFF000 /* 64 MB */
430 li t1, 0xFFF000 /* 64 MB */
444 li t1, 0xFFF000 /* 64 MB */