2 * linux/arch/arm/mm/proc-sa110.S
4 * Copyright (C) 1997-2002 Russell King
5 * hacked for non-paged-MM by Hyok S. Choi, 2003.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * MMU functions for SA110
13 * These are the low level assembler for performing cache and TLB
14 * functions on the StrongARM-110.
16 #include <linux/linkage.h>
17 #include <linux/init.h>
18 #include <asm/assembler.h>
19 #include <asm/asm-offsets.h>
21 #include <asm/hardware.h>
22 #include <asm/pgtable-hwdef.h>
23 #include <asm/pgtable.h>
24 #include <asm/ptrace.h>
26 #include "proc-macros.S"
29 * the cache line size of the I and D cache
31 #define DCACHELINESIZE 32
36 * cpu_sa110_proc_init()
38 ENTRY(cpu_sa110_proc_init)
40 mcr p15, 0, r0, c15, c1, 2 @ Enable clock switching
44 * cpu_sa110_proc_fin()
46 ENTRY(cpu_sa110_proc_fin)
48 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
50 bl v4wb_flush_kern_cache_all @ clean caches
52 mcr p15, 0, r0, c15, c2, 2 @ Disable clock switching
53 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
54 bic r0, r0, #0x1000 @ ...i............
55 bic r0, r0, #0x000e @ ............wca.
56 mcr p15, 0, r0, c1, c0, 0 @ disable caches
60 * cpu_sa110_reset(loc)
62 * Perform a soft reset of the system. Put the CPU into the
63 * same state as it would be if it had been reset, and branch
64 * to what would be the reset vector.
66 * loc: location to jump to for soft reset
69 ENTRY(cpu_sa110_reset)
71 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
72 mcr p15, 0, ip, c7, c10, 4 @ drain WB
74 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
76 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
77 bic ip, ip, #0x000f @ ............wcam
78 bic ip, ip, #0x1100 @ ...i...s........
79 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
83 * cpu_sa110_do_idle(type)
85 * Cause the processor to idle
90 * 2 = switch to slow processor clock
91 * 3 = switch to fast processor clock
95 ENTRY(cpu_sa110_do_idle)
96 mcr p15, 0, ip, c15, c2, 2 @ disable clock switching
97 ldr r1, =UNCACHEABLE_ADDR @ load from uncacheable loc
98 ldr r1, [r1, #0] @ force switch to MCLK
102 mcr p15, 0, r0, c15, c8, 2 @ Wait for interrupt, cache aligned
106 mcr p15, 0, r0, c15, c1, 2 @ enable clock switching
109 /* ================================= CACHE ================================ */
112 * cpu_sa110_dcache_clean_area(addr,sz)
114 * Clean the specified entry of any caches such that the MMU
115 * translation fetches will obtain correct data.
117 * addr: cache-unaligned virtual address
120 ENTRY(cpu_sa110_dcache_clean_area)
121 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
122 add r0, r0, #DCACHELINESIZE
123 subs r1, r1, #DCACHELINESIZE
127 /* =============================== PageTable ============================== */
130 * cpu_sa110_switch_mm(pgd)
132 * Set the translation base pointer to be as described by pgd.
134 * pgd: new page tables
137 ENTRY(cpu_sa110_switch_mm)
140 bl v4wb_flush_kern_cache_all @ clears IP
141 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
142 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
149 * cpu_sa110_set_pte_ext(ptep, pte, ext)
151 * Set a PTE and flush it out
154 ENTRY(cpu_sa110_set_pte_ext)
156 str r1, [r0], #-2048 @ linux version
158 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
160 bic r2, r1, #PTE_SMALL_AP_MASK
161 bic r2, r2, #PTE_TYPE_MASK
162 orr r2, r2, #PTE_TYPE_SMALL
164 tst r1, #L_PTE_USER @ User?
165 orrne r2, r2, #PTE_SMALL_AP_URO_SRW
167 tst r1, #L_PTE_WRITE | L_PTE_DIRTY @ Write and Dirty?
168 orreq r2, r2, #PTE_SMALL_AP_UNO_SRW
170 tst r1, #L_PTE_PRESENT | L_PTE_YOUNG @ Present and Young?
173 str r2, [r0] @ hardware version
175 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
176 mcr p15, 0, r0, c7, c10, 4 @ drain WB
182 .type __sa110_setup, #function
185 mcr p15, 0, r10, c7, c7 @ invalidate I,D caches on v4
186 mcr p15, 0, r10, c7, c10, 4 @ drain write buffer on v4
188 mcr p15, 0, r10, c8, c7 @ invalidate I,D TLBs on v4
193 mrc p15, 0, r0, c1, c0 @ get control register v4
197 .size __sa110_setup, . - __sa110_setup
201 * .RVI ZFRS BLDP WCAM
202 * ..01 0001 ..11 1101
205 .type sa110_crval, #object
207 crval clear=0x00003f3f, mmuset=0x0000113d, ucset=0x00001130
212 * Purpose : Function pointers used to access above functions - all calls
216 .type sa110_processor_functions, #object
217 ENTRY(sa110_processor_functions)
219 .word cpu_sa110_proc_init
220 .word cpu_sa110_proc_fin
221 .word cpu_sa110_reset
222 .word cpu_sa110_do_idle
223 .word cpu_sa110_dcache_clean_area
224 .word cpu_sa110_switch_mm
225 .word cpu_sa110_set_pte_ext
226 .size sa110_processor_functions, . - sa110_processor_functions
230 .type cpu_arch_name, #object
233 .size cpu_arch_name, . - cpu_arch_name
235 .type cpu_elf_name, #object
238 .size cpu_elf_name, . - cpu_elf_name
240 .type cpu_sa110_name, #object
242 .asciz "StrongARM-110"
243 .size cpu_sa110_name, . - cpu_sa110_name
247 .section ".proc.info.init", #alloc, #execinstr
249 .type __sa110_proc_info,#object
253 .long PMD_TYPE_SECT | \
254 PMD_SECT_BUFFERABLE | \
255 PMD_SECT_CACHEABLE | \
256 PMD_SECT_AP_WRITE | \
258 .long PMD_TYPE_SECT | \
259 PMD_SECT_AP_WRITE | \
264 .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT | HWCAP_FAST_MULT
266 .long sa110_processor_functions
270 .size __sa110_proc_info, . - __sa110_proc_info