blob: 72b0819326db42821012dbf6321fca296d172bc0 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/arm/mm/proc-arm720.S: MMU functions for ARM720
3 *
4 * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
5 * Rob Scott (rscott@mtrob.fdns.net)
6 * Copyright (C) 2000 ARM Limited, Deep Blue Solutions Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 *
23 * These are the low level assembler for performing cache and TLB
24 * functions on the ARM720T. The ARM720T has a writethrough IDC
25 * cache, so we don't need to clean it.
26 *
27 * Changelog:
28 * 05-09-2000 SJH Created by moving 720 specific functions
29 * out of 'proc-arm6,7.S' per RMK discussion
30 * 07-25-2000 SJH Added idle function.
31 * 08-25-2000 DBS Updated for integration of ARM Ltd version.
32 */
33#include <linux/linkage.h>
34#include <linux/init.h>
35#include <asm/assembler.h>
Sam Ravnborge6ae7442005-09-09 21:08:59 +020036#include <asm/asm-offsets.h>
Russell King74945c82006-03-16 14:44:36 +000037#include <asm/pgtable-hwdef.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070038#include <asm/pgtable.h>
39#include <asm/procinfo.h>
40#include <asm/ptrace.h>
41#include <asm/hardware.h>
42
43/*
44 * Function: arm720_proc_init (void)
45 * : arm720_proc_fin (void)
46 *
47 * Notes : This processor does not require these
48 */
49ENTRY(cpu_arm720_dcache_clean_area)
50ENTRY(cpu_arm720_proc_init)
51 mov pc, lr
52
53ENTRY(cpu_arm720_proc_fin)
54 stmfd sp!, {lr}
55 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
56 msr cpsr_c, ip
57 mrc p15, 0, r0, c1, c0, 0
58 bic r0, r0, #0x1000 @ ...i............
59 bic r0, r0, #0x000e @ ............wca.
60 mcr p15, 0, r0, c1, c0, 0 @ disable caches
61 mcr p15, 0, r1, c7, c7, 0 @ invalidate cache
62 ldmfd sp!, {pc}
63
64/*
65 * Function: arm720_proc_do_idle(void)
66 * Params : r0 = unused
67 * Purpose : put the processer in proper idle mode
68 */
69ENTRY(cpu_arm720_do_idle)
70 mov pc, lr
71
72/*
73 * Function: arm720_switch_mm(unsigned long pgd_phys)
74 * Params : pgd_phys Physical address of page table
75 * Purpose : Perform a task switch, saving the old process' state and restoring
76 * the new.
77 */
78ENTRY(cpu_arm720_switch_mm)
79 mov r1, #0
80 mcr p15, 0, r1, c7, c7, 0 @ invalidate cache
81 mcr p15, 0, r0, c2, c0, 0 @ update page table ptr
82 mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4)
83 mov pc, lr
84
85/*
86 * Function: arm720_set_pte(pte_t *ptep, pte_t pte)
87 * Params : r0 = Address to set
88 * : r1 = value to set
89 * Purpose : Set a PTE and flush it out of any WB cache
90 */
91 .align 5
92ENTRY(cpu_arm720_set_pte)
93 str r1, [r0], #-2048 @ linux version
94
95 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
96
97 bic r2, r1, #PTE_SMALL_AP_MASK
98 bic r2, r2, #PTE_TYPE_MASK
99 orr r2, r2, #PTE_TYPE_SMALL
100
101 tst r1, #L_PTE_USER @ User?
102 orrne r2, r2, #PTE_SMALL_AP_URO_SRW
103
104 tst r1, #L_PTE_WRITE | L_PTE_DIRTY @ Write and Dirty?
105 orreq r2, r2, #PTE_SMALL_AP_UNO_SRW
106
107 tst r1, #L_PTE_PRESENT | L_PTE_YOUNG @ Present and Young
108 movne r2, #0
109
110 str r2, [r0] @ hardware version
111 mov pc, lr
112
113/*
114 * Function: arm720_reset
115 * Params : r0 = address to jump to
116 * Notes : This sets up everything for a reset
117 */
118ENTRY(cpu_arm720_reset)
119 mov ip, #0
120 mcr p15, 0, ip, c7, c7, 0 @ invalidate cache
121 mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4)
122 mrc p15, 0, ip, c1, c0, 0 @ get ctrl register
123 bic ip, ip, #0x000f @ ............wcam
124 bic ip, ip, #0x2100 @ ..v....s........
125 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
126 mov pc, r0
127
128 __INIT
129
130 .type __arm710_setup, #function
131__arm710_setup:
132 mov r0, #0
133 mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
134 mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
135 mrc p15, 0, r0, c1, c0 @ get control register
136 ldr r5, arm710_cr1_clear
137 bic r0, r0, r5
138 ldr r5, arm710_cr1_set
139 orr r0, r0, r5
140 mov pc, lr @ __ret (head.S)
141 .size __arm710_setup, . - __arm710_setup
142
143 /*
144 * R
145 * .RVI ZFRS BLDP WCAM
146 * .... 0001 ..11 1101
147 *
148 */
149 .type arm710_cr1_clear, #object
150 .type arm710_cr1_set, #object
151arm710_cr1_clear:
152 .word 0x0f3f
153arm710_cr1_set:
154 .word 0x013d
155
156 .type __arm720_setup, #function
157__arm720_setup:
158 mov r0, #0
159 mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
160 mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
161 mrc p15, 0, r0, c1, c0 @ get control register
162 ldr r5, arm720_cr1_clear
163 bic r0, r0, r5
164 ldr r5, arm720_cr1_set
165 orr r0, r0, r5
166 mov pc, lr @ __ret (head.S)
167 .size __arm720_setup, . - __arm720_setup
168
169 /*
170 * R
171 * .RVI ZFRS BLDP WCAM
172 * ..1. 1001 ..11 1101
173 *
174 */
175 .type arm720_cr1_clear, #object
176 .type arm720_cr1_set, #object
177arm720_cr1_clear:
178 .word 0x2f3f
179arm720_cr1_set:
180 .word 0x213d
181
182 __INITDATA
183
184/*
185 * Purpose : Function pointers used to access above functions - all calls
186 * come through these
187 */
188 .type arm720_processor_functions, #object
189ENTRY(arm720_processor_functions)
190 .word v4t_late_abort
191 .word cpu_arm720_proc_init
192 .word cpu_arm720_proc_fin
193 .word cpu_arm720_reset
194 .word cpu_arm720_do_idle
195 .word cpu_arm720_dcache_clean_area
196 .word cpu_arm720_switch_mm
197 .word cpu_arm720_set_pte
198 .size arm720_processor_functions, . - arm720_processor_functions
199
200 .section ".rodata"
201
202 .type cpu_arch_name, #object
203cpu_arch_name: .asciz "armv4t"
204 .size cpu_arch_name, . - cpu_arch_name
205
206 .type cpu_elf_name, #object
207cpu_elf_name: .asciz "v4"
208 .size cpu_elf_name, . - cpu_elf_name
209
210 .type cpu_arm710_name, #object
211cpu_arm710_name:
212 .asciz "ARM710T"
213 .size cpu_arm710_name, . - cpu_arm710_name
214
215 .type cpu_arm720_name, #object
216cpu_arm720_name:
217 .asciz "ARM720T"
218 .size cpu_arm720_name, . - cpu_arm720_name
219
220 .align
221
222/*
223 * See linux/include/asm-arm/procinfo.h for a definition of this structure.
224 */
225
Ben Dooks02b7dd12005-09-20 16:35:03 +0100226 .section ".proc.info.init", #alloc, #execinstr
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227
228 .type __arm710_proc_info, #object
229__arm710_proc_info:
230 .long 0x41807100 @ cpu_val
231 .long 0xffffff00 @ cpu_mask
232 .long PMD_TYPE_SECT | \
233 PMD_SECT_BUFFERABLE | \
234 PMD_SECT_CACHEABLE | \
235 PMD_BIT4 | \
236 PMD_SECT_AP_WRITE | \
237 PMD_SECT_AP_READ
238 b __arm710_setup @ cpu_flush
239 .long cpu_arch_name @ arch_name
240 .long cpu_elf_name @ elf_name
241 .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
242 .long cpu_arm710_name @ name
243 .long arm720_processor_functions
244 .long v4_tlb_fns
245 .long v4wt_user_fns
246 .long v4_cache_fns
247 .size __arm710_proc_info, . - __arm710_proc_info
248
249 .type __arm720_proc_info, #object
250__arm720_proc_info:
251 .long 0x41807200 @ cpu_val
252 .long 0xffffff00 @ cpu_mask
253 .long PMD_TYPE_SECT | \
254 PMD_SECT_BUFFERABLE | \
255 PMD_SECT_CACHEABLE | \
256 PMD_BIT4 | \
257 PMD_SECT_AP_WRITE | \
258 PMD_SECT_AP_READ
259 b __arm720_setup @ cpu_flush
260 .long cpu_arch_name @ arch_name
261 .long cpu_elf_name @ elf_name
262 .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
263 .long cpu_arm720_name @ name
264 .long arm720_processor_functions
265 .long v4_tlb_fns
266 .long v4wt_user_fns
267 .long v4_cache_fns
268 .size __arm720_proc_info, . - __arm720_proc_info