Merge branch 'sched/urgent'
[linux-2.6/x86.git] / arch / arm / mm / proc-arm740.S
blob4506be3adda6f48d7921f06cdccc3c44a40aef50
1 /*
2  *  linux/arch/arm/mm/arm740.S: utility functions for ARM740
3  *
4  *  Copyright (C) 2004-2006 Hyok S. Choi (hyok.choi@samsung.com)
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  */
11 #include <linux/linkage.h>
12 #include <linux/init.h>
13 #include <asm/assembler.h>
14 #include <asm/asm-offsets.h>
15 #include <asm/hwcap.h>
16 #include <asm/pgtable-hwdef.h>
17 #include <asm/pgtable.h>
18 #include <asm/ptrace.h>
20 #include "proc-macros.S"
22         .text
24  * cpu_arm740_proc_init()
25  * cpu_arm740_do_idle()
26  * cpu_arm740_dcache_clean_area()
27  * cpu_arm740_switch_mm()
28  *
29  * These are not required.
30  */
31 ENTRY(cpu_arm740_proc_init)
32 ENTRY(cpu_arm740_do_idle)
33 ENTRY(cpu_arm740_dcache_clean_area)
34 ENTRY(cpu_arm740_switch_mm)
35         mov     pc, lr
38  * cpu_arm740_proc_fin()
39  */
40 ENTRY(cpu_arm740_proc_fin)
41         mrc     p15, 0, r0, c1, c0, 0
42         bic     r0, r0, #0x3f000000             @ bank/f/lock/s
43         bic     r0, r0, #0x0000000c             @ w-buffer/cache
44         mcr     p15, 0, r0, c1, c0, 0           @ disable caches
45         mov     pc, lr
48  * cpu_arm740_reset(loc)
49  * Params  : r0 = address to jump to
50  * Notes   : This sets up everything for a reset
51  */
52 ENTRY(cpu_arm740_reset)
53         mov     ip, #0
54         mcr     p15, 0, ip, c7, c0, 0           @ invalidate cache
55         mrc     p15, 0, ip, c1, c0, 0           @ get ctrl register
56         bic     ip, ip, #0x0000000c             @ ............wc..
57         mcr     p15, 0, ip, c1, c0, 0           @ ctrl register
58         mov     pc, r0
60         __CPUINIT
62         .type   __arm740_setup, #function
63 __arm740_setup:
64         mov     r0, #0
65         mcr     p15, 0, r0, c7, c0, 0           @ invalidate caches
67         mcr     p15, 0, r0, c6, c3              @ disable area 3~7
68         mcr     p15, 0, r0, c6, c4
69         mcr     p15, 0, r0, c6, c5
70         mcr     p15, 0, r0, c6, c6
71         mcr     p15, 0, r0, c6, c7
73         mov     r0, #0x0000003F                 @ base = 0, size = 4GB
74         mcr     p15, 0, r0, c6, c0              @ set area 0, default
76         ldr     r0, =(CONFIG_DRAM_BASE & 0xFFFFF000) @ base[31:12] of RAM
77         ldr     r1, =(CONFIG_DRAM_SIZE >> 12)   @ size of RAM (must be >= 4KB)
78         mov     r2, #10                         @ 11 is the minimum (4KB)
79 1:      add     r2, r2, #1                      @ area size *= 2
80         mov     r1, r1, lsr #1
81         bne     1b                              @ count not zero r-shift
82         orr     r0, r0, r2, lsl #1              @ the area register value
83         orr     r0, r0, #1                      @ set enable bit
84         mcr     p15, 0, r0, c6, c1              @ set area 1, RAM
86         ldr     r0, =(CONFIG_FLASH_MEM_BASE & 0xFFFFF000) @ base[31:12] of FLASH
87         ldr     r1, =(CONFIG_FLASH_SIZE >> 12)  @ size of FLASH (must be >= 4KB)
88         mov     r2, #10                         @ 11 is the minimum (4KB)
89 1:      add     r2, r2, #1                      @ area size *= 2
90         mov     r1, r1, lsr #1
91         bne     1b                              @ count not zero r-shift
92         orr     r0, r0, r2, lsl #1              @ the area register value
93         orr     r0, r0, #1                      @ set enable bit
94         mcr     p15, 0, r0, c6, c2              @ set area 2, ROM/FLASH
96         mov     r0, #0x06
97         mcr     p15, 0, r0, c2, c0              @ Region 1&2 cacheable
98 #ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
99         mov     r0, #0x00                       @ disable whole write buffer
100 #else
101         mov     r0, #0x02                       @ Region 1 write bufferred
102 #endif
103         mcr     p15, 0, r0, c3, c0
105         mov     r0, #0x10000
106         sub     r0, r0, #1                      @ r0 = 0xffff
107         mcr     p15, 0, r0, c5, c0              @ all read/write access
109         mrc     p15, 0, r0, c1, c0              @ get control register
110         bic     r0, r0, #0x3F000000             @ set to standard caching mode
111                                                 @ need some benchmark
112         orr     r0, r0, #0x0000000d             @ MPU/Cache/WB
114         mov     pc, lr
116         .size   __arm740_setup, . - __arm740_setup
118         __INITDATA
120         @ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
121         define_processor_functions arm740, dabort=v4t_late_abort, pabort=legacy_pabort, nommu=1
123         .section ".rodata"
125         string  cpu_arch_name, "armv4"
126         string  cpu_elf_name, "v4"
127         string  cpu_arm740_name, "ARM740T"
129         .align
131         .section ".proc.info.init", #alloc, #execinstr
132         .type   __arm740_proc_info,#object
133 __arm740_proc_info:
134         .long   0x41807400
135         .long   0xfffffff0
136         .long   0
137         b       __arm740_setup
138         .long   cpu_arch_name
139         .long   cpu_elf_name
140         .long   HWCAP_SWP | HWCAP_HALF | HWCAP_26BIT
141         .long   cpu_arm740_name
142         .long   arm740_processor_functions
143         .long   0
144         .long   0
145         .long   v3_cache_fns                    @ cache model
146         .size   __arm740_proc_info, . - __arm740_proc_info