1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/arch/arm/mm/proc-sa110.S
5 * Copyright (C) 1997-2002 Russell King
6 * hacked for non-paged-MM by Hyok S. Choi, 2003.
8 * MMU functions for SA110
10 * These are the low level assembler for performing cache and TLB
11 * functions on the StrongARM-110.
13 #include <linux/linkage.h>
14 #include <linux/init.h>
15 #include <linux/cfi_types.h>
16 #include <linux/pgtable.h>
17 #include <asm/assembler.h>
18 #include <asm/asm-offsets.h>
19 #include <asm/hwcap.h>
20 #include <mach/hardware.h>
21 #include <asm/pgtable-hwdef.h>
22 #include <asm/ptrace.h>
24 #include "proc-macros.S"
27 * the cache line size of the I and D cache
29 #define DCACHELINESIZE 32
34 * cpu_sa110_proc_init()
36 SYM_TYPED_FUNC_START(cpu_sa110_proc_init)
38 mcr p15, 0, r0, c15, c1, 2 @ Enable clock switching
40 SYM_FUNC_END(cpu_sa110_proc_init)
43 * cpu_sa110_proc_fin()
45 SYM_TYPED_FUNC_START(cpu_sa110_proc_fin)
47 mcr p15, 0, r0, c15, c2, 2 @ Disable clock switching
48 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
49 bic r0, r0, #0x1000 @ ...i............
50 bic r0, r0, #0x000e @ ............wca.
51 mcr p15, 0, r0, c1, c0, 0 @ disable caches
53 SYM_FUNC_END(cpu_sa110_proc_fin)
56 * cpu_sa110_reset(loc)
58 * Perform a soft reset of the system. Put the CPU into the
59 * same state as it would be if it had been reset, and branch
60 * to what would be the reset vector.
62 * loc: location to jump to for soft reset
65 .pushsection .idmap.text, "ax"
66 SYM_TYPED_FUNC_START(cpu_sa110_reset)
68 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
69 mcr p15, 0, ip, c7, c10, 4 @ drain WB
71 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
73 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
74 bic ip, ip, #0x000f @ ............wcam
75 bic ip, ip, #0x1100 @ ...i...s........
76 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
78 SYM_FUNC_END(cpu_sa110_reset)
82 * cpu_sa110_do_idle(type)
84 * Cause the processor to idle
89 * 2 = switch to slow processor clock
90 * 3 = switch to fast processor clock
94 SYM_TYPED_FUNC_START(cpu_sa110_do_idle)
95 mcr p15, 0, ip, c15, c2, 2 @ disable clock switching
96 ldr r1, =UNCACHEABLE_ADDR @ load from uncacheable loc
97 ldr r1, [r1, #0] @ force switch to MCLK
101 mcr p15, 0, r0, c15, c8, 2 @ Wait for interrupt, cache aligned
105 mcr p15, 0, r0, c15, c1, 2 @ enable clock switching
107 SYM_FUNC_END(cpu_sa110_do_idle)
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 SYM_TYPED_FUNC_START(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
126 SYM_FUNC_END(cpu_sa110_dcache_clean_area)
128 /* =============================== PageTable ============================== */
131 * cpu_sa110_switch_mm(pgd)
133 * Set the translation base pointer to be as described by pgd.
135 * pgd: new page tables
138 SYM_TYPED_FUNC_START(cpu_sa110_switch_mm)
141 bl v4wb_flush_kern_cache_all @ clears IP
142 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
143 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
148 SYM_FUNC_END(cpu_sa110_switch_mm)
151 * cpu_sa110_set_pte_ext(ptep, pte, ext)
153 * Set a PTE and flush it out
156 SYM_TYPED_FUNC_START(cpu_sa110_set_pte_ext)
158 armv3_set_pte_ext wc_disable=0
160 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
161 mcr p15, 0, r0, c7, c10, 4 @ drain WB
164 SYM_FUNC_END(cpu_sa110_set_pte_ext)
166 .type __sa110_setup, #function
169 mcr p15, 0, r10, c7, c7 @ invalidate I,D caches on v4
170 mcr p15, 0, r10, c7, c10, 4 @ drain write buffer on v4
172 mcr p15, 0, r10, c8, c7 @ invalidate I,D TLBs on v4
177 mrc p15, 0, r0, c1, c0 @ get control register v4
181 .size __sa110_setup, . - __sa110_setup
185 * .RVI ZFRS BLDP WCAM
186 * ..01 0001 ..11 1101
189 .type sa110_crval, #object
191 crval clear=0x00003f3f, mmuset=0x0000113d, ucset=0x00001130
195 @ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
196 define_processor_functions sa110, dabort=v4_early_abort, pabort=legacy_pabort
200 string cpu_arch_name, "armv4"
201 string cpu_elf_name, "v4"
202 string cpu_sa110_name, "StrongARM-110"
206 .section ".proc.info.init", "a"
208 .type __sa110_proc_info,#object
212 .long PMD_TYPE_SECT | \
213 PMD_SECT_BUFFERABLE | \
214 PMD_SECT_CACHEABLE | \
215 PMD_SECT_AP_WRITE | \
217 .long PMD_TYPE_SECT | \
218 PMD_SECT_AP_WRITE | \
220 initfn __sa110_setup, __sa110_proc_info
223 .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT | HWCAP_FAST_MULT
225 .long sa110_processor_functions
229 .size __sa110_proc_info, . - __sa110_proc_info