| @@ -1,344 +1,344 @@ | | | @@ -1,344 +1,344 @@ |
1 | /* | | 1 | /* |
2 | * Machine dependent startup code for BEAGLEBOARD boards. | | 2 | * Machine dependent startup code for BEAGLEBOARD boards. |
3 | * Based on omap_start.S | | 3 | * Based on omap_start.S |
4 | * | | 4 | * |
5 | * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. | | 5 | * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. |
6 | * Written by Hiroyuki Bessho for Genetec Corporation. | | 6 | * Written by Hiroyuki Bessho for Genetec Corporation. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
15 | * documentation and/or other materials provided with the distribution. | | 15 | * documentation and/or other materials provided with the distribution. |
16 | * 3. The name of Genetec Corporation may not be used to endorse or | | 16 | * 3. The name of Genetec Corporation may not be used to endorse or |
17 | * promote products derived from this software without specific prior | | 17 | * promote products derived from this software without specific prior |
18 | * written permission. | | 18 | * written permission. |
19 | * | | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND | | 20 | * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND |
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION | | 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION |
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. | | 30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | * | | 31 | * |
32 | * Copyright (c) 2003 | | 32 | * Copyright (c) 2003 |
33 | * Ichiro FUKUHARA <ichiro@ichiro.org>. | | 33 | * Ichiro FUKUHARA <ichiro@ichiro.org>. |
34 | * All rights reserved. | | 34 | * All rights reserved. |
35 | * | | 35 | * |
36 | * Redistribution and use in source and binary forms, with or without | | 36 | * Redistribution and use in source and binary forms, with or without |
37 | * modification, are permitted provided that the following conditions | | 37 | * modification, are permitted provided that the following conditions |
38 | * are met: | | 38 | * are met: |
39 | * 1. Redistributions of source code must retain the above copyright | | 39 | * 1. Redistributions of source code must retain the above copyright |
40 | * notice, this list of conditions and the following disclaimer. | | 40 | * notice, this list of conditions and the following disclaimer. |
41 | * 2. Redistributions in binary form must reproduce the above copyright | | 41 | * 2. Redistributions in binary form must reproduce the above copyright |
42 | * notice, this list of conditions and the following disclaimer in the | | 42 | * notice, this list of conditions and the following disclaimer in the |
43 | * documentation and/or other materials provided with the distribution. | | 43 | * documentation and/or other materials provided with the distribution. |
44 | * | | 44 | * |
45 | * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR | | 45 | * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR |
46 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 46 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
47 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 47 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
48 | * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR | | 48 | * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR |
49 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 49 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
50 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 50 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
51 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 51 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
52 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 52 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
53 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 53 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
54 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 54 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
55 | * SUCH DAMAGE. | | 55 | * SUCH DAMAGE. |
56 | * | | 56 | * |
57 | * Copyright (c) 2007 Microsoft | | 57 | * Copyright (c) 2007 Microsoft |
58 | * All rights reserved. | | 58 | * All rights reserved. |
59 | * | | 59 | * |
60 | * Redistribution and use in source and binary forms, with or without | | 60 | * Redistribution and use in source and binary forms, with or without |
61 | * modification, are permitted provided that the following conditions | | 61 | * modification, are permitted provided that the following conditions |
62 | * are met: | | 62 | * are met: |
63 | * 1. Redistributions of source code must retain the above copyright | | 63 | * 1. Redistributions of source code must retain the above copyright |
64 | * notice, this list of conditions and the following disclaimer. | | 64 | * notice, this list of conditions and the following disclaimer. |
65 | * 2. Redistributions in binary form must reproduce the above copyright | | 65 | * 2. Redistributions in binary form must reproduce the above copyright |
66 | * notice, this list of conditions and the following disclaimer in the | | 66 | * notice, this list of conditions and the following disclaimer in the |
67 | * documentation and/or other materials provided with the distribution. | | 67 | * documentation and/or other materials provided with the distribution. |
68 | * 3. All advertising materials mentioning features or use of this software | | 68 | * 3. All advertising materials mentioning features or use of this software |
69 | * must display the following acknowledgement: | | 69 | * must display the following acknowledgement: |
70 | * This product includes software developed by Microsoft | | 70 | * This product includes software developed by Microsoft |
71 | * | | 71 | * |
72 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | | 72 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
73 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | | 73 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
74 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 74 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
75 | * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTERS BE LIABLE FOR ANY DIRECT, | | 75 | * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTERS BE LIABLE FOR ANY DIRECT, |
76 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | | 76 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
77 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 77 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
78 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 78 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
79 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 79 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
80 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 80 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
81 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 81 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
82 | * SUCH DAMAGE. | | 82 | * SUCH DAMAGE. |
83 | */ | | 83 | */ |
84 | | | 84 | |
85 | #include "opt_omap.h" | | 85 | #include "opt_omap.h" |
86 | #include "opt_com.h" | | 86 | #include "opt_com.h" |
87 | | | 87 | |
88 | #include <machine/asm.h> | | 88 | #include <machine/asm.h> |
89 | #include <arm/armreg.h> | | 89 | #include <arm/armreg.h> |
90 | #include "assym.h" | | 90 | #include "assym.h" |
91 | | | 91 | |
92 | #include <arm/omap/omap2_obioreg.h> | | 92 | #include <arm/omap/omap2_obioreg.h> |
93 | #include <evbarm/beagle/beagle.h> | | 93 | #include <evbarm/beagle/beagle.h> |
94 | | | 94 | |
95 | #ifdef MEMSIZE | | 95 | #ifdef MEMSIZE |
96 | #define INIT_MEMSIZE MEMSIZE | | 96 | #define INIT_MEMSIZE MEMSIZE |
97 | #else | | 97 | #else |
98 | #define INIT_MEMSIZE 128 | | 98 | #define INIT_MEMSIZE 128 |
99 | #endif | | 99 | #endif |
100 | | | 100 | |
101 | RCSID("$NetBSD: beagle_start.S,v 1.14 2013/06/16 16:48:23 matt Exp $") | | 101 | RCSID("$NetBSD: beagle_start.S,v 1.15 2013/06/16 17:57:21 matt Exp $") |
102 | | | 102 | |
103 | #define Invalidate_I_cache(reg) \ | | 103 | #define Invalidate_I_cache(reg) \ |
104 | mcr p15, 0, reg, c7, c5, 0 /* Invalidate Entire I cache */ | | 104 | mcr p15, 0, reg, c7, c5, 0 /* Invalidate Entire I cache */ |
105 | | | 105 | |
106 | /* | | 106 | /* |
107 | * Kernel start routine for BEAGLEBOARD boards. | | 107 | * Kernel start routine for BEAGLEBOARD boards. |
108 | * At this point, this code has been loaded into SDRAM | | 108 | * At this point, this code has been loaded into SDRAM |
109 | * and the MMU is off | | 109 | * and the MMU is off |
110 | */ | | 110 | */ |
111 | .section .start,"ax",%progbits | | 111 | .section .start,"ax",%progbits |
112 | | | 112 | |
113 | .global _C_LABEL(beagle_start) | | 113 | .global _C_LABEL(beagle_start) |
114 | _C_LABEL(beagle_start): | | 114 | _C_LABEL(beagle_start): |
115 | /* Move into supervisor mode and disable IRQs/FIQs. */ | | 115 | /* Move into supervisor mode and disable IRQs/FIQs. */ |
116 | cpsid if, #PSR_SVC32_MODE | | 116 | cpsid if, #PSR_SVC32_MODE |
117 | | | 117 | |
118 | ldr r4, .Luboot_args | | 118 | ldr r4, .Luboot_args |
119 | stmia r4, {r0-r3} | | 119 | stmia r4, {r0-r3} |
120 | | | 120 | |
121 | /* | | 121 | /* |
122 | * Set up a preliminary mapping in the MMU to allow us to run | | 122 | * Set up a preliminary mapping in the MMU to allow us to run |
123 | * at KERNEL_BASE with caches on. | | 123 | * at KERNEL_BASE with caches on. |
124 | */ | | 124 | */ |
125 | /* Build page table from scratch */ | | 125 | /* Build page table from scratch */ |
126 | ldr r0, Ltemp_l1_table | | 126 | ldr r0, Ltemp_l1_table |
127 | mov r1, r0 /* Save the page table address. */ | | 127 | mov r1, r0 /* Save the page table address. */ |
128 | /* Zero the entire table so all virtual addresses are invalid. */ | | 128 | /* Zero the entire table so all virtual addresses are invalid. */ |
129 | mov r2, #L1_TABLE_SIZE /* in bytes */ | | 129 | mov r2, #L1_TABLE_SIZE /* in bytes */ |
130 | mov r3, #0 | | 130 | mov r3, #0 |
131 | mov r4, r3 | | 131 | mov r4, r3 |
132 | mov r5, r3 | | 132 | mov r5, r3 |
133 | mov r6, r3 | | 133 | mov r6, r3 |
134 | mov r7, r3 | | 134 | mov r7, r3 |
135 | mov r8, r3 | | 135 | mov r8, r3 |
136 | mov r10, r3 | | 136 | mov r10, r3 |
137 | mov r11, r3 | | 137 | mov r11, r3 |
138 | 1: stmia r1!, {r3-r8,r10-r11} | | 138 | 1: stmia r1!, {r3-r8,r10-r11} |
139 | stmia r1!, {r3-r8,r10-r11} | | 139 | stmia r1!, {r3-r8,r10-r11} |
140 | stmia r1!, {r3-r8,r10-r11} | | 140 | stmia r1!, {r3-r8,r10-r11} |
141 | stmia r1!, {r3-r8,r10-r11} | | 141 | stmia r1!, {r3-r8,r10-r11} |
142 | subs r2, r2, #(4 * 4 * 8) /* bytes per loop */ | | 142 | subs r2, r2, #(4 * 4 * 8) /* bytes per loop */ |
143 | bne 1b | | 143 | bne 1b |
144 | | | 144 | |
145 | /* Now create our entries per the mmu_init_table. */ | | 145 | /* Now create our entries per the mmu_init_table. */ |
146 | l1table .req r0 | | 146 | l1table .req r0 |
147 | va .req r1 | | 147 | va .req r1 |
148 | pa .req r2 | | 148 | pa .req r2 |
149 | n_sec .req r3 | | 149 | n_sec .req r3 |
150 | attr .req r4 | | 150 | attr .req r4 |
151 | itable .req r5 | | 151 | itable .req r5 |
152 | l1sfrm .req r6 | | 152 | l1sfrm .req r6 |
153 | adr itable, mmu_init_table | | 153 | adr itable, mmu_init_table |
154 | ldr l1sfrm, Ll1_s_frame | | 154 | ldr l1sfrm, Ll1_s_frame |
155 | b 3f | | 155 | b 3f |
156 | 2: str pa, [l1table, va, lsl #2] | | 156 | 2: str pa, [l1table, va, lsl #2] |
157 | add va, va, #1 | | 157 | add va, va, #1 |
158 | add pa, pa, #(L1_S_SIZE) | | 158 | add pa, pa, #(L1_S_SIZE) |
159 | adds n_sec, n_sec, #-1 | | 159 | adds n_sec, n_sec, #-1 |
160 | bhi 2b | | 160 | bhi 2b |
161 | 3: ldmia itable!, {va,pa,n_sec,attr} | | 161 | 3: ldmia itable!, {va,pa,n_sec,attr} |
162 | /* Convert va to l1 offset: va = 4 * (va >> L1_S_SHIFT) */ | | 162 | /* Convert va to l1 offset: va = 4 * (va >> L1_S_SHIFT) */ |
163 | lsr va, va, #L1_S_SHIFT | | 163 | lsr va, va, #L1_S_SHIFT |
164 | /* Convert pa to l1 entry: pa = (pa & L1_S_FRAME) | attr */ | | 164 | /* Convert pa to l1 entry: pa = (pa & L1_S_FRAME) | attr */ |
165 | and pa, pa, l1sfrm | | 165 | and pa, pa, l1sfrm |
166 | orr pa, pa, attr | | 166 | orr pa, pa, attr |
167 | cmp n_sec, #0 | | 167 | cmp n_sec, #0 |
168 | bne 2b | | 168 | bne 2b |
169 | .unreq va | | 169 | .unreq va |
170 | .unreq pa | | 170 | .unreq pa |
171 | .unreq n_sec | | 171 | .unreq n_sec |
172 | .unreq attr | | 172 | .unreq attr |
173 | .unreq itable | | 173 | .unreq itable |
174 | .unreq l1table | | 174 | .unreq l1table |
175 | .unreq l1sfrm | | 175 | .unreq l1sfrm |
176 | | | 176 | |
177 | /* | | 177 | /* |
178 | * In theory, because the MMU is off, we shouldn't need all of this, | | 178 | * In theory, because the MMU is off, we shouldn't need all of this, |
179 | * but let's not take any chances and do a typical sequence to set | | 179 | * but let's not take any chances and do a typical sequence to set |
180 | * the Translation Table Base. | | 180 | * the Translation Table Base. |
181 | */ | | 181 | */ |
182 | | | 182 | |
183 | Invalidate_I_cache(r0) | | 183 | Invalidate_I_cache(r0) |
184 | | | 184 | |
185 | ldr r2, Lctl_ID_dis /* Disable I+D caches */ | | 185 | ldr r2, Lctl_ID_dis /* Disable I+D caches */ |
186 | mrc p15, 0, r1, c1, c0, 0 /* " " " */ | | 186 | mrc p15, 0, r1, c1, c0, 0 /* " " " */ |
187 | and r1, r1, r2 /* " " " */ | | 187 | and r1, r1, r2 /* " " " */ |
188 | mcr p15, 0, r1, c1, c0, 0 /* " " " */ | | 188 | mcr p15, 0, r1, c1, c0, 0 /* " " " */ |
189 | | | 189 | |
190 | mcr p15, 0, r0, c7, c10, 4 /* Drain the write buffers. */ | | 190 | mcr p15, 0, r0, c7, c10, 4 /* Drain the write buffers. */ |
191 | mcr p15, 0, r0, c2, c0, 0 /* Set Translation Table Base */ | | 191 | mcr p15, 0, r0, c2, c0, 0 /* Set Translation Table Base */ |
192 | mcr p15, 0, r0, c8, c7, 0 /* Invalidate TLBs */ | | 192 | mcr p15, 0, r0, c8, c7, 0 /* Invalidate TLBs */ |
193 | | | 193 | |
194 | /* Set the Domain Access register. Very important! */ | | 194 | /* Set the Domain Access register. Very important! */ |
195 | mov r0, #((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT) | | 195 | mov r0, #((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT) |
196 | mcr p15, 0, r0, c3, c0, 0 | | 196 | mcr p15, 0, r0, c3, c0, 0 |
197 | | | 197 | |
198 | /* | | 198 | /* |
199 | * Enable the MMU, etc. | | 199 | * Enable the MMU, etc. |
200 | */ | | 200 | */ |
201 | mrc p15, 0, r0, c1, c0, 0 | | 201 | mrc p15, 0, r0, c1, c0, 0 |
202 | ldr r1, Lcontrol_wax | | 202 | ldr r1, Lcontrol_wax |
203 | and r0, r0, r1 | | 203 | and r0, r0, r1 |
204 | ldr r1, Lcontrol_clr | | 204 | ldr r1, Lcontrol_clr |
205 | mvn r1, r1 | | 205 | mvn r1, r1 |
206 | and r0, r0, r1 | | 206 | and r0, r0, r1 |
207 | ldr r1, Lcontrol_set | | 207 | ldr r1, Lcontrol_set |
208 | orr r0, r0, r1 | | 208 | orr r0, r0, r1 |
209 | mcr p15, 0, r0, c1, c0, 0 | | 209 | mcr p15, 0, r0, c1, c0, 0 |
210 | | | 210 | |
211 | /* | | 211 | /* |
212 | * Ensure that the coprocessor has finished turning on the MMU. | | 212 | * Ensure that the coprocessor has finished turning on the MMU. |
213 | */ | | 213 | */ |
214 | mrc p15, 0, r0, c2, c0, 0 /* Read an arbitrary value. */ | | 214 | mrc p15, 0, r0, c2, c0, 0 /* Read an arbitrary value. */ |
215 | mov r0, r0 /* Stall until read completes. */ | | 215 | mov r0, r0 /* Stall until read completes. */ |
216 | | | 216 | |
217 | /* | | 217 | /* |
218 | * Jump to start in locore.S, which in turn will call initarm and main. | | 218 | * Jump to start in locore.S, which in turn will call initarm and main. |
219 | */ | | 219 | */ |
220 | b start /* Jump to start (flushes pipeline). */ | | 220 | b start /* Jump to start (flushes pipeline). */ |
221 | nop | | 221 | nop |
222 | nop | | 222 | nop |
223 | nop | | 223 | nop |
224 | nop | | 224 | nop |
225 | | | 225 | |
226 | /* NOTREACHED */ | | 226 | /* NOTREACHED */ |
227 | | | 227 | |
228 | .Luboot_args: | | 228 | .Luboot_args: |
229 | .word uboot_args | | 229 | .word uboot_args |
230 | Ll1_s_frame: | | 230 | Ll1_s_frame: |
231 | .word L1_S_FRAME | | 231 | .word L1_S_FRAME |
232 | Ltemp_l1_table: | | 232 | Ltemp_l1_table: |
233 | /* Put the temporary L1 translation table at the end of SDRAM. */ | | 233 | /* Put the temporary L1 translation table at the end of SDRAM. */ |
234 | .word 0x80000000 + INIT_MEMSIZE * 0x100000 - L1_TABLE_SIZE | | 234 | .word 0x80000000 + INIT_MEMSIZE * 0x100000 - L1_TABLE_SIZE |
235 | | | 235 | |
236 | /* | | 236 | /* |
237 | * Coprocessor register initialization values | | 237 | * Coprocessor register initialization values |
238 | */ | | 238 | */ |
239 | # define CPU_AUXCTL_CZ (1 << 6) /* Restrict Cache Size */ | | 239 | # define CPU_AUXCTL_CZ (1 << 6) /* Restrict Cache Size */ |
240 | | | 240 | |
241 | /* bits to set in the Control Register */ | | 241 | /* bits to set in the Control Register */ |
242 | Lcontrol_set: | | 242 | Lcontrol_set: |
243 | .word CPU_CONTROL_MMU_ENABLE | \ | | 243 | .word CPU_CONTROL_MMU_ENABLE | \ |
244 | CPU_CONTROL_AFLT_ENABLE | \ | | 244 | CPU_CONTROL_AFLT_ENABLE | \ |
245 | CPU_CONTROL_DC_ENABLE | \ | | 245 | CPU_CONTROL_DC_ENABLE | \ |
246 | CPU_CONTROL_IC_ENABLE | \ | | 246 | CPU_CONTROL_IC_ENABLE | \ |
247 | CPU_CONTROL_BPRD_ENABLE | | 247 | CPU_CONTROL_BPRD_ENABLE |
248 | | | 248 | |
249 | /* bits to clear in the Control Register */ | | 249 | /* bits to clear in the Control Register */ |
250 | Lcontrol_clr: | | 250 | Lcontrol_clr: |
251 | .word 0 | | 251 | .word 0 |
252 | | | 252 | |
253 | /* bits to "write as existing" in the Control Register */ | | 253 | /* bits to "write as existing" in the Control Register */ |
254 | Lcontrol_wax: | | 254 | Lcontrol_wax: |
255 | .word (1 << 31) | \ | | 255 | .word (1 << 31) | \ |
256 | (1 << 26) | \ | | 256 | (1 << 26) | \ |
257 | (0x7ff << 14) | \ | | 257 | (0x7ff << 14) | \ |
258 | (0xff << 3) | | 258 | (0xff << 3) |
259 | | | 259 | |
260 | /* bits to disable the caches */ | | 260 | /* bits to disable the caches */ |
261 | Lctl_ID_dis: | | 261 | Lctl_ID_dis: |
262 | .word ~(CPU_CONTROL_IC_ENABLE|CPU_CONTROL_DC_ENABLE) | | 262 | .word ~(CPU_CONTROL_IC_ENABLE|CPU_CONTROL_DC_ENABLE) |
263 | | | 263 | |
264 | /* bit to restrict cache size */ | | 264 | /* bit to restrict cache size */ |
265 | Lauxctl_CZ_restrict: | | 265 | Lauxctl_CZ_restrict: |
266 | .word CPU_AUXCTL_CZ | | 266 | .word CPU_AUXCTL_CZ |
267 | | | 267 | |
268 | | | 268 | |
269 | /* We'll modify va and pa at run time so we can use relocatable addresses. */ | | 269 | /* We'll modify va and pa at run time so we can use relocatable addresses. */ |
270 | #define MMU_INIT(va,pa,n_sec,attr) \ | | 270 | #define MMU_INIT(va,pa,n_sec,attr) \ |
271 | .word va ; \ | | 271 | .word va ; \ |
272 | .word pa ; \ | | 272 | .word pa ; \ |
273 | .word n_sec ; \ | | 273 | .word n_sec ; \ |
274 | .word attr ; | | 274 | .word attr ; |
275 | | | 275 | |
276 | mmu_init_table: | | 276 | mmu_init_table: |
277 | /* Map KERNEL_BASE VA to SDRAM PA, write-back cacheable */ | | 277 | /* Map KERNEL_BASE VA to SDRAM PA, write-back cacheable */ |
278 | MMU_INIT(KERNEL_BASE, KERNEL_BASE, | | 278 | MMU_INIT(KERNEL_BASE, KERNEL_BASE, |
279 | (INIT_MEMSIZE * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, | | 279 | (INIT_MEMSIZE * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, |
280 | L1_S_PROTO | L1_S_APv7_KRW | L1_S_B | L1_S_C) | | 280 | L1_S_PROTO | L1_S_APv7_KRW | L1_S_B | L1_S_C) |
281 | | | 281 | |
282 | /* Map first 1MB of L4 CORE (so console will work) */ | | 282 | /* Map first 1MB of L4 CORE (so console will work) */ |
283 | MMU_INIT(OMAP_L4_CORE_VBASE, OMAP_L4_CORE_BASE, | | 283 | MMU_INIT(OMAP_L4_CORE_VBASE, OMAP_L4_CORE_BASE, |
284 | (OMAP_L4_CORE_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, | | 284 | (OMAP_L4_CORE_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, |
285 | L1_S_PROTO | L1_S_APv7_KRW) | | 285 | L1_S_PROTO | L1_S_APv7_KRW) |
286 | | | 286 | |
287 | #if OMAP_L4_CORE_BASE <= CONSADDR \ | | 287 | #if OMAP_L4_CORE_BASE <= CONSADDR \ |
288 | /* Map first 1MB of L4 CORE 1:1 (so console will work) */ | | | |
289 | && CONSADDR < OMAP_L4_CORE_BASE + OMAP_L4_CORE_SIZE | | 288 | && CONSADDR < OMAP_L4_CORE_BASE + OMAP_L4_CORE_SIZE |
| | | 289 | /* Map first 1MB of L4 CORE 1:1 (so console will work) */ |
290 | MMU_INIT(OMAP_L4_CORE_BASE, OMAP_L4_CORE_BASE, | | 290 | MMU_INIT(OMAP_L4_CORE_BASE, OMAP_L4_CORE_BASE, |
291 | (OMAP_L4_CORE_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, | | 291 | (OMAP_L4_CORE_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, |
292 | L1_S_PROTO | L1_S_APv7_KRW) | | 292 | L1_S_PROTO | L1_S_APv7_KRW) |
293 | #endif | | 293 | #endif |
294 | | | 294 | |
295 | /* Map first 4MB of L4 PERIPHERAL (so console will work) */ | | 295 | /* Map first 4MB of L4 PERIPHERAL (so console will work) */ |
296 | MMU_INIT(OMAP_L4_PERIPHERAL_VBASE, OMAP_L4_PERIPHERAL_BASE, | | 296 | MMU_INIT(OMAP_L4_PERIPHERAL_VBASE, OMAP_L4_PERIPHERAL_BASE, |
297 | (OMAP_L4_PERIPHERAL_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, | | 297 | (OMAP_L4_PERIPHERAL_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, |
298 | L1_S_PROTO | L1_S_APv7_KRW) | | 298 | L1_S_PROTO | L1_S_APv7_KRW) |
299 | | | 299 | |
300 | #if OMAP_L4_PERIPHERAL_BASE <= CONSADDR \ | | 300 | #if OMAP_L4_PERIPHERAL_BASE <= CONSADDR \ |
301 | && CONSADDR < OMAP_L4_PERIPHERAL_BASE + OMAP_L4_PERIPHERAL_SIZE | | 301 | && CONSADDR < OMAP_L4_PERIPHERAL_BASE + OMAP_L4_PERIPHERAL_SIZE |
302 | /* Map first 1MB of L4 PERIPHERAL 1:1 (so console will work) */ | | 302 | /* Map first 1MB of L4 PERIPHERAL 1:1 (so console will work) */ |
303 | MMU_INIT(OMAP_L4_PERIPHERAL_BASE, OMAP_L4_PERIPHERAL_BASE, | | 303 | MMU_INIT(OMAP_L4_PERIPHERAL_BASE, OMAP_L4_PERIPHERAL_BASE, |
304 | (OMAP_L4_PERIPHERAL_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, | | 304 | (OMAP_L4_PERIPHERAL_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, |
305 | L1_S_PROTO | L1_S_APv7_KRW) | | 305 | L1_S_PROTO | L1_S_APv7_KRW) |
306 | #endif | | 306 | #endif |
307 | | | 307 | |
308 | #if defined(OMAP_L4_WAKEUP_BASE) && defined(OMAP_L4_WAKEUP_VBASE) | | 308 | #if defined(OMAP_L4_WAKEUP_BASE) && defined(OMAP_L4_WAKEUP_VBASE) |
309 | /* Map all 4MB of L4 WAKEUP (so console will work) */ | | 309 | /* Map all 4MB of L4 WAKEUP (so console will work) */ |
310 | MMU_INIT(OMAP_L4_WAKEUP_VBASE, OMAP_L4_WAKEUP_BASE, | | 310 | MMU_INIT(OMAP_L4_WAKEUP_VBASE, OMAP_L4_WAKEUP_BASE, |
311 | (OMAP_L4_WAKEUP_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, | | 311 | (OMAP_L4_WAKEUP_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, |
312 | L1_S_PROTO | L1_S_APv7_KRW) | | 312 | L1_S_PROTO | L1_S_APv7_KRW) |
313 | #endif | | 313 | #endif |
314 | | | 314 | |
315 | #ifdef OMAP_L4_FAST_BASE | | 315 | #ifdef OMAP_L4_FAST_BASE |
316 | /* Map first 1MB of L4 FAST (so console will work) */ | | 316 | /* Map first 1MB of L4 FAST (so console will work) */ |
317 | MMU_INIT(OMAP_L4_FAST_VBASE, OMAP_L4_FAST_BASE, | | 317 | MMU_INIT(OMAP_L4_FAST_VBASE, OMAP_L4_FAST_BASE, |
318 | (OMAP_L4_FAST_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, | | 318 | (OMAP_L4_FAST_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, |
319 | L1_S_PROTO | L1_S_APv7_KRW) | | 319 | L1_S_PROTO | L1_S_APv7_KRW) |
320 | #endif | | 320 | #endif |
321 | | | 321 | |
322 | #ifdef OMAP_EMIF1_BASE | | 322 | #ifdef OMAP_EMIF1_BASE |
323 | /* Map first 1MB of EMIF1 (so we can probe memory size) */ | | 323 | /* Map first 1MB of EMIF1 (so we can probe memory size) */ |
324 | MMU_INIT(OMAP_EMIF1_VBASE, OMAP_EMIF1_BASE, | | 324 | MMU_INIT(OMAP_EMIF1_VBASE, OMAP_EMIF1_BASE, |
325 | (OMAP_EMIF1_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, | | 325 | (OMAP_EMIF1_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, |
326 | L1_S_PROTO | L1_S_APv7_KRW) | | 326 | L1_S_PROTO | L1_S_APv7_KRW) |
327 | #endif | | 327 | #endif |
328 | | | 328 | |
329 | #ifdef OMAP_EMIF2_BASE | | 329 | #ifdef OMAP_EMIF2_BASE |
330 | /* Map first 1MB of EMIF2 (so we can probe memory size) */ | | 330 | /* Map first 1MB of EMIF2 (so we can probe memory size) */ |
331 | MMU_INIT(OMAP_EMIF2_VBASE, OMAP_EMIF2_BASE, | | 331 | MMU_INIT(OMAP_EMIF2_VBASE, OMAP_EMIF2_BASE, |
332 | (OMAP_EMIF2_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, | | 332 | (OMAP_EMIF2_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, |
333 | L1_S_PROTO | L1_S_APv7_KRW) | | 333 | L1_S_PROTO | L1_S_APv7_KRW) |
334 | #endif | | 334 | #endif |
335 | | | 335 | |
336 | #ifdef OMAP_SDRC_BASE | | 336 | #ifdef OMAP_SDRC_BASE |
337 | /* Map 64KB SDRAM Controller (SDRC) */ | | 337 | /* Map 64KB SDRAM Controller (SDRC) */ |
338 | MMU_INIT(OMAP_SDRC_VBASE, OMAP_SDRC_BASE, | | 338 | MMU_INIT(OMAP_SDRC_VBASE, OMAP_SDRC_BASE, |
339 | (OMAP_SDRC_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, | | 339 | (OMAP_SDRC_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, |
340 | L1_S_PROTO | L1_S_APv7_KRW) | | 340 | L1_S_PROTO | L1_S_APv7_KRW) |
341 | #endif | | 341 | #endif |
342 | | | 342 | |
343 | /* end of table */ | | 343 | /* end of table */ |
344 | MMU_INIT(0, 0, 0, 0) | | 344 | MMU_INIT(0, 0, 0, 0) |