2 * linux/arch/armnommu/mm/arm946.S: MPU functions for ARM946E-S
4 * Copyright 2003, STMicroelectronics
5 * Copyright 2004, Hyok S. Choi, for 2.6.
9 #include <linux/linkage.h>
10 #include <linux/init.h>
11 #include <asm/assembler.h>
12 #include <asm/pgtable.h>
13 #include <asm/procinfo.h>
14 #include <asm/hardware.h>
16 #include <asm/ptrace.h>
17 #include "proc-macros.S"
20 /* FIXME - this is also defined in cache-v4wb.S */
21 #define CACHE_DSIZE 4096 /* 4K */
22 #define CACHE_DLINESIZE 32 /* 8word */
23 #define CACHE_DLIMIT (CACHE_DSIZE * 4)
26 * cpu_arm946_data_abort()
28 * obtain information about current aborted instruction
30 * r0 = address of aborted instruction
33 * r0 = address of abort
38 ENTRY(cpu_arm946_data_abort)
39 mrc p15, 0, r3, c5, c0, 0 @ get FSR
40 mrc p15, 0, r0, c6, c0, 0 @ get FAR
41 ldr r1, [r0] @ read aborted instruction
42 tst r1, r1, lsr #21 @ C = bit 20
43 sbc r1, r1, r1 @ r1 = C - 1
48 * cpu_arm946_check_bugs()
50 ENTRY(cpu_arm946_check_bugs)
52 bic ip, ip, #PSR_F_BIT
57 * cpu_arm946_proc_init()
59 ENTRY(cpu_arm946_proc_init)
63 * cpu_arm946_proc_fin()
65 ENTRY(cpu_arm946_proc_fin)
67 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
69 #if defined(CONFIG_CPU_CACHE_V4WT)
70 bl v4wt_flush_kern_cache_all @ write-through
71 #elif defined(CONFIG_CPU_CACHE_V4WB)
72 bl v4wb_flush_kern_cache_all @ write-back
73 #endif /* CONFIG_CPU_CACHE_V4WT */
74 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
75 bic r0, r0, #0x1000 @ ...i............
76 bic r0, r0, #0x000e @ ............wca.
77 mcr p15, 0, r0, c1, c0, 0 @ disable caches
81 * cpu_arm946_reset(loc)
83 * Perform a soft reset of the system. Put the CPU into the
84 * same state as it would be if it had been reset, and branch
85 * to what would be the reset vector.
87 * loc: location to jump to for soft reset
89 ENTRY(cpu_arm946_reset)
91 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
92 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
93 bic ip, ip, #0x000f @ ............wcam
94 bic ip, ip, #0x1100 @ ...i...s........
95 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
99 * idle mode processing
101 ENTRY(cpu_arm946_do_idle)
102 #if defined(CONFIG_CPU_ARM946_CPU_IDLE)
103 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
110 ENTRY(cpu_arm946_dcache_clean_area)
111 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
112 add r0, r0, #CACHE_DLINESIZE
113 subs r1, r1, #CACHE_DLINESIZE
117 * Function: arm946_switch_mm(unsigned long pgd_phys)
118 * Params : pgd_phys Physical address of page table
119 * Purpose : Perform a task switch,
121 ENTRY(cpu_arm946_switch_mm)
125 /* .section ".text.init", #alloc, #execinstr */
129 MRC p15, 0, R0, c1, c0, 0 @ get control register
132 * Clear out 'unwanted' bits (then put them in if we need them)
134 bic r0, r0, #0x0e00 @ ....??r.........
135 bic r0, r0, #0x0002 @ ..............a.
136 bic r0, r0, #0x000c @ W,D
137 bic r0, r0, #0x1000 @ I
139 * Turn on what we want
141 #ifdef CONFIG_CPU_MXU_ENABLE
142 orr r0, r0, #0x0001 @ Enable PU
144 bic r0, r0, #0x0001 @ Disable PU
147 #ifdef CONFIG_CPU_ARM940_D_CACHE_ON
148 orr r0, r0, #0x0004 @ Enable D cache
150 #ifdef CONFIG_CPU_ARM940_I_CACHE_ON
151 orr r0, r0, #0x1000 @ I Cache on
154 .size __arm946_setup, . - __arm946_setup
159 * Purpose : Function pointers used to access above functions - all calls
162 .type arm946_processor_functions, #object
163 ENTRY(arm946_processor_functions)
164 .word cpu_arm946_data_abort
165 .word cpu_arm946_proc_init
166 .word cpu_arm946_proc_fin
167 .word cpu_arm946_reset
168 .word cpu_arm946_do_idle
170 .word cpu_arm946_dcache_clean_area
171 .word cpu_arm946_switch_mm
172 .size arm946_processor_functions, . - arm946_processor_functions
175 .type cpu_arch_name, #object
178 .size cpu_arch_name, . - cpu_arch_name
180 .type cpu_elf_name, #object
183 .size cpu_elf_name, . - cpu_elf_name
185 .type cpu_arm946_name, #object
188 .size cpu_arm946_name, . - cpu_arm946_name
193 .section ".proc.info.init", #alloc, #execinstr
194 .type __arm946_proc_info,#object
203 .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT
204 .long cpu_arm946_name
205 .long arm946_processor_functions
208 #if defined(CONFIG_CPU_CACHE_V4WT)
209 .long v4wt_cache_fns @ cache model
210 #elif defined(CONFIG_CPU_CACHE_V4WB)
211 .long v4wb_cache_fns @ cache model
212 #endif /* CONFIG_CPU_CACHE_V4WT */
213 .size __arm946_proc_info, . - __arm946_proc_info