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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
#include <asm/asmmacro.h>
.text
LEAF(_imem_dmem_init)
.set noreorder
#--- initialize and start COP3
mfc0 $8,$12
nop
nop
or $8,0x80000000
mtc0 $8,$12
nop
nop
#--- invalidate the IRAM with a 0->1 transition
mtc0 $0, $20 # CCTL
nop
nop
li $8,0x00000020 # IRAM Off
mtc0 $8, $20
nop
nop
#--- invalidate the icache and dcache with a 0->1 transition
mtc0 $0, $20 # CCTL
nop
nop
li $8,0x00000202 # Invalid ICACHE and DCACHE
mtc0 $8, $20
nop
nop
#--- load iram base and top
#define IMEM0_SIZE 4096
#define IMEM1_SIZE 4096
la $8,__iram
la $9,0x0fffc000
and $8,$8,$9
mtc3 $8,$0 # IW bas
nop
nop
#ifdef CONFIG_ARCH_CPU_RLX5281
#ifdef CONFIG_RTL8198_REVISION_B
//jasonwang0413
li t6,0xb8000000
lw t7,0(t6)
nop
nop
and t7,t7,0x03
bgtz t7,rev_b
nop
rev_a: // 00
li t6,0xfff
li t4,0xfff
j rev_end
nop
rev_b: // 01
rev_c: // 02
li t6,0x7fff
li t4,0x1fff
rev_end:
nop
nop
add $8,$8,t6
#else
addiu $8,$8,IMEM0_SIZE-1
#endif
mtc3 $8,$1 # IW top
nop
nop
#--- Refill the IRAM with a 0->1 transition
mtc0 $0, $20 # CCTL
nop
nop
li $8,0x00000010 # IRAM Fill
mtc0 $8, $20
nop
nop
#--- load iram base1 and top1
la $8,__iram
#ifdef CONFIG_RTL8198_REVISION_B
add $8,$8,t6
add $8,$8,0x01
#else
add $8,$8,IMEM0_SIZE
#endif
la $9,0x0fffc000
and $8,$8,$9
mtc3 $8,$2 # IW bas 1
nop
nop
#ifdef CONFIG_RTL8198_REVISION_B
add $8,$8,t4
#else
addiu $8,$8,IMEM1_SIZE-1
#endif
mtc3 $8,$3 # IW top 1
nop
nop
#--- Refill the IRAM with a 0->1 transition
mtc0 $0, $20,1 # CCTL
nop
nop
li $8,0x00000010 # IRAM Fill
mtc0 $8, $20,1
nop
nop
#--- load dram base and top
la $8,__dram_start
la $9,__dram_end
beq $8,$9,skip_dramInit
nop
la $9,0x0fffe000
and $8,$8,$9
mtc3 $8,$4 # DW bas
nop
nop
addiu $8,$8,0xfff
mtc3 $8,$5 # DW top
nop
nop
#la $8,__dram_start
#la $9,__dram_end
#beq $8,$9,skip_dramInit
#nop
#la $9,0x0fffe000
add $8,$8,1
#and $8,$8,$9
mtc3 $8,$6 # DW bas 1
nop
nop
addiu $8,$8,0xfff
mtc3 $8,$7 # DW top 1
nop
nop
li $8,0x00000400 # DMEM On // pkshih: add to enable DMEM0 and DMEM1
mtc0 $8, $20 # DMEM0 ON
mtc0 $8, $20,1 # DMEM1 ON
nop
nop
#else
addiu $8,$8,0x3fff
mtc3 $8,$1 # IW top
nop
nop
#--- Refill the IRAM with a 0->1 transition
mtc0 $0, $20 # CCTL
nop
nop
li $8,0x00000010 # IRAM Fill
mtc0 $8, $20
nop
nop
#--- load dram base and top
la $8,__dram_start
la $9,__dram_end
beq $8,$9,skip_dramInit
nop
la $9,0x0fffe000
and $8,$8,$9
mtc3 $8,$4 # DW bas
nop
nop
addiu $8,$8,0x1fff
mtc3 $8,$5 # DW top
nop
nop
#endif
skip_dramInit:
#--- enable icache and dcache
mtc0 $0, $20 # CCTL
nop
nop
.set reorder
j $31
END(_imem_dmem_init)
|