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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
|
/*
* Copyright (C) 2010 Freescale Semiconductor, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <config.h>
#include <asm/arch/mx50.h>
#ifdef CONFIG_FLASH_HEADER
#ifndef CONFIG_FLASH_HEADER_OFFSET
# error "Must define the offset of flash header"
#endif
#if defined(CONFIG_ZQ_CALIB)
.macro do_zq_calib
/*=============================================================================
* ZQ calibration
*===========================================================================*/
ldr r0, =DATABAHN_BASE_ADDR
/*=============================================================================
* Pu calibration start
*===========================================================================*/
ldr r1, =0x0
pu_loop:
cmp r1, #0x20
beq pu_out
// pu<<16,pd=0
mov r2, r1, lsl #16
// Set SW_CFG1
str r2, [r0, #0x128]
// ((pd+1)<<8) | (pu+1)
add r1, r1, #0x1
ldr r2, =0x1
orr r3, r1, r2, lsl #8
// Set SW_CFG2
str r3, [r0, #0x12c]
sub r1, r1, #0x1
// Start ZQ comparator
ldr r2, =0x10000
str r2, [r0, #0x124]
// Delay 300ns at least
ldr r3, =0x0
pu_delay:
add r3, r3, #0x1
cmp r3, #0x1000
bne pu_delay
// Read compare result
ldr r3, [r0,#0x14c]
and r3, r3, #0x1
// Stop ZQ comparator
ldr r2, =0x0
str r2, [r0, #0x124]
// Add pu value
add r1, r1, #0x1
cmp r3, #0x1
bne pu_loop
pu_out:
// Pu calibration result in r1
sub r1, r1, #0x1
/*=============================================================================
* PD calibration start
*===========================================================================*/
ldr r2, =0x0
pd_loop:
cmp r2, #0xf
beq pd_out
// pd<<24 | pu<<16 | 1<<4
mov r3, r2, lsl #24
orr r3, r3, r1, lsl #16
orr r3, r3, #0x10
// Set SW_CFG1
str r3, [r0, #0x128]
// ((pd+1) << 8) | (pu+1)
add r2, r2, #0x1
add r1, r1, #0x1
mov r3, r2, LSL #8
orr r3, r3, r1
// Set SW_CFG2
str r3, [r0, #0x12c]
sub r2, r2, #0x1
sub r1, r1, #0x1
// Start ZQ comparator
ldr r3, =0x10000
str r3, [r0, #0x124]
// Delay 300ns at least
ldr r3, =0x0
pd_delay:
add r3, r3, #0x1
cmp r3, #0x1000
bne pd_delay
// Read compare result
ldr r3, [r0, #0x14c]
and r3, r3, #0x1
// Stop ZQ comparator
ldr r8, =0x0
str r8, [r0, #0x124]
// Add pd value
add r2, r2, #0x1
cmp r3, #0x0
bne pd_loop
// Make sure r2 > 0
cmp r2, #0x0
beq pd_loop
pd_out:
// Pd calibration result in r2
sub r2, r2, #0x2
/*=============================================================================
* Software load PU/PD value,PU is stored in r1, and PD is stored in r2
*===========================================================================*/
/* ((pd + 1) << 24) | ((pu + 1) << 16) */
add r5, r1, #0x1
add r6, r2, #0x1
mov r3, r6, lsl #24
orr r3, r3, r5, lsl #16
/* Set SW_CFG1 */
str r3, [r0, #0x128]
/* (pd << 8) | pu */
mov r3, r2, lsl #8
orr r3, r3, r1
/* Set SW_CFG2 */
str r3, [r0, #0x12c]
/* Loading PU value, set pu_pd_sel=0 */
ldr r3, =0x310000
str r3, [r0, #0x124]
/* Clear for next load */
ldr r3, =0x200000
str r3, [r0, #0x124]
/* Loading PD value, set pu_pd_sel=1 */
ldr r3, =0x10
orr r3, r3, r6, lsl #24
orr r3, r3, r5, lsl #16
str r3, [r0, #0x128]
ldr r3, =0x310000
str r3, [r0, #0x124]
ldr r3, =0x200000
str r3, [r0, #0x124]
.endm
#endif
.section ".text.flasheader", "x"
b _start
.org CONFIG_FLASH_HEADER_OFFSET
/* First IVT to copy the plugin that initializes the system into OCRAM */
ivt_header: .long 0x402000D1 /* Tag=0xD1, Len=0x0020, Ver=0x40 */
app_code_jump_v: .long 0xF8006458 /* Plugin entry point */
reserv1: .long 0x0
dcd_ptr: .long 0x0
boot_data_ptr: .long 0xF8006420
self_ptr: .long 0xF8006400
app_code_csf: .long 0x0 /* reserve 4K for csf */
reserv2: .long 0x0
boot_data: .long 0xF8006000
image_len: .long 4*1024 /* Can copy upto 72K, OCRAM free space */
plugin: .long 0x1 /* Enable plugin flag */
/* Second IVT to give entry point into the bootloader copied to DDR */
ivt2_header: .long 0x402000D1 //Tag=0xD1, Len=0x0020, Ver=0x40
app2_code_jump_v: .long _start // Entry point for the bootloader
reserv3: .long 0x0
dcd2_ptr: .long 0x0
boot_data2_ptr: .long boot_data2
self_ptr2: .long ivt2_header
app_code_csf2: .long 0x0 // reserve 4K for csf
reserv4: .long 0x0
boot_data2: .long TEXT_BASE
image_len2: .long _end - TEXT_BASE
plugin2: .long 0x0
/*=============================================================================
* Here starts the plugin code
*===========================================================================*/
plugin_start:
/* Save the return address and the function arguments */
push {r0-r6, r8, lr}
/* To return to ROM from plugin, we need to fill in these argument.
* Here is what need to do:
* Need to construct the paramters for this function before return to ROM:
* plugin_download(void **start, size_t *bytes, UINT32 *ivt_offset)
*/
/* Check r0 if valid address
* Mfgtools or sb_loader run-plug maybe pass down invalidate data
*/
cmp r0, #0xf8000000
mov r4, r0
ldr r3, DDR_DEST_ADDR
strhi r3, [r0]
ldr r3, COPY_SIZE
strhi r3, [r1]
ldr r3, IVT2_HDR_OFS
strhi r3, [r2]
/*=============================================================================
*init script for codex LPDDR1-200MHz CPU board
*===========================================================================*/
/* Setup PLL1 to be 800 MHz */
ldr r0, =CCM_BASE_ADDR
/* Switch ARM domain to be clocked from LP-APM */
mov r1, #0x4
str r1, [r0, #CLKCTL_CCSR]
ldr r0, =PLL1_BASE_ADDR
ldr r1, =0x1232
str r1, [r0, #PLL_DP_CTL] /* Set DPLL ON (set UPEN bit); BRMO=1 */
ldr r1, =0x2
str r1, [r0, #PLL_DP_CONFIG] /* Enable auto-restart AREN bit */
ldr r1, =DP_OP_800
str r1, [r0, #PLL_DP_OP]
str r1, [r0, #PLL_DP_HFS_OP]
ldr r1, =DP_MFD_800
str r1, [r0, #PLL_DP_MFD]
str r1, [r0, #PLL_DP_HFS_MFD]
ldr r1, =DP_MFN_800
str r1, [r0, #PLL_DP_MFN]
str r1, [r0, #PLL_DP_HFS_MFN]
/* Now restart PLL */
ldr r1, =0x1232
str r1, [r0, #PLL_DP_CTL]
wait_pll1_lock:
ldr r1, [r0, #PLL_DP_CTL]
ands r1, r1, #0x1
beq wait_pll1_lock
/* Switch ARM back to PLL1 */
ldr r0, =CCM_BASE_ADDR
ldr r1, =0x0
str r1, [r0,#CLKCTL_CCSR]
/*=============================================================================
* Enable all clocks (they are disabled by ROM code)
*===========================================================================*/
mov r1, #0xffffffff
str r1, [r0, #0x68]
str r1, [r0, #0x6c]
str r1, [r0, #0x70]
str r1, [r0, #0x74]
str r1, [r0, #0x78]
str r1, [r0, #0x7c]
str r1, [r0, #0x80]
str r1, [r0, #0x84]
#if defined(CONFIG_LPDDR2)
/* DDR clock setting -- Set DDR to be div 3 to get 266MHz */
/* setmem /32 0x53FD4098 = 0x80000003 */
ldr r1, =0x80000003
str r1, [r0, #0x98]
/* poll to make sure DDR dividers take effect */
1:
ldr r1, [r0, #0x8c]
ands r1, r1, #0x4
bne 1b
/*=============================================================================
* IOMUX
*===========================================================================*/
ldr r0, =0x53fa8600
mov r1, #0x04000000
ldr r3, =0x00180000
mov r2, #0x0
//setmem /32 0x53fa86ac = 0x04000000
//IOMUXC_SW_PAD_CTL_GRP_DDR_TYPE, ddr_sel=2'b01 (LPDDR2)
str r1, [r0, #0xac]
//setmem /32 0x53fa86a4 = 0x00180000
//IOMUXC_SW_PAD_CTL_GRP_CTLDS, dse=3'b100
str r3, [r0, #0xa4]
//setmem /32 0x53fa8668 = 0x00180000
//IOMUXC_SW_PAD_CTL_GRP_ADDDS, dse=3'b100
str r3, [r0, #0x68]
//setmem /32 0x53fa8698 = 0x00180000
//IOMUXC_SW_PAD_CTL_GRP_B0DS, dse=3'b100
str r3, [r0, #0x98]
//setmem /32 0x53fa86a0 = 0x00180000
//IOMUXC_SW_PAD_CTL_GRP_B1DS, dse=3'b100
str r3, [r0, #0xa0]
//setmem /32 0x53fa86a8 = 0x00180000
//IOMUXC_SW_PAD_CTL_GRP_B2DS, dse=3'b100
str r3, [r0, #0xa8]
//setmem /32 0x53fa86b4 = 0x00180000
//IOMUXC_SW_PAD_CTL_GRP_B3DS, dse=3'b100
str r3, [r0, #0xb4]
ldr r0, =0x53fa8400
//setmem /32 0x53fa8498 = 0x00180000
//IOMUXC_SW_PAD_CTL_PAD_DRAM_SDCLK_1
str r3, [r0, #0x98]
//setmem /32 0x53fa849c = 0x00180000
//IOMUXC_SW_PAD_CTL_PAD_DRAM_SDCLK_0
str r3, [r0, #0x9c]
//setmem /32 0x53fa84f0 = 0x00180000
//IOMUXC_SW_PAD_CTL_PAD_DRAM_DQM0, dse=3'b100
str r3, [r0, #0xf0]
//setmem /32 0x53fa8500 = 0x00180000
//IOMUXC_SW_PAD_CTL_PAD_DRAM_DQM1, dse=3'b100
str r3, [r0, #0x100]
//setmem /32 0x53fa84c8 = 0x00180000
//IOMUXC_SW_PAD_CTL_PAD_DRAM_DQM2, dse=3'b100
str r3, [r0, #0xc8]
//setmem /32 0x53fa8528 = 0x00180000
//IOMUXC_SW_PAD_CTL_PAD_DRAM_DQM3, dse=3'b100
str r3, [r0, #0x128]
//setmem /32 0x53fa84f4 = 0x00180000
//IOMUXC_SW_PAD_CTL_PAD_DRAM_SDQS0, dse=3'b100
str r3, [r0, #0xf4]
//setmem /32 0x53fa84fc = 0x00180000
//IOMUXC_SW_PAD_CTL_PAD_DRAM_SDQS1, dse=3'b100
str r3, [r0, #0xfc]
//setmem /32 0x53fa84cc = 0x00180000
//IOMUXC_SW_PAD_CTL_PAD_DRAM_SDQS2, dse=3'b100
str r3, [r0, #0xcc]
//setmem /32 0x53fa8524 = 0x00180000
//IOMUXC_SW_PAD_CTL_PAD_DRAM_SDQS3, dse=3'b100
str r3, [r0, #0x124]
//*===========================================
// DDR controller setting
//*===========================================
// CTL setting
ldr r0, =DATABAHN_BASE_ADDR
#if defined(CONFIG_ZQ_CALIB)
do_zq_calib
#else
// setmem /32 0x1400012C = 0x00000817 // pd=<<8, pu=<<0
ldr r1, =0x00000817
str r1, [r0, #0x12c]
// setmem /32 0x14000128 = 0x09180000 // (pd+1)<<24, (pu+1)<<16
ldr r1, =0x09180000
str r1, [r0, #0x128]
// load PU, pu_pd_sel=0
// setmem /32 0x14000124 = 0x00310000 // software load ZQ: 3<<20, 1<<16
ldr r1, =0x00310000
str r1, [r0, #0x124]
// setmem /32 0x14000124 = 0x00200000 // clear for next load
ldr r1, =0x00200000
str r1, [r0, #0x124]
// load PD, pu_pd_sel=1
// setmem /32 0x14000128 = 0x09180010 // (pd+1)<<24, (pu+1)<<16, 1<<4
ldr r1, =0x09180010
str r1, [r0, #0x128]
// setmem /32 0x14000124 = 0x00310000 // software load ZQ: 3<<20, 1<<16
ldr r1, =0x00310000
str r1, [r0, #0x124]
// setmem /32 0x14000124 = 0x00200000 // clear for next load
ldr r1, =0x00200000
str r1, [r0, #0x124]
#endif
#if defined(CONFIG_MX50_RDP)
/*===========================================================================
* DDR setting
*===========================================================================*/
//setmem /32 0x14000000 = 0x00000500
ldr r1, =0x00000500
str r1, [r0, #0x0]
//setmem /32 0x14000004 = 0x00000000
ldr r1, =0x00000000
str r1, [r0, #0x4]
//setmem /32 0x14000008 = 0x0000001b
ldr r1, =0x0000001b
str r1, [r0, #0x8]
//setmem /32 0x1400000c = 0x0000d056
ldr r1, =0x0000d056
str r1, [r0, #0xc]
//setmem /32 0x14000010 = 0x0000010b
ldr r1, =0x0000010b
str r1, [r0, #0x10]
//setmem /32 0x14000014 = 0x00000a6b
ldr r1, =0x00000a6b
str r1, [r0, #0x14]
//setmem /32 0x14000018 = 0x02030d0c
ldr r1, =0x02030d0c
str r1, [r0, #0x18]
//setmem /32 0x1400001c = 0x0c110304
ldr r1, =0x0c110304
str r1, [r0, #0x1c]
//setmem /32 0x14000020 = 0x05020503
ldr r1, =0x05020503
str r1, [r0, #0x20]
//setmem /32 0x14000024 = 0x0048D005
ldr r1, =0x0048D005
str r1, [r0, #0x24]
//setmem /32 0x14000028 = 0x01000403
ldr r1, =0x01000403
str r1, [r0, #0x28]
//setmem /32 0x1400002c = 0x09040501
ldr r1, =0x09040501
str r1, [r0, #0x2c]
//setmem /32 0x14000030 = 0x02000000
ldr r1, =0x02000000
str r1, [r0, #0x30]
//setmem /32 0x14000034 = 0x00000e02
ldr r1, =0x00000e02
str r1, [r0, #0x34]
//setmem /32 0x14000038 = 0x00000006
ldr r1, =0x00000006
str r1, [r0, #0x38]
//setmem /32 0x1400003c = 0x00002301
ldr r1, =0x00002301
str r1, [r0, #0x3c]
//setmem /32 0x14000040 = 0x00050300
ldr r1, =0x00050300
str r1, [r0, #0x40]
//setmem /32 0x14000044 = 0x00000300
ldr r1, =0x00000300
str r1, [r0, #0x44]
//setmem /32 0x14000048 = 0x00260026
ldr r1, =0x00260026
str r1, [r0, #0x48]
//setmem /32 0x1400004c = 0x00010000
ldr r1, =0x00010000
str r1, [r0, #0x4c]
//setmem /32 0x1400005c = 0x02000000
ldr r1, =0x02000000
str r1, [r0, #0x5c]
//setmem /32 0x14000060 = 0x00000002
ldr r1, =0x00000002
str r1, [r0, #0x60]
//setmem /32 0x14000064 = 0x00000000
ldr r1, =0x00000000
str r1, [r0, #0x64]
//setmem /32 0x14000068 = 0x00000000
ldr r1, =0x00000000
str r1, [r0, #0x68]
//setmem /32 0x1400006c = 0x00040042
ldr r1, =0x00040042
str r1, [r0, #0x6c]
//setmem /32 0x14000070 = 0x00000001
ldr r1, =0x00000001
str r1, [r0, #0x70]
//setmem /32 0x14000074 = 0x00000000
ldr r1, =0x00000000
str r1, [r0, #0x74]
//setmem /32 0x14000078 = 0x00040042
ldr r1, =0x00040042
str r1, [r0, #0x78]
//setmem /32 0x1400007c = 0x00000001
ldr r1, =0x00000001
str r1, [r0, #0x7c]
//setmem /32 0x14000080 = 0x010b0000
ldr r1, =0x010b0000
str r1, [r0, #0x80]
//setmem /32 0x14000084 = 0x00000060
ldr r1, =0x00000060
str r1, [r0, #0x84]
//setmem /32 0x14000088 = 0x02400018
ldr r1, =0x02400018
str r1, [r0, #0x88]
//setmem /32 0x1400008c = 0x01000e00
ldr r1, =0x01000e00
str r1, [r0, #0x8c]
//setmem /32 0x14000090 = 0x0a010101
ldr r1, =0x0a010101
str r1, [r0, #0x90]
//setmem /32 0x14000094 = 0x01011f1f
ldr r1, =0x01011f1f
str r1, [r0, #0x94]
//setmem /32 0x14000098 = 0x01010101
ldr r1, =0x01010101
str r1, [r0, #0x98]
//setmem /32 0x1400009c = 0x00030101
ldr r1, =0x00030101
str r1, [r0, #0x9c]
//setmem /32 0x140000a0 = 0x00010000
ldr r1, =0x00010000
str r1, [r0, #0xa0]
//setmem /32 0x140000a4 = 0x00010000
ldr r1, =0x00010000
str r1, [r0, #0xa4]
//setmem /32 0x140000a8 = 0x00000000
ldr r1, =0x00000000
str r1, [r0, #0xa8]
//setmem /32 0x140000ac = 0x0000ffff
ldr r1, =0x0000ffff
str r1, [r0, #0xac]
//setmem /32 0x140000c8 = 0x02020101
ldr r1, =0x02020101
str r1, [r0, #0xc8]
//setmem /32 0x140000cc = 0x01000000
ldr r1, =0x01000000
str r1, [r0, #0xcc]
//setmem /32 0x140000d0 = 0x01000201
ldr r1, =0x01000201
str r1, [r0, #0xd0]
//setmem /32 0x140000d4 = 0x00000200
ldr r1, =0x00000200
str r1, [r0, #0xd4]
//setmem /32 0x140000d8 = 0x00000102
ldr r1, =0x00000102
str r1, [r0, #0xd8]
//setmem /32 0x140000dc = 0x0000ffff
ldr r1, =0x0000ffff
str r1, [r0, #0xdc]
//setmem /32 0x140000e0 = 0x0000ffff
ldr r1, =0x0000ffff
str r1, [r0, #0xe0]
//setmem /32 0x140000e4 = 0x02020000
ldr r1, =0x02020000
str r1, [r0, #0xe4]
//setmem /32 0x140000e8 = 0x02020202
ldr r1, =0x02020202
str r1, [r0, #0xe8]
//setmem /32 0x140000ec = 0x00000202
ldr r1, =0x00000202
str r1, [r0, #0xec]
//setmem /32 0x140000f0 = 0x01010064
ldr r1, =0x01010064
str r1, [r0, #0xf0]
//setmem /32 0x140000f4 = 0x01010101
ldr r1, =0x01010101
str r1, [r0, #0xf4]
//setmem /32 0x140000f8 = 0x00010101
ldr r1, =0x00010101
str r1, [r0, #0xf8]
//setmem /32 0x140000fc = 0x00000064
ldr r1, =0x00000064
str r1, [r0, #0xfc]
//setmem /32 0x14000100 = 0x00000000
ldr r1, =0x00000000
str r1, [r0, #0x100]
//setmem /32 0x14000104 = 0x02000802
ldr r1, =0x02000802
str r1, [r0, #0x104]
//setmem /32 0x14000108 = 0x04080000
ldr r1, =0x04080000
str r1, [r0, #0x108]
//setmem /32 0x1400010c = 0x04080408
ldr r1, =0x04080408
str r1, [r0, #0x10c]
//setmem /32 0x14000110 = 0x04080408
ldr r1, =0x04080408
str r1, [r0, #0x110]
//setmem /32 0x14000114 = 0x03060408
ldr r1, =0x03060408
str r1, [r0, #0x114]
//setmem /32 0x14000118 = 0x01010002
ldr r1, =0x01010002
str r1, [r0, #0x118]
//setmem /32 0x1400011c = 0x00001000
ldr r1, =0x00001000
str r1, [r0, #0x11c]
// PHY setting
//setmem /32 0x14000200 = 0x00000000
ldr r1, =0x00000000
str r1, [r0, #0x200]
//setmem /32 0x14000204 = 0x00000000
ldr r1, =0x00000000
str r1, [r0, #0x204]
//setmem /32 0x14000208 = 0xf5003a27
ldr r1, =0xf5003a27
str r1, [r0, #0x208]
//setmem /32 0x14000210 = 0xf5003a27
ldr r1, =0xf5003a27
str r1, [r0, #0x210]
//setmem /32 0x14000218 = 0xf5003a27
ldr r1, =0xf5003a27
str r1, [r0, #0x218]
//setmem /32 0x14000220 = 0xf5003a27
ldr r1, =0xf5003a27
str r1, [r0, #0x220]
//setmem /32 0x14000228 = 0xf5003a27
ldr r1, =0xf5003a27
str r1, [r0, #0x228]
//setmem /32 0x1400020c = 0x074002e1
ldr r1, =0x074002e1
str r1, [r0, #0x20c]
//setmem /32 0x14000214 = 0x074002e1
ldr r1, =0x074002e1
str r1, [r0, #0x214]
//setmem /32 0x1400021c = 0x074002e1
ldr r1, =0x074002e1
str r1, [r0, #0x21c]
//setmem /32 0x14000224 = 0x074002e1
ldr r1, =0x074002e1
str r1, [r0, #0x224]
//setmem /32 0x1400022c = 0x074002e1
ldr r1, =0x074002e1
str r1, [r0, #0x22c]
//setmem /32 0x14000230 = 0x00000000
ldr r1, =0x00000000
str r1, [r0, #0x230]
//setmem /32 0x14000234 = 0x00810006
ldr r1, =0x00810006
str r1, [r0, #0x234]
//setmem /32 0x14000238 = 0x60099414
ldr r1, =0x60099414
str r1, [r0, #0x238]
//setmem /32 0x14000240 = 0x60099414
ldr r1, =0x60099414
str r1, [r0, #0x240]
//setmem /32 0x14000248 = 0x60099414
ldr r1, =0x60099414
str r1, [r0, #0x248]
//setmem /32 0x14000250 = 0x60099414
ldr r1, =0x60099414
str r1, [r0, #0x250]
//setmem /32 0x14000258 = 0x60099414
ldr r1, =0x60099414
str r1, [r0, #0x258]
//setmem /32 0x1400023c = 0x000a0b01
ldr r1, =0x000a0b01
str r1, [r0, #0x23c]
//setmem /32 0x14000244 = 0x000a0b01
ldr r1, =0x000a0b01
str r1, [r0, #0x244]
//setmem /32 0x1400024c = 0x000a0b01
ldr r1, =0x000a0b01
str r1, [r0, #0x24c]
//setmem /32 0x14000254 = 0x000a0b01
ldr r1, =0x000a0b01
str r1, [r0, #0x254]
//setmem /32 0x1400025c = 0x000a0b01
ldr r1, =0x000a0b01
str r1, [r0, #0x25c]
#elif defined(CONFIG_MX50_ARM2)
/*=============================================================================
* DDR setting
*===========================================================================*/
/* setmem /32 0x14000000 = 0x00000500 */
ldr r1, =0x00000500
str r1, [r0, #0x0]
/* setmem /32 0x14000004 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x4]
/* setmem /32 0x14000008 = 0x0000001b */
ldr r1, =0x0000001b
str r1, [r0, #0x8]
/* setmem /32 0x1400000c = 0x0000d056 */
ldr r1, =0x0000d056
str r1, [r0, #0xc]
/* setmem /32 0x14000010 = 0x0000010b */
ldr r1, =0x0000010b
str r1, [r0, #0x10]
/* setmem /32 0x14000014 = 0x00000a6b */
ldr r1, =0x00000a6b
str r1, [r0, #0x14]
/* setmem /32 0x14000018 = 0x02020d0c */
ldr r1, =0x02020d0c
str r1, [r0, #0x18]
/* setmem /32 0x1400001c = 0x0c110302 */
ldr r1, =0x0c110302
str r1, [r0, #0x1c]
/* setmem /32 0x14000020 = 0x05020503 */
ldr r1, =0x05020503
str r1, [r0, #0x20]
/* setmem /32 0x14000024 = 0x00000105 */
ldr r1, =0x00000105
str r1, [r0, #0x24]
/* setmem /32 0x14000028 = 0x01000403 */
ldr r1, =0x01000403
str r1, [r0, #0x28]
/* setmem /32 0x1400002c = 0x09040501 */
ldr r1, =0x09040501
str r1, [r0, #0x2c]
/* setmem /32 0x14000030 = 0x02000000 */
ldr r1, =0x02000000
str r1, [r0, #0x30]
/* setmem /32 0x14000034 = 0x00000e02 */
ldr r1, =0x00000e02
str r1, [r0, #0x34]
/* setmem /32 0x14000038 = 0x00000006 */
ldr r1, =0x00000006
str r1, [r0, #0x38]
/* setmem /32 0x1400003c = 0x00002301 */
ldr r1, =0x00002301
str r1, [r0, #0x3c]
/* setmem /32 0x14000040 = 0x00050300 */
ldr r1, =0x00050300
str r1, [r0, #0x40]
/* setmem /32 0x14000044 = 0x00000300 */
ldr r1, =0x00000300
str r1, [r0, #0x44]
/* setmem /32 0x14000048 = 0x00260026 */
ldr r1, =0x00260026
str r1, [r0, #0x48]
/* setmem /32 0x1400004c = 0x00010000 */
ldr r1, =0x00010000
str r1, [r0, #0x4c]
/* setmem /32 0x1400005c = 0x02000000 */
ldr r1, =0x02000000
str r1, [r0, #0x5c]
/* setmem /32 0x14000060 = 0x00000002 */
ldr r1, =0x00000002
str r1, [r0, #0x60]
/* setmem /32 0x14000064 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x64]
/* setmem /32 0x14000068 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x68]
/* setmem /32 0x1400006c = 0x00040042 */
ldr r1, =0x00040042
str r1, [r0, #0x6c]
/* setmem /32 0x14000070 = 0x00000001 */
ldr r1, =0x00000001
str r1, [r0, #0x70]
/* setmem /32 0x14000074 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x74]
/* setmem /32 0x14000078 = 0x00040042 */
ldr r1, =0x00040042
str r1, [r0, #0x78]
/* setmem /32 0x1400007c = 0x00000001 */
ldr r1, =0x00000001
str r1, [r0, #0x7c]
/* setmem /32 0x14000080 = 0x010b0000 */
ldr r1, =0x010b0000
str r1, [r0, #0x80]
/* setmem /32 0x14000084 = 0x00000060 */
ldr r1, =0x00000060
str r1, [r0, #0x84]
/* setmem /32 0x14000088 = 0x02400018 */
ldr r1, =0x02400018
str r1, [r0, #0x88]
/* setmem /32 0x1400008c = 0x01000e00 */
ldr r1, =0x01000e00
str r1, [r0, #0x8c]
/* setmem /32 0x14000090 = 0x0a010101 */
ldr r1, =0x0a010101
str r1, [r0, #0x90]
/* setmem /32 0x14000094 = 0x01011f1f */
ldr r1, =0x01011f1f
str r1, [r0, #0x94]
/* setmem /32 0x14000098 = 0x01010101 */
ldr r1, =0x01010101
str r1, [r0, #0x98]
/* setmem /32 0x1400009c = 0x00030101 */
ldr r1, =0x00030101
str r1, [r0, #0x9c]
/* setmem /32 0x140000a0 = 0x00010000 */
ldr r1, =0x00010000
str r1, [r0, #0xa0]
/* setmem /32 0x140000a4 = 0x00010000 */
ldr r1, =0x00010000
str r1, [r0, #0xa4]
/* setmem /32 0x140000a8 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0xa8]
/* setmem /32 0x140000ac = 0x0000ffff */
ldr r1, =0x0000ffff
str r1, [r0, #0xac]
/* setmem /32 0x140000c8 = 0x02020101 */
ldr r1, =0x02020101
str r1, [r0, #0xc8]
/* setmem /32 0x140000cc = 0x01000000 */
ldr r1, =0x01000000
str r1, [r0, #0xcc]
/* setmem /32 0x140000d0 = 0x06060606 */
ldr r1, =0x06060606
str r1, [r0, #0xd0]
/* setmem /32 0x140000d4 = 0x06060606 */
ldr r1, =0x06060606
str r1, [r0, #0xd4]
/* setmem /32 0x140000d8 = 0x00000102 */
ldr r1, =0x00000102
str r1, [r0, #0xd8]
/* setmem /32 0x140000dc = 0x0000ffff */
ldr r1, =0x0000ffff
str r1, [r0, #0xdc]
/* setmem /32 0x140000e0 = 0x0000ffff */
ldr r1, =0x0000ffff
str r1, [r0, #0xdc]
/* setmem /32 0x140000e4 = 0x02020000 */
ldr r1, =0x02020000
str r1, [r0, #0xe4]
/* setmem /32 0x140000e8 = 0x02020202 */
ldr r1, =0x02020202
str r1, [r0, #0xe8]
/* setmem /32 0x140000ec = 0x00000202 */
ldr r1, =0x00000202
str r1, [r0, #0xec]
/* setmem /32 0x140000f0 = 0x01010064 */
ldr r1, =0x01010064
str r1, [r0, #0xf0]
/* setmem /32 0x140000f4 = 0x01010101 */
ldr r1, =0x01010101
str r1, [r0, #0xf4]
/* setmem /32 0x140000f8 = 0x00010101 */
ldr r1, =0x00010101
str r1, [r0, #0xf8]
/* setmem /32 0x140000fc = 0x00000064 */
ldr r1, =0x00000064
str r1, [r0, #0xfc]
/* setmem /32 0x14000100 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x100]
/* setmem /32 0x14000104 = 0x02000802 */
ldr r1, =0x02000802
str r1, [r0, #0x104]
/* setmem /32 0x14000108 = 0x04080000 */
ldr r1, =0x04080000
str r1, [r0, #0x108]
/* setmem /32 0x1400010c = 0x04080408 */
ldr r1, =0x04080408
str r1, [r0, #0x10c]
/* setmem /32 0x14000110 = 0x04080408 */
ldr r1, =0x04080408
str r1, [r0, #0x110]
/* setmem /32 0x14000114 = 0x03060408 */
ldr r1, =0x03060408
str r1, [r0, #0x114]
/* setmem /32 0x14000118 = 0x01010002 */
ldr r1, =0x01010002
str r1, [r0, #0x118]
/* setmem /32 0x1400011c = 0x00001000 */
ldr r1, =0x00001000
str r1, [r0, #0x11c]
/* setmem /32 0x14000200 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x200]
/* setmem /32 0x14000204 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x204]
/* setmem /32 0x14000208 = 0xf5003a27 */
ldr r1, =0xf5003a27
str r1, [r0, #0x208]
/* setmem /32 0x14000210 = 0xf5003a27 */
str r1, [r0, #0x210]
/* setmem /32 0x14000218 = 0xf5003a27 */
str r1, [r0, #0x218]
/* setmem /32 0x14000220 = 0xf5003a27 */
str r1, [r0, #0x220]
/* setmem /32 0x14000228 = 0xf5003a27 */
str r1, [r0, #0x228]
/* setmem /32 0x1400020c = 0x074002e1 */
ldr r1, =0x074002e1
str r1, [r0, #0x20c]
/* setmem /32 0x14000214 = 0x074002e1 */
str r1, [r0, #0x214]
/* setmem /32 0x1400021c = 0x074002e1 */
str r1, [r0, #0x21c]
/* setmem /32 0x14000224 = 0x074002e1 */
str r1, [r0, #0x224]
/* setmem /32 0x1400022c = 0x074002e1 */
str r1, [r0, #0x22c]
/* setmem /32 0x14000230 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x230]
/* setmem /32 0x14000234 = 0x00810006 */
ldr r1, =0x00810006
str r1, [r0, #0x234]
/* setmem /32 0x14000238 = 0x20099414 */
ldr r1, =0x20099414
str r1, [r0, #0x238]
/* setmem /32 0x14000240 = 0x20099414 */
str r1, [r0, #0x240]
/* setmem /32 0x14000248 = 0x20099414 */
str r1, [r0, #0x248]
/* setmem /32 0x14000250 = 0x20099414 */
str r1, [r0, #0x250]
/* setmem /32 0x14000258 = 0x20099414 */
str r1, [r0, #0x258]
/* setmem /32 0x1400023c = 0x000a0b01 */
ldr r1, =0x000a0b01
str r1, [r0, #0x23c]
/* setmem /32 0x14000244 = 0x000a0b01 */
str r1, [r0, #0x244]
/* setmem /32 0x1400024c = 0x000a0b01 */
str r1, [r0, #0x24c]
/* setmem /32 0x14000254 = 0x000a0b01 */
str r1, [r0, #0x254]
/* setmem /32 0x1400025c = 0x000a0b01 */
str r1, [r0, #0x25c]
#else
# error "Unsupported board!"
#endif
/* Start ddr */
/* setmem /32 0x14000000 = 0x00000501 // bit[0]: start */
ldr r1, =0x00000501
str r1, [r0, #0x0]
/* poll to make sure it is done */
1:
ldr r1, [r0, #0xa8]
ands r1, r1, #0x10
beq 1b
#elif defined(CONFIG_DDR2)
/* DDR clock setting -- Set DDR to be div 3 to get 266MHz */
ldr r0, =CCM_BASE_ADDR
ldr r1, =0xA0000043
str r1, [r0, #0x94]
/* DDR clock from PLL1 */
ldr r1, =0x00000803
str r1, [r0, #0x90]
/* ---------- IOMUX SETUP ---------- */
/* 0x53fa86ac = 0x02000000 IOMUXC_SW_PAD_CTL_GRP_DDR_TYPE, ddr_sel=2'b01*/
ldr r0, =0x53fa8600
mov r1, #0x02000000
mov r3, #0x00200000
mov r2, #0x0
str r1, [r0, #0xac]
/* These DSE values seem to make thing work */
/* 0x53fa86a4 = 0x00200000 IOMUXC_SW_PAD_CTL_GRP_CTLDS, dse=3'b100*/
str r3, [r0, #0xa4]
/* 0x53fa8668 = 0x00200000 IOMUXC_SW_PAD_CTL_GRP_ADDDS, dse=3'b100*/
str r3, [r0, #0x68]
/* 0x53fa8698 = 0x00200000 IOMUXC_SW_PAD_CTL_GRP_B0DS, dse=3'b100*/
str r3, [r0, #0x98]
/* 0x53fa86a0 = 0x00200000 IOMUXC_SW_PAD_CTL_GRP_B1DS, dse=3'b100*/
str r3, [r0, #0xa0]
/* 0x53fa86a8 = 0x00200000 IOMUXC_SW_PAD_CTL_GRP_B2DS, dse=3'b100*/
str r3, [r0, #0xa8]
/* 0x53fa86b4 = 0x00200000 IOMUXC_SW_PAD_CTL_GRP_B3DS, dse=3'b100*/
str r3, [r0, #0xb4]
/* 0x53fa8498 = 0x00200000 IOMUXC_SW_PAD_CTL_PAD_DRAM_SDCLK_1 */
ldr r0, =0x53fa8400
str r3, [r0, #0x98]
/* 0x53fa849c = 0x00200000 IOMUXC_SW_PAD_CTL_PAD_DRAM_SDCLK_0 */
str r3, [r0, #0x9c]
/* 0x53fa84f0 = 0x00200000 IOMUXC_SW_PAD_CTL_PAD_DRAM_DQM0, dse=3'b100*/
str r3, [r0, #0xf0]
/* 0x53fa8500 = 0x00200000 IOMUXC_SW_PAD_CTL_PAD_DRAM_DQM1, dse=3'b100*/
ldr r0, =0x53fa8500
str r3, [r0, #0x00]
/* 0x53fa84c8 = 0x00200000 IOMUXC_SW_PAD_CTL_PAD_DRAM_DQM2, dse=3'b100*/
ldr r0, =0x53fa8400
str r3, [r0, #0xc8]
/* 0x53fa8528 = 0x00200000 IOMUXC_SW_PAD_CTL_PAD_DRAM_DQM3, dse=3'b100*/
ldr r0, =0x53fa8500
str r3, [r0, #0x28]
/* 0x53fa84f4 = 0x00200080
IOMUXC_SW_PAD_CTL_PAD_DRAM_SDQS0, dse=3'b100 , pke=1, pue=1
*/
ldr r0, =0x53fa8400
orr r3, r3,#0x00000080
str r3, [r0, #0xf4]
/* 0x53fa84fc = 0x00200080
IOMUXC_SW_PAD_CTL_PAD_DRAM_SDQS1, dse=3'b100 , pke=1, pue=1
*/
str r3, [r0, #0xfc]
/* 0x53fa84cc = 0x00200080
IOMUXC_SW_PAD_CTL_PAD_DRAM_SDQS2, dse=3'b100 , pke=1, pue=1
*/
str r3, [r0, #0xcc]
ldr r0, =0x53fa8500
/* 0x53fa8524 = 0x00200080
IOMUXC_SW_PAD_CTL_PAD_DRAM_SDQS3, dse=3'b100 , pke=1, pue=1
*/
str r3, [r0, #0x24]
/* ---------- DDR SETUP ---------- */
//*===========================================
// DDR controller setting
//*===========================================
// CTL setting
ldr r0, =DATABAHN_BASE_ADDR
#if defined(CONFIG_ZQ_CALIB)
do_zq_calib
#else
// setmem /32 0x1400012C = 0x00000817 // pd=<<8, pu=<<0
ldr r1, =0x00000817
str r1, [r0, #0x12c]
// setmem /32 0x14000128 = 0x09180000 // (pd+1)<<24, (pu+1)<<16
ldr r1, =0x09180000
str r1, [r0, #0x128]
// load PU, pu_pd_sel=0
// setmem /32 0x14000124 = 0x00310000 // software load ZQ: 3<<20, 1<<16
ldr r1, =0x00310000
str r1, [r0, #0x124]
// setmem /32 0x14000124 = 0x00200000 // clear for next load
ldr r1, =0x00200000
str r1, [r0, #0x124]
// load PD, pu_pd_sel=1
// setmem /32 0x14000128 = 0x09180010 // (pd+1)<<24, (pu+1)<<16, 1<<4
ldr r1, =0x09180010
str r1, [r0, #0x128]
// setmem /32 0x14000124 = 0x00310000 // software load ZQ: 3<<20, 1<<16
ldr r1, =0x00310000
str r1, [r0, #0x124]
// setmem /32 0x14000124 = 0x00200000 // clear for next load
ldr r1, =0x00200000
str r1, [r0, #0x124]
#endif
/* CTL setting */
/* setmem /32 0x14000000 = 0x00000400 */
ldr r1, =0x00000400
str r1, [r0, #0x0]
/* setmem /32 0x14000004 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x4]
/* setmem /32 0x14000008 = 0x0000d056 */
ldr r1, =0x0000d056
str r1, [r0, #0x8]
/* setmem /32 0x1400000c = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0xc]
/* setmem /32 0x14000010 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x10]
/* setmem /32 0x14000014 = 0x02000000 */
ldr r1, =0x02000000
str r1, [r0, #0x14]
/* setmem /32 0x14000018 = 0x02030808 */
ldr r1, =0x02030808
str r1, [r0, #0x18]
/* setmem /32 0x1400001c = 0x0c100302 */
ldr r1, =0x0c100302
str r1, [r0, #0x1c]
/* setmem /32 0x14000020 = 0x02020402 */
ldr r1, =0x02020402
str r1, [r0, #0x20]
/* setmem /32 0x14000024 = 0x0048eb04 */
ldr r1, =0x0048eb04
str r1, [r0, #0x24]
/* setmem /32 0x14000028 = 0x01000303 */
ldr r1, =0x01000303
str r1, [r0, #0x28]
/* setmem /32 0x1400002c = 0x08040401 */
ldr r1, =0x08040401
str r1, [r0, #0x2c]
/* setmem /32 0x14000030 = 0x000000c8 */
ldr r1, =0x000000c8
str r1, [r0, #0x30]
/* setmem /32 0x14000034 = 0x006b0c02 */
ldr r1, =0x006b0c02
str r1, [r0, #0x34]
/* setmem /32 0x14000038 = 0x00000005 */
ldr r1, =0x00000005
str r1, [r0, #0x38]
/* setmem /32 0x1400003c = 0x00003401 */
ldr r1, =0x00003401
str r1, [r0, #0x3c]
/* setmem /32 0x14000040 = 0x0005081b */
ldr r1, =0x0005081b
str r1, [r0, #0x40]
/* setmem /32 0x14000044 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x44]
/* setmem /32 0x14000048 = 0x003700c8 */
ldr r1, =0x003700c8
str r1, [r0, #0x48]
/* setmem /32 0x1400004c = 0x00010000 */
ldr r1, =0x00010000
str r1, [r0, #0x4c]
/* setmem /32 0x14000050 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x50]
/* setmem /32 0x14000054 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x54]
/* setmem /32 0x14000058 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x58]
/* setmem /32 0x1400005c = 0x03000000 */
ldr r1, =0x03000000
str r1, [r0, #0x5c]
/* setmem /32 0x14000060 = 0x00000003 */
ldr r1, =0x00000003
str r1, [r0, #0x60]
/* setmem /32 0x14000064 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x64]
/* setmem /32 0x14000068 = 0x06420000 */
ldr r1, =0x06420000
str r1, [r0, #0x68]
/* setmem /32 0x1400006c = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x6c]
/* setmem /32 0x14000070 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x70]
/* setmem /32 0x14000074 = 0x06420000 */
ldr r1, =0x06420000
str r1, [r0, #0x74]
/* setmem /32 0x14000078 = 0x00000004 */
ldr r1, =0x00000004
str r1, [r0, #0x78]
/* setmem /32 0x1400007c = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x7c]
/* setmem /32 0x14000080 = 0x02000000 */
ldr r1, =0x02000000
str r1, [r0, #0x80]
/* setmem /32 0x14000084 = 0x00000100 */
ldr r1, =0x00000100
str r1, [r0, #0x84]
/* setmem /32 0x14000088 = 0x02400040 */
ldr r1, =0x02400040
str r1, [r0, #0x88]
/* setmem /32 0x1400008c = 0x01000000 */
ldr r1, =0x01000000
str r1, [r0, #0x8c]
/* setmem /32 0x14000090 = 0x0a000101 */
ldr r1, =0x0a000101
str r1, [r0, #0x90]
/* setmem /32 0x14000094 = 0x01011f1f */
ldr r1, =0x01011f1f
str r1, [r0, #0x94]
/* setmem /32 0x14000098 = 0x01010101 */
ldr r1, =0x01010101
str r1, [r0, #0x98]
/* setmem /32 0x1400009c = 0x00030103 */
ldr r1, =0x00030103
str r1, [r0, #0x9c]
/* setmem /32 0x140000a0 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0xa0]
/* setmem /32 0x140000a4 = 0x00010000 */
ldr r1, =0x00010000
str r1, [r0, #0xa4]
/* setmem /32 0x140000a8 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0xa8]
/* setmem /32 0x140000ac = 0x0000ffff */
ldr r1, =0x0000ffff
str r1, [r0, #0xac]
/* setmem /32 0x140000b0 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0xb0]
/* setmem /32 0x140000b4 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0xb4]
/* setmem /32 0x140000b8 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0xb8]
/* setmem /32 0x140000bc = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0xbc]
/* setmem /32 0x140000c0 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0xc0]
/* setmem /32 0x140000c4 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0xc4]
/* setmem /32 0x140000c8 = 0x02020101 */
ldr r1, =0x02020101
str r1, [r0, #0xc8]
/* setmem /32 0x140000cc = 0x01000000 */
ldr r1, =0x01000000
str r1, [r0, #0xcc]
/* setmem /32 0x140000d0 = 0x01010201 */
ldr r1, =0x01010201
str r1, [r0, #0xd0]
/* setmem /32 0x140000d4 = 0x00000200 */
ldr r1, =0x00000200
str r1, [r0, #0xd4]
/* setmem /32 0x140000d8 = 0x00000101 */
ldr r1, =0x00000101
str r1, [r0, #0xd8]
/* setmem /32 0x140000dc = 0x0003ffff */
ldr r1, =0x0003ffff
str r1, [r0, #0xdc]
/* setmem /32 0x140000e0 = 0x0000ffff */
ldr r1, =0x0000ffff
str r1, [r0, #0xe0]
/* setmem /32 0x140000e4 = 0x02020000 */
ldr r1, =0x02020000
str r1, [r0, #0xe4]
/* setmem /32 0x140000e8 = 0x02020202 */
ldr r1, =0x02020202
str r1, [r0, #0xe8]
/* setmem /32 0x140000ec = 0x00000202 */
ldr r1, =0x00000202
str r1, [r0, #0xec]
/* setmem /32 0x140000f0 = 0x01010064 */
ldr r1, =0x01010064
str r1, [r0, #0xf0]
/* setmem /32 0x140000f4 = 0x01010101 */
ldr r1, =0x01010101
str r1, [r0, #0xf4]
/* setmem /32 0x140000f8 = 0x00010101 */
ldr r1, =0x00010101
str r1, [r0, #0xf8]
/* setmem /32 0x140000fc = 0x00000064 */
ldr r1, =0x00000064
str r1, [r0, #0xfc]
/* setmem /32 0x14000100 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x100]
/* setmem /32 0x14000104 = 0x02000702 */
ldr r1, =0x02000702
str r1, [r0, #0x104]
/* setmem /32 0x14000108 = 0x081b0000 */
ldr r1, =0x081b0000
str r1, [r0, #0x108]
/* setmem /32 0x1400010c = 0x081b081b */
ldr r1, =0x081b081b
str r1, [r0, #0x10c]
/* setmem /32 0x14000110 = 0x081b081b */
ldr r1, =0x081b081b
str r1, [r0, #0x110]
/* setmem /32 0x14000114 = 0x0304081b */
ldr r1, =0x0304081b
str r1, [r0, #0x114]
/* setmem /32 0x14000118 = 0x01010002 */
ldr r1, =0x01010002
str r1, [r0, #0x118]
/* setmem /32 0x1400011c = 0x00001000 */
ldr r1, =0x00001000
str r1, [r0, #0x11c]
/* setmem /32 0x14000120 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x120]
/* setmem /32 0x14000124 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x124]
/* setmem /32 0x14000128 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x128]
/* setmem /32 0x1400012c = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x12c]
/* setmem /32 0x14000130 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x130]
/* setmem /32 0x14000134 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x134]
/* setmem /32 0x14000138 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x138]
/* setmem /32 0x1400013c = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x13c]
/* setmem /32 0x14000140 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x140]
/* setmem /32 0x14000144 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x144]
/* setmem /32 0x14000148 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x148]
/* setmem /32 0x1400014c = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x14c]
/* setmem /32 0x14000150 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x150]
/* setmem /32 0x14000154 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x154]
/* setmem /32 0x14000158 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x158]
/* PHY setting */
/* setmem /32 0x14000200 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x200]
/* setmem /32 0x14000204 = 0x000f1100 */
ldr r1, =0x000f1100
str r1, [r0, #0x204]
/* setmem /32 0x14000208 = 0xf4013a27 */
ldr r1, =0xf4013a27
str r1, [r0, #0x208]
/* setmem /32 0x1400020c = 0x26c002c0 */
ldr r1, =0x26c002c0
str r1, [r0, #0x20c]
/* setmem /32 0x14000210 = 0xf4013a27 */
ldr r1, =0xf4013a27
str r1, [r0, #0x210]
/* setmem /32 0x14000214 = 0x26c002c0 */
ldr r1, =0x26c002c0
str r1, [r0, #0x214]
/* setmem /32 0x14000218 = 0xf4013a27 */
ldr r1, =0xf4013a27
str r1, [r0, #0x218]
/* setmem /32 0x1400021c = 0x26c002c0 */
ldr r1, =0x26c002c0
str r1, [r0, #0x21c]
/* setmem /32 0x14000220 = 0xf4013a27 */
ldr r1, =0xf4013a27
str r1, [r0, #0x220]
/* setmem /32 0x14000224 = 0x26c002c0 */
ldr r1, =0x26c002c0
str r1, [r0, #0x224]
/* setmem /32 0x14000228 = 0xf4013a27 */
ldr r1, =0xf4013a27
str r1, [r0, #0x228]
/* setmem /32 0x1400022c = 0x26c002c0 */
ldr r1, =0x26c002c0
str r1, [r0, #0x22c]
/* setmem /32 0x14000230 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x230]
/* setmem /32 0x14000234 = 0x00000005 */
ldr r1, =0x00000005
str r1, [r0, #0x234]
/* setmem /32 0x14000238 = 0x20099d14 */
ldr r1, =0x20099d14
str r1, [r0, #0x238]
/* setmem /32 0x1400023c = 0x000a1f01 */
ldr r1, =0x000a1f01
str r1, [r0, #0x23c]
/* setmem /32 0x14000240 = 0x20099d14 */
ldr r1, =0x20099d14
str r1, [r0, #0x240]
/* setmem /32 0x14000244 = 0x000a1f01 */
ldr r1, =0x000a1f01
str r1, [r0, #0x244]
/* setmem /32 0x14000248 = 0x20099d14 */
ldr r1, =0x20099d14
str r1, [r0, #0x248]
/* setmem /32 0x1400024c = 0x000a1f01 */
ldr r1, =0x000a1f01
str r1, [r0, #0x24c]
/* setmem /32 0x14000250 = 0x20099d14 */
ldr r1, =0x20099d14
str r1, [r0, #0x250]
/* setmem /32 0x14000254 = 0x000a1f01 */
ldr r1, =0x000a1f01
str r1, [r0, #0x254]
/* setmem /32 0x14000258 = 0x20099d14 */
ldr r1, =0x20099d14
str r1, [r0, #0x258]
/* setmem /32 0x1400025c = 0x000a1f01 */
ldr r1, =0x000a1f01
str r1, [r0, #0x25c]
/* Start ddr */
/* setmem /32 0x14000000 = 0x00000401 // bit[0]: start */
ldr r1, =0x00000401
str r1, [r0, #0x0]
/* poll to make sure it is done */
1:
ldr r1, [r0, #0xa8]
ands r1, r1, #0x10
beq 1b
#else
/*==================================================================
* lpddr1-mddr
*=================================================================*/
/* DDR clock setting -- Set DDR to be div 4 to get 200MHz */
/* setmem /32 0x53FD4098 = 0x80000004 */
ldr r1, =0x80000004
str r1, [r0, #0x98]
/* poll to make sure DDR dividers take effect */
1:
ldr r1, [r0, #0x8c]
ands r1, r1, #0x4
bne 1b
/*==================================================================
* IOMUX
*=================================================================*/
ldr r0, =0x53fa8600
mov r1, #0x00000000
mov r3, #0x00380000
mov r2, #0x0
str r1, [r0, #0xac]
str r2, [r0, #0x6c]
str r2, [r0, #0x8c]
str r2, [r0, #0x70]
str r3, [r0, #0xa4]
str r3, [r0, #0x68]
str r3, [r0, #0x98]
str r3, [r0, #0xa0]
str r3, [r0, #0xa8]
str r3, [r0, #0xb4]
ldr r0, =0x53fa8400
str r3, [r0, #0x98]
str r3, [r0, #0x9c]
str r3, [r0, #0xf0]
str r3, [r0, #0x100]
str r3, [r0, #0xc8]
str r3, [r0, #0x128]
str r3, [r0, #0xf4]
str r3, [r0, #0xfc]
str r3, [r0, #0xcc]
str r3, [r0, #0x124]
//*===========================================
// DDR controller setting
//*===========================================
// CTL setting
ldr r0, =DATABAHN_BASE_ADDR
#if defined(CONFIG_ZQ_CALIB)
do_zq_calib
#else
// setmem /32 0x1400012C = 0x00000817 // pd=<<8, pu=<<0
ldr r1, =0x00000817
str r1, [r0, #0x12c]
// setmem /32 0x14000128 = 0x09180000 // (pd+1)<<24, (pu+1)<<16
ldr r1, =0x09180000
str r1, [r0, #0x128]
// load PU, pu_pd_sel=0
// setmem /32 0x14000124 = 0x00310000 // software load ZQ: 3<<20, 1<<16
ldr r1, =0x00310000
str r1, [r0, #0x124]
// setmem /32 0x14000124 = 0x00200000 // clear for next load
ldr r1, =0x00200000
str r1, [r0, #0x124]
// load PD, pu_pd_sel=1
// setmem /32 0x14000128 = 0x09180010 // (pd+1)<<24, (pu+1)<<16, 1<<4
ldr r1, =0x09180010
str r1, [r0, #0x128]
// setmem /32 0x14000124 = 0x00310000 // software load ZQ: 3<<20, 1<<16
ldr r1, =0x00310000
str r1, [r0, #0x124]
// setmem /32 0x14000124 = 0x00200000 // clear for next load
ldr r1, =0x00200000
str r1, [r0, #0x124]
#endif
/*==============================================================
* DDR setting
*=============================================================*/
/* setmem /32 0x14000000 = 0x00000100 */
ldr r1, =0x00000100
str r1, [r0, #0x0]
/* setmem /32 0x14000008 = 0x00009c40 */
ldr r1, =0x00009c40
str r1, [r0, #0x8]
/* setmem /32 0x14000014 = 0x02000000 */
ldr r1, =0x02000000
str r1, [r0, #0x14]
/* setmem /32 0x14000018 = 0x01010706 */
ldr r1, =0x01010706
str r1, [r0, #0x018]
/* setmem /32 0x1400001c = 0x080b0201 */
ldr r1, =0x080b0201
str r1, [r0, #0x01c]
/* setmem /32 0x14000020 = 0x02000303 */
ldr r1, =0x02000303
str r1, [r0, #0x020]
/* setmem /32 0x14000024 = 0x0136b002 */
ldr r1, =0x0136b002
str r1, [r0, #0x024]
/* setmem /32 0x14000028 = 0x01000101 */
ldr r1, =0x01000101
str r1, [r0, #0x028]
/* setmem /32 0x1400002c = 0x06030301 */
ldr r1, =0x06030301
str r1, [r0, #0x02c]
/* setmem /32 0x14000030 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x030]
/* setmem /32 0x14000034 = 0x00000a02 */
ldr r1, =0x00000a02
str r1, [r0, #0x034]
/* setmem /32 0x14000038 = 0x00000003 */
ldr r1, =0x00000003
str r1, [r0, #0x038]
/* setmem /32 0x1400003c = 0x00001401 */
ldr r1, =0x00001401
str r1, [r0, #0x03c]
/* setmem /32 0x14000040 = 0x0005030f */
ldr r1, =0x0005030f
str r1, [r0, #0x040]
/* setmem /32 0x14000044 = 0x00000200 */
ldr r1, =0x00000200
str r1, [r0, #0x044]
/* setmem /32 0x14000048 = 0x00180018 */
ldr r1, =0x00180018
str r1, [r0, #0x048]
/* setmem /32 0x1400004c = 0x00010000 */
ldr r1, =0x00010000
str r1, [r0, #0x04c]
/* setmem /32 0x1400005c = 0x01000000 */
ldr r1, =0x01000000
str r1, [r0, #0x05c]
/* setmem /32 0x14000060 = 0x00000001 */
ldr r1, =0x00000001
str r1, [r0, #0x060]
/* setmem /32 0x14000064 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x064]
/* setmem /32 0x14000068 = 0x00320000 */
ldr r1, =0x00320000
str r1, [r0, #0x068]
/* setmem /32 0x1400006c = 0x00800000 */
ldr r1, =0x00800000
str r1, [r0, #0x06c]
/* setmem /32 0x14000070 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x070]
/* setmem /32 0x14000074 = 0x00320000 */
ldr r1, =0x00320000
str r1, [r0, #0x074]
/* setmem /32 0x14000080 = 0x02000000 */
ldr r1, =0x02000000
str r1, [r0, #0x080]
/* setmem /32 0x14000084 = 0x00000100 */
ldr r1, =0x00000100
str r1, [r0, #0x084]
/* setmem /32 0x14000088 = 0x02400040 */
ldr r1, =0x02400040
str r1, [r0, #0x088]
/* setmem /32 0x1400008c = 0x01000000 */
ldr r1, =0x01000000
str r1, [r0, #0x08c]
/* setmem /32 0x14000090 = 0x0a000100 */
ldr r1, =0x0a000100
str r1, [r0, #0x090]
/* setmem /32 0x14000094 = 0x01011f1f */
ldr r1, =0x01011f1f
str r1, [r0, #0x094]
/* setmem /32 0x14000098 = 0x01010101 */
ldr r1, =0x01010101
str r1, [r0, #0x098]
/* setmem /32 0x1400009c = 0x00030101 */
ldr r1, =0x00030101
str r1, [r0, #0x09c]
/* setmem /32 0x140000a4 = 0x00010000 */
ldr r1, =0x00010000
str r1, [r0, #0x0a4]
/* setmem /32 0x140000ac = 0x0000ffff */
ldr r1, =0x0000ffff
str r1, [r0, #0x0ac]
/* setmem /32 0x140000c8 = 0x02020101 */
ldr r1, =0x02020101
str r1, [r0, #0x0c8]
/* setmem /32 0x140000cc = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x0cc]
/* setmem /32 0x140000d0 = 0x01000202 */
ldr r1, =0x01000202
str r1, [r0, #0x0d0]
/* setmem /32 0x140000d4 = 0x02030302 */
ldr r1, =0x02030302
str r1, [r0, #0x0d4]
/* setmem /32 0x140000d8 = 0x00000001 */
ldr r1, =0x00000001
str r1, [r0, #0x0d8]
/* setmem /32 0x140000dc = 0x0000ffff */
ldr r1, =0x0000ffff
str r1, [r0, #0x0dc]
/* setmem /32 0x140000e0 = 0x0000ffff */
ldr r1, =0x0000ffff
str r1, [r0, #0x0e0]
/* setmem /32 0x140000e4 = 0x02020000 */
ldr r1, =0x02020000
str r1, [r0, #0x0e4]
/* setmem /32 0x140000e8 = 0x02020202 */
ldr r1, =0x02020202
str r1, [r0, #0x0e8]
/* setmem /32 0x140000ec = 0x00000202 */
ldr r1, =0x00000202
str r1, [r0, #0x0ec]
/* setmem /32 0x140000f0 = 0x01010064 */
ldr r1, =0x01010064
str r1, [r0, #0x0f0]
/* setmem /32 0x140000f4 = 0x01010101 */
ldr r1, =0x01010101
str r1, [r0, #0x0f4]
/* setmem /32 0x140000f8 = 0x00010101 */
ldr r1, =0x00010101
str r1, [r0, #0x0f8]
/* setmem /32 0x140000fc = 0x00000064 */
ldr r1, =0x00000064
str r1, [r0, #0x0fc]
/* setmem /32 0x14000104 = 0x02000602 */
ldr r1, =0x02000602
str r1, [r0, #0x0104]
/* setmem /32 0x14000108 = 0x06120000 */
ldr r1, =0x06120000
str r1, [r0, #0x0108]
/* setmem /32 0x1400010c = 0x06120612 */
ldr r1, =0x06120612
str r1, [r0, #0x010c]
/* setmem /32 0x14000110 = 0x06120612 */
ldr r1, =0x06120612
str r1, [r0, #0x0110]
/* setmem /32 0x14000114 = 0x01030612 */
ldr r1, =0x01030612
str r1, [r0, #0x0114]
/* setmem /32 0x14000118 = 0x01010002 */
ldr r1, =0x01010002
str r1, [r0, #0x0118]
/*=============================================================
* DDR PHY setting
*===========================================================*/
/* setmem /32 0x14000200 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x200]
/* setmem /32 0x14000204 = 0x00000000 */
str r1, [r0, #0x0204]
/* setmem /32 0x14000208 = 0xf5002725 */
ldr r1, =0xf5002725
str r1, [r0, #0x0208]
/* setmem /32 0x14000210 = 0xf5002725 */
str r1, [r0, #0x210]
/* setmem /32 0x14000218 = 0xf5002725 */
str r1, [r0, #0x218]
/* setmem /32 0x14000220 = 0xf5002725 */
str r1, [r0, #0x0220]
/* setmem /32 0x14000228 = 0xf5002725 */
str r1, [r0, #0x0228]
/* setmem /32 0x14000234 = 0x00800006*/
ldr r1, =0x00800006
str r1, [r0, #0x0234]
/* setmem /32 0x1400020c = 0x070002d0 */
ldr r1, =0x070002d0
str r1, [r0, #0x020c]
/* setmem /32 0x14000214 = 0x074002d0 */
str r1, [r0, #0x0214]
/* setmem /32 0x1400021c = 0x074002d0 */
str r1, [r0, #0x021c]
/* setmem /32 0x14000224 = 0x074002d0 */
str r1, [r0, #0x0224]
/* setmem /32 0x1400022c = 0x074002d0 */
str r1, [r0, #0x022c]
/* setmem /32 0x14000230 = 0x00000000 */
ldr r1, =0x00000000
str r1, [r0, #0x0230]
/* setmem /32 0x14000238 = 0x200e1014 */
ldr r1, =0x200e1014
str r1, [r0, #0x0238]
/* setmem /32 0x14000240 = 0x200e1014 */
str r1, [r0, #0x0240]
/* setmem /32 0x14000248 = 0x200e1014 */
str r1, [r0, #0x0248]
/* setmem /32 0x14000250 = 0x200e1014 */
str r1, [r0, #0x0250]
/* setmem /32 0x14000258 = 0x200e1014 */
str r1, [r0, #0x0258]
/* setmem /32 0x1400023c = 0x000d9f01 */
ldr r1, =0x000d9f01
str r1, [r0, #0x023c]
/* setmem /32 0x14000244 = 0x000d9f01 */
str r1, [r0, #0x0244]
/* setmem /32 0x1400024c = 0x000d9f01 */
str r1, [r0, #0x024c]
/* setmem /32 0x14000254 = 0x000d9f01 */
str r1, [r0, #0x0254]
/* setmem /32 0x1400025c = 0x000d9f01 */
str r1, [r0, #0x025c]
/* Start ddr */
/* setmem /32 0x14000000 = 0x00000101 // bit[0]: start */
ldr r1, =0x00000101
str r1, [r0, #0x0]
/* poll to make sure it is done */
1:
ldr r1, [r0, #0xa8]
ands r1, r1, #0x10
beq 1b
#endif
/*
* The following is to fill in those arguments for this ROM function
* pu_irom_hwcnfg_setup(void **start, size_t *bytes, const void *boot_data)
*
* This function is used to copy data from the storage media into DDR.
* start - Initial (possibly partial) image load address on entry.
* Final image load address on exit.
* bytes - Initial (possibly partial) image size on entry.
* Final image size on exit.
* boot_data - Initial @ref ivt Boot Data load address.
*/
ldr r0, =ROM_SI_REV
ldr r1, [r0]
cmp r1, #0x11
adr r0, DDR_DEST_ADDR
adr r1, COPY_SIZE
adr r2, BOOT_DATA
before_calling_rom___pu_irom_hwcnfg_setup:
mov r3, #0x2a00
/* Different ROM address for TO 1.0 & TO 1.1.1 */
addeq r3, r3, #0xad
addne r3, r3, #0x19
cmp r4, #0xf8000000
blxhi r3
after_calling_rom___pu_irom_hwcnfg_setup:
pop {r0-r6, r8, lr}
mov r0, #1
bx lr /* return back to ROM code */
/* Data be copied by pu_irom_hwcnfg_setup() */
DDR_DEST_ADDR: .word TEXT_BASE
COPY_SIZE: .word _end - TEXT_BASE
BOOT_DATA: .word TEXT_BASE
.word _end - TEXT_BASE
.word 0
IVT2_HDR_OFS: .word ivt2_header - TEXT_BASE
#endif
|