2 * linux/arch/arm/mm/proc-arm720.S: MMU functions for ARM720
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.
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.
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.
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
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.
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.
33 #include <linux/linkage.h>
34 #include <linux/init.h>
35 #include <asm/assembler.h>
36 #include <asm/asm-offsets.h>
37 #include <asm/pgtable.h>
38 #include <asm/procinfo.h>
39 #include <asm/ptrace.h>
42 * Function: arm720_proc_init (void)
43 * : arm720_proc_fin (void)
45 * Notes : This processor does not require these
47 ENTRY(cpu_arm720_dcache_clean_area)
48 ENTRY(cpu_arm720_proc_init)
51 ENTRY(cpu_arm720_proc_fin)
53 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
55 mrc p15, 0, r0, c1, c0, 0
56 bic r0, r0, #0x1000 @ ...i............
57 bic r0, r0, #0x000e @ ............wca.
58 mcr p15, 0, r0, c1, c0, 0 @ disable caches
59 mcr p15, 0, r1, c7, c7, 0 @ invalidate cache
63 * Function: arm720_proc_do_idle(void)
64 * Params : r0 = unused
65 * Purpose : put the processer in proper idle mode
67 ENTRY(cpu_arm720_do_idle)
71 * Function: arm720_switch_mm(unsigned long pgd_phys)
72 * Params : pgd_phys Physical address of page table
73 * Purpose : Perform a task switch, saving the old process' state and restoring
76 ENTRY(cpu_arm720_switch_mm)
78 mcr p15, 0, r1, c7, c7, 0 @ invalidate cache
79 mcr p15, 0, r0, c2, c0, 0 @ update page table ptr
80 mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4)
84 * Function: arm720_set_pte(pte_t *ptep, pte_t pte)
85 * Params : r0 = Address to set
87 * Purpose : Set a PTE and flush it out of any WB cache
90 ENTRY(cpu_arm720_set_pte)
91 str r1, [r0], #-2048 @ linux version
93 eor r1, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
95 bic r2, r1, #PTE_SMALL_AP_MASK
96 bic r2, r2, #PTE_TYPE_MASK
97 orr r2, r2, #PTE_TYPE_SMALL
99 tst r1, #L_PTE_USER @ User?
100 orrne r2, r2, #PTE_SMALL_AP_URO_SRW
102 tst r1, #L_PTE_WRITE | L_PTE_DIRTY @ Write and Dirty?
103 orreq r2, r2, #PTE_SMALL_AP_UNO_SRW
105 tst r1, #L_PTE_PRESENT | L_PTE_YOUNG @ Present and Young
108 str r2, [r0] @ hardware version
112 * Function: arm720_reset
113 * Params : r0 = address to jump to
114 * Notes : This sets up everything for a reset
116 ENTRY(cpu_arm720_reset)
118 mcr p15, 0, ip, c7, c7, 0 @ invalidate cache
119 mcr p15, 0, ip, c8, c7, 0 @ flush TLB (v4)
120 mrc p15, 0, ip, c1, c0, 0 @ get ctrl register
121 bic ip, ip, #0x000f @ ............wcam
122 bic ip, ip, #0x2100 @ ..v....s........
123 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
128 .type __arm710_setup, #function
131 mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
132 mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
133 mrc p15, 0, r0, c1, c0 @ get control register
134 ldr r5, arm710_cr1_clear
136 ldr r5, arm710_cr1_set
138 mov pc, lr @ __ret (head.S)
139 .size __arm710_setup, . - __arm710_setup
143 * .RVI ZFRS BLDP WCAM
144 * .... 0001 ..11 1101
147 .type arm710_cr1_clear, #object
148 .type arm710_cr1_set, #object
154 .type __arm720_setup, #function
157 mcr p15, 0, r0, c7, c7, 0 @ invalidate caches
158 mcr p15, 0, r0, c8, c7, 0 @ flush TLB (v4)
159 mrc p15, 0, r0, c1, c0 @ get control register
160 ldr r5, arm720_cr1_clear
162 ldr r5, arm720_cr1_set
164 mov pc, lr @ __ret (head.S)
165 .size __arm720_setup, . - __arm720_setup
169 * .RVI ZFRS BLDP WCAM
170 * ..1. 1001 ..11 1101
173 .type arm720_cr1_clear, #object
174 .type arm720_cr1_set, #object
183 * Purpose : Function pointers used to access above functions - all calls
186 .type arm720_processor_functions, #object
187 ENTRY(arm720_processor_functions)
189 .word cpu_arm720_proc_init
190 .word cpu_arm720_proc_fin
191 .word cpu_arm720_reset
192 .word cpu_arm720_do_idle
193 .word cpu_arm720_dcache_clean_area
194 .word cpu_arm720_switch_mm
195 .word cpu_arm720_set_pte
196 .size arm720_processor_functions, . - arm720_processor_functions
200 .type cpu_arch_name, #object
201 cpu_arch_name: .asciz "armv4t"
202 .size cpu_arch_name, . - cpu_arch_name
204 .type cpu_elf_name, #object
205 cpu_elf_name: .asciz "v4"
206 .size cpu_elf_name, . - cpu_elf_name
208 .type cpu_arm710_name, #object
211 .size cpu_arm710_name, . - cpu_arm710_name
213 .type cpu_arm720_name, #object
216 .size cpu_arm720_name, . - cpu_arm720_name
221 * See linux/include/asm-arm/procinfo.h for a definition of this structure.
224 .section ".proc.info.init", #alloc, #execinstr
226 .type __arm710_proc_info, #object
228 .long 0x41807100 @ cpu_val
229 .long 0xffffff00 @ cpu_mask
230 .long PMD_TYPE_SECT | \
231 PMD_SECT_BUFFERABLE | \
232 PMD_SECT_CACHEABLE | \
234 PMD_SECT_AP_WRITE | \
236 b __arm710_setup @ cpu_flush
237 .long cpu_arch_name @ arch_name
238 .long cpu_elf_name @ elf_name
239 .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
240 .long cpu_arm710_name @ name
241 .long arm720_processor_functions
245 .size __arm710_proc_info, . - __arm710_proc_info
247 .type __arm720_proc_info, #object
249 .long 0x41807200 @ cpu_val
250 .long 0xffffff00 @ cpu_mask
251 .long PMD_TYPE_SECT | \
252 PMD_SECT_BUFFERABLE | \
253 PMD_SECT_CACHEABLE | \
255 PMD_SECT_AP_WRITE | \
257 b __arm720_setup @ cpu_flush
258 .long cpu_arch_name @ arch_name
259 .long cpu_elf_name @ elf_name
260 .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB @ elf_hwcap
261 .long cpu_arm720_name @ name
262 .long arm720_processor_functions
266 .size __arm720_proc_info, . - __arm720_proc_info