2 * linux/arch/armnommu/mm/arm940.S: MPU functions for ARM940
5 * 2004/03/22 modified for 2.6 kernel by heechul.yun@samsung.com
6 * 2004/04/20 clean-up by Hyok S. Choi
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"
19 /* FIXME - this is also defined in cache-v4wb.S */
20 #define CACHE_DSIZE 4096 /* 4K */
21 #define CACHE_DLINESIZE 16 /* 4word */
22 #define CACHE_DLIMIT (CACHE_DSIZE * 4)
25 * cpu_arm940_data_abort()
27 * obtain information about current aborted instruction
29 * r0 = address of aborted instruction
32 * r0 = address of abort
37 ENTRY(cpu_arm940_data_abort)
38 mrc p15, 0, r3, c5, c0, 0 @ get FSR
39 mrc p15, 0, r0, c6, c0, 0 @ get FAR
40 ldr r1, [r0] @ read aborted instruction
41 tst r1, r1, lsr #21 @ C = bit 20
42 sbc r1, r1, r1 @ r1 = C - 1
47 * cpu_arm940_check_bugs()
49 ENTRY(cpu_arm940_check_bugs)
51 bic ip, ip, #PSR_F_BIT
56 * cpu_arm940_proc_init()
58 * setup_processor() - setup.c
59 * +-> cpu_proc_init() - cpu-multi32.h --> proc-arm940.S
61 * TODO: cp15 initialization code can be placed here - hcyun
63 ENTRY(cpu_arm940_proc_init)
67 * cpu_arm940_proc_fin()
69 ENTRY(cpu_arm940_proc_fin)
71 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
73 #if defined(CONFIG_CPU_CACHE_V4WT)
74 bl v4wt_flush_kern_cache_all @ write-through
75 #elif defined(CONFIG_CPU_CACHE_V4WB)
76 bl v4wb_flush_kern_cache_all @ write-back
77 #endif /* CONFIG_CPU_CACHE_V4WT */
78 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
79 bic r0, r0, #0x1000 @ ...i............
80 bic r0, r0, #0x000e @ ............wca.
81 mcr p15, 0, r0, c1, c0, 0 @ disable caches
85 * cpu_arm940_reset(loc)
87 * Perform a soft reset of the system. Put the CPU into the
88 * same state as it would be if it had been reset, and branch
89 * to what would be the reset vector.
91 * loc: location to jump to for soft reset
93 ENTRY(cpu_arm940_reset)
95 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
96 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
97 bic ip, ip, #0x000f @ ............wcam
98 bic ip, ip, #0x1100 @ ...i...s........
99 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
103 * idle mode processing
105 ENTRY(cpu_arm940_do_idle)
106 #if defined(CONFIG_CPU_ARM940_CPU_IDLE)
107 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
114 ENTRY(cpu_arm940_dcache_clean_area)
115 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
116 add r0, r0, #CACHE_DLINESIZE
117 subs r1, r1, #CACHE_DLINESIZE
121 * Function: arm940_switch_mm(unsigned long pgd_phys)
122 * Params : pgd_phys Physical address of page table
123 * Purpose : Perform a task switch,
125 ENTRY(cpu_arm940_switch_mm)
129 /* .section ".text.init", #alloc, #execinstr */
133 MRC p15, 0, R0, c1, c0, 0 @ get control register
136 * Clear out 'unwanted' bits (then put them in if we need them)
138 bic r0, r0, #0x0e00 @ ....??r.........
139 bic r0, r0, #0x0002 @ ..............a.
140 bic r0, r0, #0x000c @ W,D
141 bic r0, r0, #0x1000 @ I
143 * Turn on what we want
145 #ifdef CONFIG_CPU_MXU_ENABLE
146 orr r0, r0, #0x0001 @ Enable PU
148 bic r0, r0, #0x0001 @ Disable PU
151 #ifdef CONFIG_CPU_ARM940_D_CACHE_ON
152 orr r0, r0, #0x0004 @ Enable D cache
154 #ifdef CONFIG_CPU_ARM940_I_CACHE_ON
155 orr r0, r0, #0x1000 @ I Cache on
158 .size __arm940_setup, . - __arm940_setup
163 * Purpose : Function pointers used to access above functions - all calls
166 .type arm940_processor_functions, #object
167 ENTRY(arm940_processor_functions)
168 .word cpu_arm940_data_abort
169 .word cpu_arm940_proc_init
170 .word cpu_arm940_proc_fin
171 .word cpu_arm940_reset
172 .word cpu_arm940_do_idle
174 .word cpu_arm940_dcache_clean_area
175 .word cpu_arm940_switch_mm
176 .size arm940_processor_functions, . - arm940_processor_functions
179 .type cpu_arch_name, #object
182 .size cpu_arch_name, . - cpu_arch_name
184 .type cpu_elf_name, #object
187 .size cpu_elf_name, . - cpu_elf_name
189 .type cpu_arm940_name, #object
192 .size cpu_arm940_name, . - cpu_arm940_name
197 .section ".proc.info.init", #alloc, #execinstr
198 .type __arm940_proc_info,#object
207 .long HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT
208 .long cpu_arm940_name
209 .long arm940_processor_functions
212 #if defined(CONFIG_CPU_CACHE_V4WT)
213 .long v4wt_cache_fns @ cache model
214 #elif defined(CONFIG_CPU_CACHE_V4WB)
215 .long v4wb_cache_fns @ cache model
216 #endif /* CONFIG_CPU_CACHE_V4WT */
217 .size __arm940_proc_info, . - __arm940_proc_info