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#include <config.h>
31#include <version.h>
32
33
34#include <./configs/omap1510.h>
35#endif
36
37
38_TEXT_BASE:
39 .word CONFIG_SYS_TEXT_BASE
40
41.globl lowlevel_init
42lowlevel_init:
43
44
45
46
47
48 mrc p15, 0, r0, c1, c0
49 orr r0, r0,
50 mcr p15, 0, r0, c1, c0
51
52
53
54
55 mov r1,
56 ldr r0, =REG_IHL1_MIR
57 str r1, [r0]
58 ldr r0, =REG_IHL2_MIR
59 str r1, [r0]
60
61
62
63
64 ldr r0, REG_ARM_IDLECT1
65 ldr r1, VAL_ARM_IDLECT1
66 str r1, [r0]
67
68
69
70
71 ldr r0, REG_ARM_IDLECT2
72 ldr r1, VAL_ARM_IDLECT2
73 str r1, [r0]
74
75
76
77
78 ldr r0, REG_ARM_IDLECT3
79 ldr r1, VAL_ARM_IDLECT3
80 str r1, [r0]
81
82 mov r1,
83 ldr r0, REG_ARM_RSTCT2
84 strh r1, [r0]
85
86
87 mov r1,
88 ldr r0, REG_ARM_SYSST
89
90 mov r2,
911: cmp r2,
92 streqh r1, [r0]
93 add r2, r2,
94 cmp r2,
95 bne 1b
96
97 ldr r1, VAL_ARM_CKCTL
98 ldr r0, REG_ARM_CKCTL
99 strh r1, [r0]
100
101
102 nop
103 nop
104 nop
105 nop
106 nop
107 nop
108 nop
109 nop
110 nop
111 nop
112
113
114
115 ldr r1, VAL_DPLL1_CTL
116 ldr r0, REG_DPLL1_CTL
117 strh r1, [r0]
118 ands r1, r1,
119 beq lock_end
1202:
121 ldrh r1, [r0]
122 ands r1, r1,
123 beq 2b
124lock_end:
125
126
127
128
129 ldr r0, REG_WATCHDOG
130 ldr r1, WATCHDOG_VAL1
131 str r1, [r0]
132 ldr r1, WATCHDOG_VAL2
133 str r1, [r0]
134 ldr r0, REG_WSPRDOG
135 ldr r1, WSPRDOG_VAL1
136 str r1, [r0]
137 ldr r0, REG_WWPSDOG
138
139watch1Wait:
140 ldr r1, [r0]
141 tst r1,
142 bne watch1Wait
143
144 ldr r0, REG_WSPRDOG
145 ldr r1, WSPRDOG_VAL2
146 str r1, [r0]
147 ldr r0, REG_WWPSDOG
148watch2Wait:
149 ldr r1, [r0]
150 tst r1,
151 bne watch2Wait
152
153
154 ldr r3, VAL_SDRAM_CONFIG_SDF0
155
156
157
158
159 mov r0,
160 mov r1, pc
161 cmp r1, r0
162 bge skip_sdram
163
164
165 ldr r0, REG_DEVICE_ID
166 ldr r1, [r0]
167
168 ldr r0, VAL_DEVICE_ID_TMP
169 mov r1, r1, lsl
170 mov r1, r1, lsr
171 cmp r0, r1
172 bne skip_TMP_Patch
173
174
175 mov r0,
176 ldr r1, REG_TC_EMIFF_DOUBLER
177 str r0, [r1]
178
179
180 mov r0,
181 ldr r1, REG_SDRAM_CONFIG2
182 str r0, [r1]
183
184 ldr r3, VAL_SDRAM_CONFIG_SDF1
185
186skip_TMP_Patch:
187
188
189
190
191 mov r0,
1923:
193 subs r0, r0,
194 bne 3b
195
196
197
198
199
200
201 ldr r0, REG_SDRAM_OPERATION
202 mov r2,
203 str r2, [r0]
204
205
206 ldr r0, REG_SDRAM_CONFIG
207 str r3, [r0]
208
209
210 ldr r0, REG_SDRAM_MANUAL_CMD
211
212
213 mov r1,
214 str r1, [r0]
215
216
217 mov r1,
218 str r1, [r0]
219
220 mov r2,
221waitMDDR1:
222 subs r2, r2,
223 bne waitMDDR1
224
225
226 mov r1,
227 str r1, [r0]
228
229
230 mov r1,
231 str r1, [r0]
232 str r1, [r0]
233
234
235 ldr r0, REG_SDRAM_MRS
236 mov r1,
237 str r1, [r0]
238
239
240 ldr r0, REG_SDRAM_EMRS1
241
242 mov r1,
243 str r1, [r0]
244
245 ldr r0, REG_DLL_URD_CONTROL
246 ldr r1, DLL_URD_CONTROL_VAL
247 str r1, [r0]
248
249 ldr r0, REG_DLL_LRD_CONTROL
250 ldr r1, DLL_LRD_CONTROL_VAL
251 str r1, [r0]
252
253 ldr r0, REG_DLL_WRT_CONTROL
254 ldr r1, DLL_WRT_CONTROL_VAL
255 str r1, [r0]
256
257
258 mov r0,
259waitMDDR2:
260 subs r0, r0,
261 bne waitMDDR2
262
263
264
265
266 mov r0,
2674:
268 subs r0, r0,
269 bne 4b
270 b common_tc
271
272skip_sdram:
273 ldr r0, REG_SDRAM_CONFIG
274 str r3, [r0]
275
276common_tc:
277
278 ldr r1, VAL_TC_EMIFS_CS0_CONFIG
279 ldr r0, REG_TC_EMIFS_CS0_CONFIG
280 str r1, [r0]
281
282 ldr r1, VAL_TC_EMIFS_CS1_CONFIG
283 ldr r0, REG_TC_EMIFS_CS1_CONFIG
284 str r1, [r0]
285
286 ldr r1, VAL_TC_EMIFS_CS3_CONFIG
287 ldr r0, REG_TC_EMIFS_CS3_CONFIG
288 str r1, [r0]
289
290 ldr r1, VAL_TC_EMIFS_DWS
291 ldr r0, REG_TC_EMIFS_DWS
292 str r1, [r0]
293
294#ifdef CONFIG_H2_OMAP1610
295
296 ldr r0, REG_TC_EMIFS_CS1_ADVANCED
297 ldr r1, VAL_TC_EMIFS_CS1_ADVANCED
298 str r1, [r0]
299#endif
300
301 ldr r0, REG_MPU_LOAD_TIMER
302 ldr r1, VAL_MPU_LOAD_TIMER
303 str r1, [r0]
304
305 ldr r0, REG_MPU_CNTL_TIMER
306 ldr r1, VAL_MPU_CNTL_TIMER
307 str r1, [r0]
308
309
310
311
312 ldr sp, SRAM_STACK
313 bic sp, sp,
314
315
316
317
318 push {ip, lr}
319
320
321
322
323 bl s_init
324 pop {ip, pc}
325
326
327 mov pc, lr
328
329
330 .ltorg
331
332REG_DEVICE_ID:
333 .word 0xfffe2004
334REG_TC_EMIFS_CONFIG:
335 .word 0xfffecc0c
336REG_TC_EMIFS_CS0_CONFIG:
337 .word 0xfffecc10
338REG_TC_EMIFS_CS1_CONFIG:
339 .word 0xfffecc14
340REG_TC_EMIFS_CS2_CONFIG:
341 .word 0xfffecc18
342REG_TC_EMIFS_CS3_CONFIG:
343 .word 0xfffecc1c
344REG_TC_EMIFS_DWS:
345 .word 0xfffecc40
346#ifdef CONFIG_H2_OMAP1610
347REG_TC_EMIFS_CS1_ADVANCED:
348 .word 0xfffecc54
349#endif
350
351
352REG_ARM_CKCTL:
353 .word 0xfffece00
354REG_ARM_IDLECT3:
355 .word 0xfffece24
356REG_ARM_IDLECT2:
357 .word 0xfffece08
358REG_ARM_IDLECT1:
359 .word 0xfffece04
360REG_ARM_RSTCT2:
361 .word 0xfffece14
362REG_ARM_SYSST:
363 .word 0xfffece18
364
365
366REG_DPLL1_CTL:
367 .word 0xfffecf00
368
369
370
371REG_WSPRDOG:
372 .word 0xfffeb048
373
374REG_WWPSDOG:
375 .word 0xfffeb034
376
377WSPRDOG_VAL1:
378 .word 0x0000aaaa
379WSPRDOG_VAL2:
380 .word 0x00005555
381
382
383
384REG_SDRAM_CONFIG:
385 .word 0xfffecc20
386REG_SDRAM_CONFIG2:
387 .word 0xfffecc3c
388REG_TC_EMIFF_DOUBLER:
389 .word 0xfffecc60
390
391
392REG_SDRAM_OPERATION:
393 .word 0xfffecc80
394
395
396REG_SDRAM_MANUAL_CMD:
397 .word 0xfffecc84
398
399
400REG_SDRAM_MRS:
401 .word 0xfffecc70
402
403
404REG_SDRAM_EMRS1:
405 .word 0xfffecc78
406
407
408REG_DLL_WRT_CONTROL:
409 .word 0xfffecc68
410DLL_WRT_CONTROL_VAL:
411 .word 0x03f00002
412
413
414REG_DLL_URD_CONTROL:
415 .word 0xfffeccc0
416DLL_URD_CONTROL_VAL:
417 .word 0x00800002
418
419
420REG_DLL_LRD_CONTROL:
421 .word 0xfffecccc
422DLL_LRD_CONTROL_VAL:
423 .word 0x00800002
424
425REG_WATCHDOG:
426 .word 0xfffec808
427WATCHDOG_VAL1:
428 .word 0x000000f5
429WATCHDOG_VAL2:
430 .word 0x000000a0
431
432REG_MPU_LOAD_TIMER:
433 .word 0xfffec504
434REG_MPU_CNTL_TIMER:
435 .word 0xfffec500
436VAL_MPU_LOAD_TIMER:
437 .word 0xffffffff
438VAL_MPU_CNTL_TIMER:
439 .word 0xffffffa1
440
441
442
443VAL_SDRAM_CONFIG_SDF0:
444 .word 0x0014e6fe
445
446
447VAL_SDRAM_CONFIG_SDF1:
448 .word 0x0114e6fe
449
450VAL_ARM_CKCTL:
451 .word 0x2000
452VAL_DPLL1_CTL:
453 .word 0x2830
454
455#ifdef CONFIG_OSK_OMAP5912
456VAL_TC_EMIFS_CS0_CONFIG:
457 .word 0x002130b0
458VAL_TC_EMIFS_CS1_CONFIG:
459 .word 0x00001133
460VAL_TC_EMIFS_CS2_CONFIG:
461 .word 0x000055f0
462VAL_TC_EMIFS_CS3_CONFIG:
463 .word 0x88013141
464VAL_TC_EMIFS_DWS:
465 .word 0x000000c0
466VAL_DEVICE_ID_TMP:
467 .word 0xb65f
468#endif
469
470#ifdef CONFIG_H2_OMAP1610
471VAL_TC_EMIFS_CS0_CONFIG:
472 .word 0x00203331
473VAL_TC_EMIFS_CS1_CONFIG:
474 .word 0x8180fff3
475VAL_TC_EMIFS_CS2_CONFIG:
476 .word 0xf800f22a
477VAL_TC_EMIFS_CS3_CONFIG:
478 .word 0x88013141
479VAL_TC_EMIFS_CS1_ADVANCED:
480 .word 0x00000022
481#endif
482
483VAL_ARM_IDLECT1:
484 .word 0x00000400
485VAL_ARM_IDLECT2:
486 .word 0x00000886
487VAL_ARM_IDLECT3:
488 .word 0x00000015
489
490SRAM_STACK:
491 .word CONFIG_SYS_INIT_SP_ADDR
492
493
494.equ CMD_SDRAM_NOP, 0x00000000
495.equ CMD_SDRAM_PRECHARGE, 0x00000001
496.equ CMD_SDRAM_AUTOREFRESH, 0x00000002
497.equ CMD_SDRAM_CKE_SET_HIGH, 0x00000007
498