1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#include <linux/linkage.h>
22#include <linux/init.h>
23#include <asm/assembler.h>
24#include <asm/asm-offsets.h>
25#include <asm/hwcap.h>
26#include <mach/hardware.h>
27#include <asm/pgtable-hwdef.h>
28#include <asm/pgtable.h>
29
30#include "proc-macros.S"
31
32
33
34
35#define DCACHELINESIZE 32
36
37 .section .text
38
39
40
41
42ENTRY(cpu_sa1100_proc_init)
43 mov r0,
44 mcr p15, 0, r0, c15, c1, 2 @ Enable clock switching
45 mcr p15, 0, r0, c9, c0, 5 @ Allow read-buffer operations from userland
46 ret lr
47
48
49
50
51
52
53
54
55ENTRY(cpu_sa1100_proc_fin)
56 mcr p15, 0, ip, c15, c2, 2 @ Disable clock switching
57 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
58 bic r0, r0,
59 bic r0, r0,
60 mcr p15, 0, r0, c1, c0, 0 @ disable caches
61 ret lr
62
63
64
65
66
67
68
69
70
71
72 .align 5
73 .pushsection .idmap.text, "ax"
74ENTRY(cpu_sa1100_reset)
75 mov ip,
76 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
77 mcr p15, 0, ip, c7, c10, 4 @ drain WB
78#ifdef CONFIG_MMU
79 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
80#endif
81 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
82 bic ip, ip,
83 bic ip, ip,
84 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
85 ret r0
86ENDPROC(cpu_sa1100_reset)
87 .popsection
88
89
90
91
92
93
94
95
96
97
98
99
100 .align 5
101ENTRY(cpu_sa1100_do_idle)
102 mov r0, r0 @ 4 nop padding
103 mov r0, r0
104 mov r0, r0
105 mov r0, r0 @ 4 nop padding
106 mov r0, r0
107 mov r0, r0
108 mov r0,
109 ldr r1, =UNCACHEABLE_ADDR @ ptr to uncacheable address
110 @ --- aligned to a cache line
111 mcr p15, 0, r0, c15, c2, 2 @ disable clock switching
112 ldr r1, [r1,
113 mcr p15, 0, r0, c15, c8, 2 @ wait for interrupt
114 mov r0, r0 @ safety
115 mcr p15, 0, r0, c15, c1, 2 @ enable clock switching
116 ret lr
117
118
119
120
121
122
123
124
125
126
127
128 .align 5
129ENTRY(cpu_sa1100_dcache_clean_area)
1301: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
131 add r0, r0,
132 subs r1, r1,
133 bhi 1b
134 ret lr
135
136
137
138
139
140
141
142
143
144
145 .align 5
146ENTRY(cpu_sa1100_switch_mm)
147#ifdef CONFIG_MMU
148 str lr, [sp,
149 bl v4wb_flush_kern_cache_all @ clears IP
150 mcr p15, 0, ip, c9, c0, 0 @ invalidate RB
151 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
152 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
153 ldr pc, [sp],
154#else
155 ret lr
156#endif
157
158
159
160
161
162
163 .align 5
164ENTRY(cpu_sa1100_set_pte_ext)
165#ifdef CONFIG_MMU
166 armv3_set_pte_ext wc_disable=0
167 mov r0, r0
168 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
169 mcr p15, 0, r0, c7, c10, 4 @ drain WB
170#endif
171 ret lr
172
173.globl cpu_sa1100_suspend_size
174.equ cpu_sa1100_suspend_size, 4 * 3
175#ifdef CONFIG_ARM_CPU_SUSPEND
176ENTRY(cpu_sa1100_do_suspend)
177 stmfd sp!, {r4 - r6, lr}
178 mrc p15, 0, r4, c3, c0, 0 @ domain ID
179 mrc p15, 0, r5, c13, c0, 0 @ PID
180 mrc p15, 0, r6, c1, c0, 0 @ control reg
181 stmia r0, {r4 - r6} @ store cp regs
182 ldmfd sp!, {r4 - r6, pc}
183ENDPROC(cpu_sa1100_do_suspend)
184
185ENTRY(cpu_sa1100_do_resume)
186 ldmia r0, {r4 - r6} @ load cp regs
187 mov ip,
188 mcr p15, 0, ip, c8, c7, 0 @ flush I+D TLBs
189 mcr p15, 0, ip, c7, c7, 0 @ flush I&D cache
190 mcr p15, 0, ip, c9, c0, 0 @ invalidate RB
191 mcr p15, 0, ip, c9, c0, 5 @ allow user space to use RB
192
193 mcr p15, 0, r4, c3, c0, 0 @ domain ID
194 mcr p15, 0, r1, c2, c0, 0 @ translation table base addr
195 mcr p15, 0, r5, c13, c0, 0 @ PID
196 mov r0, r6 @ control register
197 b cpu_resume_mmu
198ENDPROC(cpu_sa1100_do_resume)
199#endif
200
201 .type __sa1100_setup,
202__sa1100_setup:
203 mov r0,
204 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4
205 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4
206#ifdef CONFIG_MMU
207 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4
208#endif
209 adr r5, sa1100_crval
210 ldmia r5, {r5, r6}
211 mrc p15, 0, r0, c1, c0 @ get control register v4
212 bic r0, r0, r5
213 orr r0, r0, r6
214 ret lr
215 .size __sa1100_setup, . - __sa1100_setup
216
217
218
219
220
221
222
223 .type sa1100_crval,
224sa1100_crval:
225 crval clear=0x00003f3f, mmuset=0x0000313d, ucset=0x00001130
226
227 __INITDATA
228
229
230
231
232
233 @ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
234 define_processor_functions sa1100, dabort=v4_early_abort, pabort=legacy_pabort, suspend=1
235
236 .section ".rodata"
237
238 string cpu_arch_name, "armv4"
239 string cpu_elf_name, "v4"
240 string cpu_sa1100_name, "StrongARM-1100"
241 string cpu_sa1110_name, "StrongARM-1110"
242
243 .align
244
245 .section ".proc.info.init",
246
247.macro sa1100_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req
248 .type __\name\()_proc_info,
249__\name\()_proc_info:
250 .long \cpu_val
251 .long \cpu_mask
252 .long PMD_TYPE_SECT | \
253 PMD_SECT_BUFFERABLE | \
254 PMD_SECT_CACHEABLE | \
255 PMD_SECT_AP_WRITE | \
256 PMD_SECT_AP_READ
257 .long PMD_TYPE_SECT | \
258 PMD_SECT_AP_WRITE | \
259 PMD_SECT_AP_READ
260 initfn __sa1100_setup, __\name\()_proc_info
261 .long cpu_arch_name
262 .long cpu_elf_name
263 .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT | HWCAP_FAST_MULT
264 .long \cpu_name
265 .long sa1100_processor_functions
266 .long v4wb_tlb_fns
267 .long v4_mc_user_fns
268 .long v4wb_cache_fns
269 .size __\name\()_proc_info, . - __\name\()_proc_info
270.endm
271
272 sa1100_proc_info sa1100, 0x4401a110, 0xfffffff0, cpu_sa1100_name
273 sa1100_proc_info sa1110, 0x6901b110, 0xfffffff0, cpu_sa1110_name
274