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-arm946.S
blobf3d8ad8eb6158fabda0e29e4bd1ae1538cb88028
1 /*
2  *  linux/arch/armnommu/mm/arm946.S: MPU functions for ARM946E-S
3  * 
4  *  Copyright 2003, STMicroelectronics
5  *  Copyright 2004, Hyok S. Choi, for 2.6.
6  *
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"
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()
27  *
28  * obtain information about current aborted instruction
29  *
30  * r0 = address of aborted instruction
31  *
32  * Returns:
33  *  r0 = address of abort
34  *  r1 != 0 if writing
35  *  r3 = FSR
36  */
37         .align  5
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
44         and     r3, r3, #255
45         mov     pc, lr
48  * cpu_arm946_check_bugs()
49  */
50 ENTRY(cpu_arm946_check_bugs)
51         mrs     ip, cpsr
52         bic     ip, ip, #PSR_F_BIT
53         msr     cpsr, ip
54         mov     pc, lr
57  * cpu_arm946_proc_init()
58  */
59 ENTRY(cpu_arm946_proc_init)
60         mov     pc, lr
63  * cpu_arm946_proc_fin()
64  */
65 ENTRY(cpu_arm946_proc_fin)
66         stmfd   sp!, {lr}
67         mov     ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
68         msr     cpsr_c, ip
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
78         ldmfd   sp!, {pc}
81  * cpu_arm946_reset(loc)
82  *
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.
86  *
87  * loc: location to jump to for soft reset
88  */
89 ENTRY(cpu_arm946_reset)
90         mov     ip, #0
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
96         mov     pc, r0
99  * idle mode processing 
100  */
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
104 #endif
105         mov     pc, lr
107 /* 
108  * *FIXME* 
109  */     
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
114         bhi     1b
115         mov     pc, lr
117  * Function: arm946_switch_mm(unsigned long pgd_phys)
118  * Params  : pgd_phys   Physical address of page table
119  * Purpose : Perform a task switch, 
120  */     
121 ENTRY(cpu_arm946_switch_mm)
122         mov     pc, lr  
124         
125         /* .section ".text.init", #alloc, #execinstr */ 
126         __INIT
127         
128 __arm946_setup:
129         MRC     p15, 0, R0, c1, c0, 0           @ get control register
130                 
132  * Clear out 'unwanted' bits (then put them in if we need them)
133  */
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
140  */
141 #ifdef CONFIG_CPU_MXU_ENABLE
142         orr     r0, r0, #0x0001                 @ Enable PU
143 #else
144         bic     r0, r0, #0x0001                 @ Disable PU
145 #endif
147 #ifdef CONFIG_CPU_ARM940_D_CACHE_ON
148         orr     r0, r0, #0x0004                 @ Enable D cache
149 #endif
150 #ifdef CONFIG_CPU_ARM940_I_CACHE_ON
151         orr     r0, r0, #0x1000                 @ I Cache on
152 #endif
153         mov     pc, lr
154         .size   __arm946_setup, . - __arm946_setup      
156         __INITDATA
159  * Purpose : Function pointers used to access above functions - all calls
160  *           come through these
161  */
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
174         .section ".rodata"      
175         .type   cpu_arch_name, #object
176 cpu_arch_name:
177         .asciz  "armv5"
178         .size   cpu_arch_name, . - cpu_arch_name
180         .type   cpu_elf_name, #object
181 cpu_elf_name:
182         .asciz  "v5"
183         .size   cpu_elf_name, . - cpu_elf_name
185         .type   cpu_arm946_name, #object
186 cpu_arm946_name:
187         .ascii  "ARM946E"
188         .size   cpu_arm946_name, . - cpu_arm946_name
190         .align
193         .section ".proc.info.init", #alloc, #execinstr
194         .type   __arm946_proc_info,#object
195 __arm946_proc_info:
196         .long   0x41009460
197         .long   0xff00fff0
198         .long   0
199         .long   0
200         b       __arm946_setup
201         .long   cpu_arch_name
202         .long   cpu_elf_name
203         .long   HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT
204         .long   cpu_arm946_name  
205         .long   arm946_processor_functions 
206         .long   0
207         .long   0
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