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 mov pc, lr
311
312
313 .ltorg
314
315REG_DEVICE_ID:
316 .word 0xfffe2004
317REG_TC_EMIFS_CONFIG:
318 .word 0xfffecc0c
319REG_TC_EMIFS_CS0_CONFIG:
320 .word 0xfffecc10
321REG_TC_EMIFS_CS1_CONFIG:
322 .word 0xfffecc14
323REG_TC_EMIFS_CS2_CONFIG:
324 .word 0xfffecc18
325REG_TC_EMIFS_CS3_CONFIG:
326 .word 0xfffecc1c
327REG_TC_EMIFS_DWS:
328 .word 0xfffecc40
329#ifdef CONFIG_H2_OMAP1610
330REG_TC_EMIFS_CS1_ADVANCED:
331 .word 0xfffecc54
332#endif
333
334
335REG_ARM_CKCTL:
336 .word 0xfffece00
337REG_ARM_IDLECT3:
338 .word 0xfffece24
339REG_ARM_IDLECT2:
340 .word 0xfffece08
341REG_ARM_IDLECT1:
342 .word 0xfffece04
343REG_ARM_RSTCT2:
344 .word 0xfffece14
345REG_ARM_SYSST:
346 .word 0xfffece18
347
348
349REG_DPLL1_CTL:
350 .word 0xfffecf00
351
352
353
354REG_WSPRDOG:
355 .word 0xfffeb048
356
357REG_WWPSDOG:
358 .word 0xfffeb034
359
360WSPRDOG_VAL1:
361 .word 0x0000aaaa
362WSPRDOG_VAL2:
363 .word 0x00005555
364
365
366
367REG_SDRAM_CONFIG:
368 .word 0xfffecc20
369REG_SDRAM_CONFIG2:
370 .word 0xfffecc3c
371REG_TC_EMIFF_DOUBLER:
372 .word 0xfffecc60
373
374
375REG_SDRAM_OPERATION:
376 .word 0xfffecc80
377
378
379REG_SDRAM_MANUAL_CMD:
380 .word 0xfffecc84
381
382
383REG_SDRAM_MRS:
384 .word 0xfffecc70
385
386
387REG_SDRAM_EMRS1:
388 .word 0xfffecc78
389
390
391REG_DLL_WRT_CONTROL:
392 .word 0xfffecc68
393DLL_WRT_CONTROL_VAL:
394 .word 0x03f00002
395
396
397REG_DLL_URD_CONTROL:
398 .word 0xfffeccc0
399DLL_URD_CONTROL_VAL:
400 .word 0x00800002
401
402
403REG_DLL_LRD_CONTROL:
404 .word 0xfffecccc
405DLL_LRD_CONTROL_VAL:
406 .word 0x00800002
407
408REG_WATCHDOG:
409 .word 0xfffec808
410WATCHDOG_VAL1:
411 .word 0x000000f5
412WATCHDOG_VAL2:
413 .word 0x000000a0
414
415REG_MPU_LOAD_TIMER:
416 .word 0xfffec504
417REG_MPU_CNTL_TIMER:
418 .word 0xfffec500
419VAL_MPU_LOAD_TIMER:
420 .word 0xffffffff
421VAL_MPU_CNTL_TIMER:
422 .word 0xffffffa1
423
424
425
426VAL_SDRAM_CONFIG_SDF0:
427 .word 0x0014e6fe
428
429
430VAL_SDRAM_CONFIG_SDF1:
431 .word 0x0114e6fe
432
433VAL_ARM_CKCTL:
434 .word 0x2000
435VAL_DPLL1_CTL:
436 .word 0x2830
437
438#ifdef CONFIG_OSK_OMAP5912
439VAL_TC_EMIFS_CS0_CONFIG:
440 .word 0x002130b0
441VAL_TC_EMIFS_CS1_CONFIG:
442 .word 0x00001133
443VAL_TC_EMIFS_CS2_CONFIG:
444 .word 0x000055f0
445VAL_TC_EMIFS_CS3_CONFIG:
446 .word 0x88013141
447VAL_TC_EMIFS_DWS:
448 .word 0x000000c0
449VAL_DEVICE_ID_TMP:
450 .word 0xb65f
451#endif
452
453#ifdef CONFIG_H2_OMAP1610
454VAL_TC_EMIFS_CS0_CONFIG:
455 .word 0x00203331
456VAL_TC_EMIFS_CS1_CONFIG:
457 .word 0x8180fff3
458VAL_TC_EMIFS_CS2_CONFIG:
459 .word 0xf800f22a
460VAL_TC_EMIFS_CS3_CONFIG:
461 .word 0x88013141
462VAL_TC_EMIFS_CS1_ADVANCED:
463 .word 0x00000022
464#endif
465
466VAL_ARM_IDLECT1:
467 .word 0x00000400
468VAL_ARM_IDLECT2:
469 .word 0x00000886
470VAL_ARM_IDLECT3:
471 .word 0x00000015
472
473
474.equ CMD_SDRAM_NOP, 0x00000000
475.equ CMD_SDRAM_PRECHARGE, 0x00000001
476.equ CMD_SDRAM_AUTOREFRESH, 0x00000002
477.equ CMD_SDRAM_CKE_SET_HIGH, 0x00000007
478