1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#include <asm/processor.h>
17#include <asm/cputable.h>
18#include <asm/ppc_asm.h>
19#include <asm/mmu-book3e.h>
20#include <asm/asm-offsets.h>
21
22_GLOBAL(__e500_icache_setup)
23 mfspr r0, SPRN_L1CSR1
24 andi. r3, r0, L1CSR1_ICE
25 bnelr
26 oris r0, r0, L1CSR1_CPE@h
27 ori r0, r0, (L1CSR1_ICFI | L1CSR1_ICLFR | L1CSR1_ICE)
28 mtspr SPRN_L1CSR1, r0
29 isync
30 blr
31
32_GLOBAL(__e500_dcache_setup)
33 mfspr r0, SPRN_L1CSR0
34 andi. r3, r0, L1CSR0_DCE
35 bnelr
36 msync
37 isync
38 li r0, 0
39 mtspr SPRN_L1CSR0, r0
40 msync
41 isync
42 li r0, (L1CSR0_DCFI | L1CSR0_CLFC)
43 mtspr SPRN_L1CSR0, r0
44 isync
451: mfspr r0, SPRN_L1CSR0
46 andi. r3, r0, L1CSR0_CLFC
47 bne+ 1b
48 oris r0, r0, L1CSR0_CPE@h
49 ori r0, r0, L1CSR0_DCE
50 msync
51 isync
52 mtspr SPRN_L1CSR0, r0
53 isync
54 blr
55
56
57
58
59
60#define PW20_WAIT_IDLE_BIT 50
61_GLOBAL(setup_pw20_idle)
62 mfspr r3, SPRN_PWRMGTCR0
63
64
65 ori r3, r3, PWRMGTCR0_PW20_WAIT
66 li r11, PW20_WAIT_IDLE_BIT
67
68
69 rlwimi r3, r11, PWRMGTCR0_PW20_ENT_SHIFT, PWRMGTCR0_PW20_ENT
70
71 mtspr SPRN_PWRMGTCR0, r3
72
73 blr
74
75
76
77
78
79#define AV_WAIT_IDLE_BIT 50
80_GLOBAL(setup_altivec_idle)
81 mfspr r3, SPRN_PWRMGTCR0
82
83
84 oris r3, r3, PWRMGTCR0_AV_IDLE_PD_EN@h
85 li r11, AV_WAIT_IDLE_BIT
86
87
88 rlwimi r3, r11, PWRMGTCR0_AV_IDLE_CNT_SHIFT, PWRMGTCR0_AV_IDLE_CNT
89
90 mtspr SPRN_PWRMGTCR0, r3
91
92 blr
93
94#ifdef CONFIG_PPC_E500MC
95_GLOBAL(__setup_cpu_e6500)
96 mflr r6
97#ifdef CONFIG_PPC64
98 bl setup_altivec_ivors
99
100 mfspr r10,SPRN_MMUCFG
101 rlwinm. r10,r10,0,MMUCFG_LPIDSIZE
102 beq 1f
103 bl setup_lrat_ivor
1041:
105#endif
106 bl setup_pw20_idle
107 bl setup_altivec_idle
108 bl __setup_cpu_e5500
109 mtlr r6
110 blr
111#endif
112
113#ifdef CONFIG_PPC32
114#ifdef CONFIG_E200
115_GLOBAL(__setup_cpu_e200)
116
117 mfspr r3,SPRN_HID0
118 ori r3,r3,HID0_DAPUEN@l
119 mtspr SPRN_HID0,r3
120 b __setup_e200_ivors
121#endif
122
123#ifdef CONFIG_E500
124#ifndef CONFIG_PPC_E500MC
125_GLOBAL(__setup_cpu_e500v1)
126_GLOBAL(__setup_cpu_e500v2)
127 mflr r4
128 bl __e500_icache_setup
129 bl __e500_dcache_setup
130 bl __setup_e500_ivors
131
132
133 mfspr r3,SPRN_HID1
134 oris r3,r3,HID1_RFXE@h
135 mtspr SPRN_HID1,r3
136#endif
137 mtlr r4
138 blr
139#else
140_GLOBAL(__setup_cpu_e500mc)
141_GLOBAL(__setup_cpu_e5500)
142 mflr r5
143 bl __e500_icache_setup
144 bl __e500_dcache_setup
145 bl __setup_e500mc_ivors
146
147
148
149
150
151 mfspr r3, SPRN_MMUCFG
152 rlwinm. r3, r3, 0, MMUCFG_LPIDSIZE
153 beq 1f
154 bl __setup_ehv_ivors
155 b 2f
1561:
157 lwz r3, CPU_SPEC_FEATURES(r4)
158
159
160
161
162
163 andis. r6, r3, CPU_FTR_EMB_HV@h
164 beq 2f
165 rlwinm r3, r3, 0, ~CPU_FTR_EMB_HV
166 stw r3, CPU_SPEC_FEATURES(r4)
1672:
168 mtlr r5
169 blr
170#endif
171#endif
172#endif
173
174#ifdef CONFIG_PPC_BOOK3E_64
175_GLOBAL(__restore_cpu_e6500)
176 mflr r5
177 bl setup_altivec_ivors
178
179 mfspr r10,SPRN_MMUCFG
180 rlwinm. r10,r10,0,MMUCFG_LPIDSIZE
181 beq 1f
182 bl setup_lrat_ivor
1831:
184 bl setup_pw20_idle
185 bl setup_altivec_idle
186 bl __restore_cpu_e5500
187 mtlr r5
188 blr
189
190_GLOBAL(__restore_cpu_e5500)
191 mflr r4
192 bl __e500_icache_setup
193 bl __e500_dcache_setup
194 bl __setup_base_ivors
195 bl setup_perfmon_ivor
196 bl setup_doorbell_ivors
197
198
199
200
201
202 mfspr r10,SPRN_MMUCFG
203 rlwinm. r10,r10,0,MMUCFG_LPIDSIZE
204 beq 1f
205 bl setup_ehv_ivors
2061:
207 mtlr r4
208 blr
209
210_GLOBAL(__setup_cpu_e5500)
211 mflr r5
212 bl __e500_icache_setup
213 bl __e500_dcache_setup
214 bl __setup_base_ivors
215 bl setup_perfmon_ivor
216 bl setup_doorbell_ivors
217
218
219
220
221
222 mfspr r10,SPRN_MMUCFG
223 rlwinm. r10,r10,0,MMUCFG_LPIDSIZE
224 beq 1f
225 bl setup_ehv_ivors
226 b 2f
2271:
228 ld r10,CPU_SPEC_FEATURES(r4)
229 LOAD_REG_IMMEDIATE(r9,CPU_FTR_EMB_HV)
230 andc r10,r10,r9
231 std r10,CPU_SPEC_FEATURES(r4)
2322:
233 mtlr r5
234 blr
235#endif
236