MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / arch / arm / mm / proc-arm940.S
blobe88fc3a4a25bb8b492217ddd8cb78083bff5fd95
1 /*
2  *  linux/arch/armnommu/mm/arm940.S: MPU functions for ARM940
3  *  2001 Minspeed
4  * 
5  *  2004/03/22  modified for 2.6 kernel by heechul.yun@samsung.com 
6  *  2004/04/20  clean-up by Hyok S. Choi
7  */
8         
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>
15 #include <asm/page.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()
26  *
27  * obtain information about current aborted instruction
28  *
29  * r0 = address of aborted instruction
30  *
31  * Returns:
32  *  r0 = address of abort
33  *  r1 != 0 if writing
34  *  r3 = FSR
35  */
36         .align  5
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
43         and     r3, r3, #255
44         mov     pc, lr
47  * cpu_arm940_check_bugs()
48  */
49 ENTRY(cpu_arm940_check_bugs)
50         mrs     ip, cpsr
51         bic     ip, ip, #PSR_F_BIT
52         msr     cpsr, ip
53         mov     pc, lr
56  * cpu_arm940_proc_init()
57  *      
58  *  setup_processor()  - setup.c
59  *  +-> cpu_proc_init() - cpu-multi32.h --> proc-arm940.S
60  *      
61  *  TODO: cp15 initialization code can be placed here - hcyun 
62  */
63 ENTRY(cpu_arm940_proc_init)
64         mov     pc, lr
67  * cpu_arm940_proc_fin()
68  */
69 ENTRY(cpu_arm940_proc_fin)
70         stmfd   sp!, {lr}
71         mov     ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
72         msr     cpsr_c, ip
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
82         ldmfd   sp!, {pc}
85  * cpu_arm940_reset(loc)
86  *
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.
90  *
91  * loc: location to jump to for soft reset
92  */
93 ENTRY(cpu_arm940_reset)
94         mov     ip, #0
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
100         mov     pc, r0
103  * idle mode processing 
104  */
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
108 #endif
109         mov     pc, lr
111 /* 
112  * *FIXME* 
113  */     
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
118         bhi     1b
119         mov     pc, lr
121  * Function: arm940_switch_mm(unsigned long pgd_phys)
122  * Params  : pgd_phys   Physical address of page table
123  * Purpose : Perform a task switch, 
124  */     
125 ENTRY(cpu_arm940_switch_mm)
126         mov     pc, lr  
128         
129         /* .section ".text.init", #alloc, #execinstr */ 
130         __INIT
131         
132 __arm940_setup:
133         MRC     p15, 0, R0, c1, c0, 0           @ get control register
134                 
136  * Clear out 'unwanted' bits (then put them in if we need them)
137  */
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
144  */
145 #ifdef CONFIG_CPU_MXU_ENABLE
146         orr     r0, r0, #0x0001                 @ Enable PU
147 #else
148         bic     r0, r0, #0x0001                 @ Disable PU
149 #endif
151 #ifdef CONFIG_CPU_ARM940_D_CACHE_ON
152         orr     r0, r0, #0x0004                 @ Enable D cache
153 #endif
154 #ifdef CONFIG_CPU_ARM940_I_CACHE_ON
155         orr     r0, r0, #0x1000                 @ I Cache on
156 #endif
157         mov     pc, lr
158         .size   __arm940_setup, . - __arm940_setup      
160         __INITDATA
163  * Purpose : Function pointers used to access above functions - all calls
164  *           come through these
165  */
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
178         .section ".rodata"      
179         .type   cpu_arch_name, #object
180 cpu_arch_name:
181         .asciz  "armv4t"
182         .size   cpu_arch_name, . - cpu_arch_name
184         .type   cpu_elf_name, #object
185 cpu_elf_name:
186         .asciz  "v4"
187         .size   cpu_elf_name, . - cpu_elf_name
189         .type   cpu_arm940_name, #object
190 cpu_arm940_name:
191         .ascii  "ARM940T"
192         .size   cpu_arm940_name, . - cpu_arm940_name
194         .align
197         .section ".proc.info.init", #alloc, #execinstr
198         .type   __arm940_proc_info,#object
199 __arm940_proc_info:
200         .long   0x41009400
201         .long   0xff00fff0
202         .long   0
203         .long   0
204         b       __arm940_setup
205         .long   cpu_arch_name
206         .long   cpu_elf_name
207         .long   HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT
208         .long   cpu_arm940_name  
209         .long   arm940_processor_functions 
210         .long   0
211         .long   0
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