1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34#include <config.h>
35#include <version.h>
36
37#include <asm/arch/s3c6400.h>
38
39#ifdef CONFIG_SERIAL1
40#define ELFIN_UART_CONSOLE_BASE (ELFIN_UART_BASE + ELFIN_UART0_OFFSET)
41
42#define ELFIN_UART_CONSOLE_BASE (ELFIN_UART_BASE + ELFIN_UART1_OFFSET)
43#else
44#define ELFIN_UART_CONSOLE_BASE (ELFIN_UART_BASE + ELFIN_UART2_OFFSET)
45#endif
46
47_TEXT_BASE:
48 .word CONFIG_SYS_TEXT_BASE
49
50 .globl lowlevel_init
51lowlevel_init:
52 mov r12, lr
53
54
55 ldr r0, =ELFIN_GPIO_BASE
56 ldr r1, =0x55540000
57 str r1, [r0,
58
59 ldr r1, =0x55555555
60 str r1, [r0,
61
62 ldr r1, =0xf000
63 str r1, [r0,
64
65
66 ldr r0, =0x7e000000 @0x7e004000
67 orr r0, r0,
68 mov r1,
69 str r1, [r0]
70
71
72 ldr r0, =(ELFIN_GPIO_BASE+EINTPEND_OFFSET)
73 ldr r1, [r0]
74 str r1, [r0]
75
76 ldr r0, =ELFIN_VIC0_BASE_ADDR @0x71200000
77 ldr r1, =ELFIN_VIC1_BASE_ADDR @0x71300000
78
79
80 mvn r3,
81 str r3, [r0,
82 str r3, [r1,
83
84
85 mov r3,
86 str r3, [r0,
87 str r3, [r1,
88
89
90 mov r3,
91 str r3, [r0,
92 str r3, [r1,
93
94
95 bl system_clock_init
96
97#ifndef CONFIG_NAND_SPL
98
99 bl uart_asm_init
100#endif
101
102#ifdef CONFIG_BOOT_NAND
103
104 bl nand_asm_init
105#endif
106
107
108 ldr r0, =ELFIN_MEM_SYS_CFG
109
110
111 mov r1,
112 str r1, [r0]
113
114 bl mem_ctrl_asm_init
115
116
117 ldr r0, =(ELFIN_CLOCK_POWER_BASE + RST_STAT_OFFSET)
118 ldr r1, [r0]
119 bic r1, r1,
120 cmp r1,
121 beq wakeup_reset
122
1231:
124 mov lr, r12
125 mov pc, lr
126
127wakeup_reset:
128
129
130 ldr r0, =(ELFIN_CLOCK_POWER_BASE + WAKEUP_STAT_OFFSET)
131 ldr r1, [r0]
132 str r1, [r0]
133
134
135 ldr r0, =ELFIN_GPIO_BASE
136 ldr r1, =0x3000
137 str r1, [r0,
138
139
140 ldr r0, =(ELFIN_CLOCK_POWER_BASE + INF_REG0_OFFSET)
141
142 ldr r1, [r0]
143
144 mov pc, r1
145 nop
146 nop
147
148
149
150
151system_clock_init:
152 ldr r0, =ELFIN_CLOCK_POWER_BASE
153
154#ifdef CONFIG_SYNC_MODE
155 ldr r1, [r0,
156 mov r2,
157 orr r1, r1, r2
158 str r1, [r0,
159
160 nop
161 nop
162 nop
163 nop
164 nop
165
166 ldr r2, =0x80
167 orr r1, r1, r2
168 str r1, [r0,
169
170check_syncack:
171 ldr r1, [r0,
172 ldr r2, =0xf00
173 and r1, r1, r2
174 cmp r1,
175 bne check_syncack
176#else
177 nop
178 nop
179 nop
180 nop
181 nop
182
183
184
185
186
187#ifndef CONFIG_S3C6400
188 ldr r1, [r0,
189 bic r1, r1,
190 orr r1, r1,
191 str r1, [r0,
192
193wait_for_async:
194 ldr r1, [r0,
195 and r1, r1,
196 cmp r1,
197 bne wait_for_async
198#endif
199
200 ldr r1, [r0,
201 bic r1, r1,
202 str r1, [r0,
203#endif
204
205 mov r1,
206 orr r1, r1,
207 str r1, [r0,
208 str r1, [r0,
209
210
211 ldr r1, [r0,
212 bic r1, r1,
213 bic r1, r1,
214 bic r1, r1,
215 ldr r2, =CLK_DIV_VAL
216 orr r1, r1, r2
217 str r1, [r0,
218
219 ldr r1, =APLL_VAL
220 str r1, [r0,
221 ldr r1, =MPLL_VAL
222 str r1, [r0,
223
224
225 ldr r1, =0x200203
226 str r1, [r0,
227 ldr r1, =0x0
228 str r1, [r0,
229
230
231 ldr r1, [r0,
232 orr r1, r1,
233 str r1, [r0,
234
235
236 mov r1,
2371: subs r1, r1,
238 bne 1b
239
240
241
242 ldr r1, [r0,
243 orr r1, r1,
244 str r1, [r0,
245
246
247 ldr r1, [r0,
248 bic r1, r1,
249 str r1, [r0,
250#endif
251 mov pc, lr
252
253
254#ifndef CONFIG_NAND_SPL
255
256
257
258uart_asm_init:
259
260 ldr r0, =ELFIN_GPIO_BASE
261 ldr r1, =0x220022
262 str r1, [r0,
263 mov pc, lr
264#endif
265
266#ifdef CONFIG_BOOT_NAND
267
268
269
270nand_asm_init:
271 ldr r0, =ELFIN_NAND_BASE
272 ldr r1, [r0,
273 orr r1, r1,
274 orr r1, r1,
275 str r1, [r0,
276
277 ldr r1, [r0,
278 orr r1, r1,
279 str r1, [r0,
280
281 mov pc, lr
282#endif
283
284#ifdef CONFIG_ENABLE_MMU
285
286
287
288
289
290.macro FL_SECTION_ENTRY base,ap,d,c,b
291 .word (\base << 20) | (\ap << 10) | \
292 (\d << 5) | (1<<4) | (\c << 3) | (\b << 2) | (1<<1)
293.endm
294
295.section .mmudata, "a"
296 .align 14
297
298 .globl mmu_table
299mmu_table:
300 .set __base, 0
301
302 .rept 0xA00
303 FL_SECTION_ENTRY __base, 3, 0, 0, 0
304 .set __base, __base + 1
305 .endr
306
307
308 .rept 0xC00 - 0xA00
309 .word 0x00000000
310 .endr
311
312
313 .set __base, 0x500
314 .rept 0xC80 - 0xC00
315 FL_SECTION_ENTRY __base, 3, 0, 1, 1
316 .set __base, __base + 1
317 .endr
318
319
320 .rept 0x1000 - 0xc80
321 .word 0x00000000
322 .endr
323#endif
324