Newer
Older
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
diff --git a/board/samsung/galaxys2/Makefile b/board/samsung/galaxys2/Makefile
new file mode 100644
index 000000000..933d75c3a
--- /dev/null
+++ b/board/samsung/galaxys2/Makefile
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2011 Samsung Electronics
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB = $(obj)lib$(BOARD).o
+
+SOBJS := mem_setup.o
+SOBJS += lowlevel_init.o
+ifndef CONFIG_SPL_BUILD
+COBJS += galaxys2.o
+endif
+
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
+
+ALL := $(obj).depend $(LIB)
+
+all: $(ALL)
+
+$(LIB): $(OBJS)
+ $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/samsung/galaxys2/galaxys2.c b/board/samsung/galaxys2/galaxys2.c
new file mode 100644
index 000000000..2de29aa78
--- /dev/null
+++ b/board/samsung/galaxys2/galaxys2.c
@@ -0,0 +1,378 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 <common.h>
+#include <asm/io.h>
+#include <netdev.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/mmc.h>
+#include <asm/arch/sromc.h>
+#include <usb/s3c_udc.h>
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
+
+DECLARE_GLOBAL_DATA_PTR;
+struct exynos4_gpio_part1 *gpio1;
+struct exynos4_gpio_part2 *gpio2;
+
+static int galaxys2_usb_init(void);
+
+#ifndef CONFIG_VIDEO
+//causes the camera LED to blink shortly
+static void blink_led(unsigned times) {
+ struct pmic *p = get_pmic();
+ if (pmic_probe(p)) {
+ printf("failed to get pmic\n");
+ return;
+ }
+
+ while (times --> 0) {
+ pmic_set_output(p, MAX8997_REG_LEN_CNTL,
+ MAX8997_LED0_FLASH_MASK, LDO_OFF);
+
+ pmic_set_output(p, MAX8997_REG_BOOST_CNTL,
+ MAX8997_LED_BOOST_ENABLE_MASK, LDO_OFF);
+
+ pmic_set_output(p, MAX8997_REG_LEN_CNTL,
+ 0, 0);
+
+ pmic_reg_write(p, MAX8997_REG_FLASH1_CUR,
+ (0xff) << MAX8997_LED_FLASH_SHIFT);
+
+ pmic_set_output(p, MAX8997_REG_BOOST_CNTL,
+ MAX8997_LED_BOOST_ENABLE_MASK, LDO_ON);
+
+ pmic_set_output(p, MAX8997_REG_LEN_CNTL,
+ MAX8997_LED0_FLASH_MASK, LDO_ON);
+
+ mdelay(100);
+ }
+}
+#endif
+
+static void max8997_reg_update(struct pmic *p, u32 reg, int val, int mask) {
+ u32 tmp;
+ pmic_reg_read(p, reg, &tmp);
+ tmp &= ~mask;
+ tmp |= (val & mask);
+ pmic_reg_write(p, reg, tmp);
+}
+
+static void microsd_power_enable(void) {
+ struct pmic *p = get_pmic();
+ if (pmic_probe(p)) {
+ printf("failed to get pmic\n");
+ return;
+ }
+
+ //set 2.8V
+ max8997_reg_update(p, MAX8997_REG_LDO17CTRL, 40, 0x3f);
+ pmic_set_output(p, MAX8997_REG_LDO17CTRL, MAX8997_MASK_LDO, LDO_ON);
+ mdelay(50);
+}
+
+static void max8997_init (void) {
+ struct pmic *p;
+ int i;
+
+ if (pmic_init()) {
+ printf("failed to init pmic\n");
+ return;
+ }
+
+ p = get_pmic();
+ if (pmic_probe(p)) {
+ printf("failed to get pmic\n");
+ return;
+ }
+
+ /* For the safety, set max voltage before setting up */
+ for (i = 0; i < 8; i++) {
+ //these regulators are 650..2225mv by 25mv steps
+ max8997_reg_update(p, MAX8997_REG_BUCK1DVS1 + i, 28, 0x3f);
+ max8997_reg_update(p, MAX8997_REG_BUCK2DVS1 + i, 20, 0x3f);
+ max8997_reg_update(p, MAX8997_REG_BUCK5DVS1 + i, 22, 0x3f);
+ }
+ pmic_reg_write(p, MAX8997_REG_BUCKRAMP, 0xf9);
+}
+
+static void init_gpio_keys() {
+ /* Home key */
+ s5p_gpio_cfg_pin(&gpio2->x3, 5, GPIO_INPUT);
+ s5p_gpio_set_pull(&gpio2->x3, 5, GPIO_PULL_NONE);
+ s5p_gpio_set_drv(&gpio2->x3, 5, GPIO_DRV_1X);
+
+ /* Volume up key */
+ s5p_gpio_cfg_pin(&gpio2->x2, 0, GPIO_INPUT);
+ s5p_gpio_set_pull(&gpio2->x2, 0, GPIO_PULL_NONE);
+ s5p_gpio_set_drv(&gpio2->x2, 0, GPIO_DRV_1X);
+}
+
+int do_get_sgs2_bootmode(cmd_tbl_t *cmdtp, int flag,
+ int argc, char * const argv[])
+{
+ int home = !s5p_gpio_get_value(&gpio2->x3, 5);
+ int volup = !s5p_gpio_get_value(&gpio2->x2, 0);
+ int rc = (home << 1) | volup;
+ setenv("sgs2_bootmode_val", simple_itoa(rc));
+ return 0;
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
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
+}
+
+U_BOOT_CMD(sgs2_get_bootmode, CONFIG_SYS_MAXARGS, 1, do_get_sgs2_bootmode,
+ "Get Galaxy S2 boot mode\n"
+ "Bit 0 -> recovery\n"
+ "Bit 1 -> custom kernel",
+ "sgs2_bootmode\n"
+);
+
+int board_init(void)
+{
+ gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
+ gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
+
+ gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
+
+ max8997_init();
+
+#ifndef CONFIG_VIDEO
+ blink_led(1);
+#endif
+
+ if (galaxys2_usb_init()) {
+ printf("failed to initialize usb\n");
+ }
+
+ init_gpio_keys();
+
+ return 0;
+}
+
+int dram_init(void)
+{
+ gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE)
+ + get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE)
+ + get_ram_size((long *)PHYS_SDRAM_3, PHYS_SDRAM_3_SIZE)
+ + get_ram_size((long *)PHYS_SDRAM_4, PHYS_SDRAM_4_SIZE);
+ return 0;
+}
+
+void dram_init_banksize(void)
+{
+ gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+ gd->bd->bi_dram[0].size = get_ram_size((long *)PHYS_SDRAM_1, \
+ PHYS_SDRAM_1_SIZE);
+ gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+ gd->bd->bi_dram[1].size = get_ram_size((long *)PHYS_SDRAM_2, \
+ PHYS_SDRAM_2_SIZE);
+ gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
+ gd->bd->bi_dram[2].size = get_ram_size((long *)PHYS_SDRAM_3, \
+ PHYS_SDRAM_3_SIZE);
+ gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
+ gd->bd->bi_dram[3].size = get_ram_size((long *)PHYS_SDRAM_4, \
+ PHYS_SDRAM_4_SIZE);
+}
+
+int board_eth_init(bd_t *bis)
+{
+ return 0;
+}
+
+#ifdef CONFIG_DISPLAY_BOARDINFO
+int checkboard(void)
+{
+ printf("\nBoard: GALAXYS2\n");
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_GENERIC_MMC
+static int galaxys2_init_emmc(void) {
+ int i;
+
+ //massmem enable
+ s5p_gpio_direction_output(&gpio2->l1, 1, 0);
+
+ /*
+ * eMMC GPIO:
+ * SDR 8-bit@48MHz at MMC0
+ * GPK0[0] SD_0_CLK(2)
+ * GPK0[1] SD_0_CMD(2)
+ * GPK0[2] SD_0_CDn -> Not used
+ * GPK0[3:6] SD_0_DATA[0:3](2)
+ * GPK1[3:6] SD_0_DATA[0:3](3)
+ *
+ * DDR 4-bit@26MHz at MMC4
+ * GPK0[0] SD_4_CLK(3)
+ * GPK0[1] SD_4_CMD(3)
+ * GPK0[2] SD_4_CDn -> Not used
+ * GPK0[3:6] SD_4_DATA[0:3](3)
+ * GPK1[3:6] SD_4_DATA[4:7](4)
+ */
+ for (i = 0; i < 7; i++) {
+ if (i == 2)
+ continue;
+ /* GPK0[0:6] special function 2 */
+ s5p_gpio_cfg_pin(&gpio2->k0, i, 0x2);
+ /* GPK0[0:6] pull disable */
+ s5p_gpio_set_pull(&gpio2->k0, i, GPIO_PULL_NONE);
+ /* GPK0[0:6] drv 4x */
+ s5p_gpio_set_drv(&gpio2->k0, i, GPIO_DRV_4X);
+ }
+
+ for (i = 3; i < 7; i++) {
+ /* GPK1[3:6] special function 3 */
+ s5p_gpio_cfg_pin(&gpio2->k1, i, 0x3);
+ /* GPK1[3:6] pull disable */
+ s5p_gpio_set_pull(&gpio2->k1, i, GPIO_PULL_NONE);
+ /* GPK1[3:6] drv 4x */
+ s5p_gpio_set_drv(&gpio2->k1, i, GPIO_DRV_4X);
+ }
+
+ /*
+ * mmc0 : eMMC (8-bit buswidth)
+ */
+ return s5p_mmc_init(0, 8);
+}
+
+static int galaxys2_init_microsd(void) {
+ int i;
+
+ /* T-flash detect */
+ s5p_gpio_cfg_pin(&gpio2->x3, 4, 0xf);
+ s5p_gpio_set_pull(&gpio2->x3, 4, GPIO_PULL_UP);
+
+ if (!s5p_gpio_get_value(&gpio2->x3, 4)) {
+ printf("enabling uSD\n");
+ microsd_power_enable();
+
+ /*
+ * MMC2 SD card GPIO:
+ *
+ * GPK2[0] SD_2_CLK(2)
+ * GPK2[1] SD_2_CMD(2)
+ * GPK2[2] SD_2_CDn -> Not used
+ * GPK2[3:6] SD_2_DATA[0:3](2)
+ */
+ for (i = 0; i < 7; i++) {
+ if (i == 2)
+ continue;
+ /* GPK2[0:6] special function 2 */
+ s5p_gpio_cfg_pin(&gpio2->k2, i, GPIO_FUNC(0x2));
+
+ if (i < 2) {
+ /* GPK2[0:1] pull disable */
+ s5p_gpio_set_pull(&gpio2->k2, i, GPIO_PULL_NONE);
+ }
+ else {
+ /* GPK2[2:6] pull up */
+ s5p_gpio_set_pull(&gpio2->k2, i, GPIO_PULL_UP);
+ }
+
+ /* GPK2[0:6] drv 4x */
+ s5p_gpio_set_drv(&gpio2->k2, i, GPIO_DRV_4X);
+ }
+
+ return s5p_mmc_init(2, 4);
+ }
+ return 0;
+}
+
+int board_mmc_init(bd_t *bis)
+{
+ if (galaxys2_init_emmc()) {
+ printf("failed to initialize emmc\n");
+ }
+
+ if (galaxys2_init_microsd()) {
+ printf("failed to initialize uSD\n");
+ }
+
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_USB_GADGET
+static int galaxys2_phy_control(int on)
+{
+ int ret = 0;
+ struct pmic *p = get_pmic();
+
+ if (pmic_probe(p))
+ return -1;
+
+ if (on) {
+ ret |= pmic_set_output(p, MAX8997_REG_LDO8CTRL,
+ MAX8997_MASK_LDO, LDO_ON);
+ ret |= pmic_set_output(p, MAX8997_REG_LDO3CTRL,
+ MAX8997_MASK_LDO, LDO_ON);
+ } else {
+ ret |= pmic_set_output(p, MAX8997_REG_LDO3CTRL,
+ MAX8997_MASK_LDO, LDO_OFF);
+ ret |= pmic_set_output(p, MAX8997_REG_LDO8CTRL,
+ MAX8997_MASK_LDO, LDO_OFF);
+ }
+
+ if (ret) {
+ puts("MAX8997 LDO setting error!\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+struct s3c_plat_otg_data galaxys2_otg_data = {
+ .phy_control = galaxys2_phy_control,
+ .regs_phy = EXYNOS4_USBPHY_BASE,
+ .regs_otg = EXYNOS4_USBOTG_BASE,
+ .usb_phy_ctrl = EXYNOS4_USBPHY_CONTROL,
+ .usb_flags = PHY0_SLEEP,
+};
+
+static int galaxys2_usb_init(void) {
+ return s3c_udc_probe(&galaxys2_otg_data);
+}
+#else
+static int galaxys2_usb_init(void) {
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_VIDEO
+#include <video_fb.h>
+
+/* when we are chainloading from the proprietary bootloader,
+ * the framebuffer is already set up at this fixed location */
+#define I9100_FB 0x5ec00000
+
+GraphicDevice gdev;
+
+void *video_hw_init(void) {
+ memset((void*)I9100_FB, 0, 480 * 800 * 4);
+ gdev.frameAdrs = I9100_FB;
+ gdev.winSizeX = 480;
+ gdev.winSizeY = 800;
+ gdev.gdfBytesPP = 4;
+ gdev.gdfIndex = GDF_32BIT_X888RGB;
+ return &gdev;
+}
+#endif
diff --git a/board/samsung/galaxys2/galaxys2_setup.h b/board/samsung/galaxys2/galaxys2_setup.h
new file mode 100644
index 000000000..5c3115c5a
--- /dev/null
+++ b/board/samsung/galaxys2/galaxys2_setup.h
@@ -0,0 +1,558 @@
+/*
+ * Machine Specific Values for GALAXYS2 board based on S5PV310
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ */
+
+#ifndef _GALAXYS2_SETUP_H
+#define _GALAXYS2_SETUP_H
+
+#include <config.h>
+#include <version.h>
+#include <asm/arch/cpu.h>
+
+/* Offsets of clock registers (sources and dividers) */
+#define CLK_SRC_CPU_OFFSET 0x14200
+#define CLK_DIV_CPU0_OFFSET 0x14500
+#define CLK_DIV_CPU1_OFFSET 0x14504
+
+#define CLK_SRC_DMC_OFFSET 0x10200
+#define CLK_DIV_DMC0_OFFSET 0x10500
+#define CLK_DIV_DMC1_OFFSET 0x10504
+
+#define CLK_SRC_TOP0_OFFSET 0xC210
+#define CLK_SRC_TOP1_OFFSET 0xC214
+#define CLK_DIV_TOP_OFFSET 0xC510
+
+#define CLK_SRC_LEFTBUS_OFFSET 0x4200
+#define CLK_DIV_LEFTBUS_OFFSET 0x4500
+
+#define CLK_SRC_RIGHTBUS_OFFSET 0x8200
+#define CLK_DIV_RIGHTBUS_OFFSET 0x8500
+
+#define CLK_SRC_FSYS_OFFSET 0xC240
+#define CLK_DIV_FSYS1_OFFSET 0xC544
+#define CLK_DIV_FSYS2_OFFSET 0xC548
+#define CLK_DIV_FSYS3_OFFSET 0xC54C
+
+#define CLK_SRC_PERIL0_OFFSET 0xC250
+#define CLK_DIV_PERIL0_OFFSET 0xC550
+
+#define CLK_SRC_LCD0_OFFSET 0xC234
+
+#define APLL_LOCK_OFFSET 0x14000
+#define MPLL_LOCK_OFFSET 0x14008
+#define APLL_CON0_OFFSET 0x14100
+#define APLL_CON1_OFFSET 0x14104
+#define MPLL_CON0_OFFSET 0x14108
+#define MPLL_CON1_OFFSET 0x1410C
+
+#define EPLL_LOCK_OFFSET 0xC010
+#define VPLL_LOCK_OFFSET 0xC020
+#define EPLL_CON0_OFFSET 0xC110
+#define EPLL_CON1_OFFSET 0xC114
+#define VPLL_CON0_OFFSET 0xC120
+#define VPLL_CON1_OFFSET 0xC124
+
+/* DMC: DRAM Controllor Register offsets */
+#define DMC_CONCONTROL 0x00
+#define DMC_MEMCONTROL 0x04
+#define DMC_MEMCONFIG0 0x08
+#define DMC_MEMCONFIG1 0x0C
+#define DMC_DIRECTCMD 0x10
+#define DMC_PRECHCONFIG 0x14
+#define DMC_PHYCONTROL0 0x18
+#define DMC_PHYCONTROL1 0x1C
+#define DMC_PHYCONTROL2 0x20
+#define DMC_TIMINGAREF 0x30
+#define DMC_TIMINGROW 0x34
+#define DMC_TIMINGDATA 0x38
+#define DMC_TIMINGPOWER 0x3C
+#define DMC_PHYZQCONTROL 0x44
+
+/* Bus Configuration Register Address */
+#define ASYNC_CONFIG 0x10010350
+
+/* MIU Config Register Offsets*/
+#define APB_SFR_INTERLEAVE_CONF_OFFSET 0x400
+#define APB_SFR_ARBRITATION_CONF_OFFSET 0xC00
+
+/* Offset for inform registers */
+#define INFORM0_OFFSET 0x800
+#define INFORM1_OFFSET 0x804
+
+/* GPIO Offsets for UART: GPIO Contol Register */
+#define EXYNOS4_GPIO_A0_CON_OFFSET 0x00
+#define EXYNOS4_GPIO_A1_CON_OFFSET 0x20
+
+/* UART Register offsets */
+#define ULCON_OFFSET 0x00
+#define UCON_OFFSET 0x04
+#define UFCON_OFFSET 0x08
+#define UBRDIV_OFFSET 0x28
+#define UFRACVAL_OFFSET 0x2C
+
+/* TZPC : Register Offsets */
+#define TZPC0_BASE 0x10110000
+#define TZPC1_BASE 0x10120000
+#define TZPC2_BASE 0x10130000
+#define TZPC3_BASE 0x10140000
+#define TZPC4_BASE 0x10150000
+#define TZPC5_BASE 0x10160000
+
+#define TZPC_DECPROT0SET_OFFSET 0x804
+#define TZPC_DECPROT1SET_OFFSET 0x810
+#define TZPC_DECPROT2SET_OFFSET 0x81C
+#define TZPC_DECPROT3SET_OFFSET 0x828
+
+/* CLK_SRC_CPU */
+#define MUX_HPM_SEL_MOUTAPLL 0x0
+#define MUX_HPM_SEL_SCLKMPLL 0x1
+#define MUX_CORE_SEL_MOUTAPLL 0x0
+#define MUX_CORE_SEL_SCLKMPLL 0x1
+#define MUX_MPLL_SEL_FILPLL 0x0
+#define MUX_MPLL_SEL_MOUTMPLLFOUT 0x1
+#define MUX_APLL_SEL_FILPLL 0x0
+#define MUX_APLL_SEL_MOUTMPLLFOUT 0x1
+#define CLK_SRC_CPU_VAL ((MUX_HPM_SEL_MOUTAPLL << 20) \
+ | (MUX_CORE_SEL_MOUTAPLL << 16) \
+ | (MUX_MPLL_SEL_MOUTMPLLFOUT << 8)\
+ | (MUX_APLL_SEL_MOUTMPLLFOUT << 0))
+
+/* CLK_DIV_CPU0 */
+#define APLL_RATIO 0x0
+#define PCLK_DBG_RATIO 0x1
+#define ATB_RATIO 0x3
+#define PERIPH_RATIO 0x3
+#define COREM1_RATIO 0x7
+#define COREM0_RATIO 0x3
+#define CORE_RATIO 0x0
+#define CLK_DIV_CPU0_VAL ((APLL_RATIO << 24) \
+ | (PCLK_DBG_RATIO << 20) \
+ | (ATB_RATIO << 16) \
+ | (PERIPH_RATIO << 12) \
+ | (COREM1_RATIO << 8) \
+ | (COREM0_RATIO << 4) \
+ | (CORE_RATIO << 0))
+
+/* CLK_DIV_CPU1 */
+#define HPM_RATIO 0x0
+#define COPY_RATIO 0x3
+#define CLK_DIV_CPU1_VAL ((HPM_RATIO << 4) | (COPY_RATIO))
+
+/* CLK_SRC_DMC */
+#define MUX_PWI_SEL_XXTI 0x0
+#define MUX_PWI_SEL_XUSBXTI 0x1
+#define MUX_PWI_SEL_SCLK_HDMI24M 0x2
+#define MUX_PWI_SEL_SCLK_USBPHY0 0x3
+#define MUX_PWI_SEL_SCLK_USBPHY1 0x4
+#define MUX_PWI_SEL_SCLK_HDMIPHY 0x5
+#define MUX_PWI_SEL_SCLKMPLL 0x6
+#define MUX_PWI_SEL_SCLKEPLL 0x7
+#define MUX_PWI_SEL_SCLKVPLL 0x8
+#define MUX_DPHY_SEL_SCLKMPLL 0x0
+#define MUX_DPHY_SEL_SCLKAPLL 0x1
+#define MUX_DMC_BUS_SEL_SCLKMPLL 0x0
+#define MUX_DMC_BUS_SEL_SCLKAPLL 0x1
+#define CLK_SRC_DMC_VAL ((MUX_PWI_SEL_XUSBXTI << 16) \
+ | (MUX_DPHY_SEL_SCLKMPLL << 8) \
+ | (MUX_DMC_BUS_SEL_SCLKMPLL << 4))
+
+/* CLK_DIV_DMC0 */
+#define CORE_TIMERS_RATIO 0x1
+#define COPY2_RATIO 0x3
+#define DMCP_RATIO 0x1
+#define DMCD_RATIO 0x1
+#define DMC_RATIO 0x1
+#define DPHY_RATIO 0x1
+#define ACP_PCLK_RATIO 0x1
+#define ACP_RATIO 0x3
+#define CLK_DIV_DMC0_VAL ((CORE_TIMERS_RATIO << 28) \
+ | (COPY2_RATIO << 24) \
+ | (DMCP_RATIO << 20) \
+ | (DMCD_RATIO << 16) \
+ | (DMC_RATIO << 12) \
+ | (DPHY_RATIO << 8) \
+ | (ACP_PCLK_RATIO << 4) \
+ | (ACP_RATIO << 0))
+
+/* CLK_DIV_DMC1 */
+#define DPM_RATIO 0x1
+#define DVSEM_RATIO 0x1
+#define PWI_RATIO 0x1
+#define CLK_DIV_DMC1_VAL ((DPM_RATIO << 24) \
+ | (DVSEM_RATIO << 16) \
+ | (PWI_RATIO << 8))
+
+/* CLK_SRC_TOP0 */
+#define MUX_ONENAND_SEL_ACLK_133 0x0
+#define MUX_ONENAND_SEL_ACLK_160 0x1
+#define MUX_ACLK_133_SEL_SCLKMPLL 0x0
+#define MUX_ACLK_133_SEL_SCLKAPLL 0x1
+#define MUX_ACLK_160_SEL_SCLKMPLL 0x0
+#define MUX_ACLK_160_SEL_SCLKAPLL 0x1
+#define MUX_ACLK_100_SEL_SCLKMPLL 0x0
+#define MUX_ACLK_100_SEL_SCLKAPLL 0x1
+#define MUX_ACLK_200_SEL_SCLKMPLL 0x0
+#define MUX_ACLK_200_SEL_SCLKAPLL 0x1
+#define MUX_VPLL_SEL_FINPLL 0x0
+#define MUX_VPLL_SEL_FOUTVPLL 0x1
+#define MUX_EPLL_SEL_FINPLL 0x0
+#define MUX_EPLL_SEL_FOUTEPLL 0x1
+#define MUX_ONENAND_1_SEL_MOUTONENAND 0x0
+#define MUX_ONENAND_1_SEL_SCLKVPLL 0x1
+#define CLK_SRC_TOP0_VAL ((MUX_ONENAND_SEL_ACLK_133 << 28) \
+ | (MUX_ACLK_133_SEL_SCLKMPLL << 24) \
+ | (MUX_ACLK_160_SEL_SCLKMPLL << 20) \
+ | (MUX_ACLK_100_SEL_SCLKMPLL << 16) \
+ | (MUX_ACLK_200_SEL_SCLKMPLL << 12) \
+ | (MUX_VPLL_SEL_FINPLL << 8) \
+ | (MUX_EPLL_SEL_FINPLL << 4)\
+ | (MUX_ONENAND_1_SEL_MOUTONENAND << 0))
+
+/* CLK_SRC_TOP1 */
+#define VPLLSRC_SEL_FINPLL 0x0
+#define VPLLSRC_SEL_SCLKHDMI24M 0x1
+#define CLK_SRC_TOP1_VAL (VPLLSRC_SEL_FINPLL)
+
+/* CLK_DIV_TOP */
+#define ONENAND_RATIO 0x0
+#define ACLK_133_RATIO 0x5
+#define ACLK_160_RATIO 0x4
+#define ACLK_100_RATIO 0x7
+#define ACLK_200_RATIO 0x3
+#define CLK_DIV_TOP_VAL ((ONENAND_RATIO << 16) \
+ | (ACLK_133_RATIO << 12)\
+ | (ACLK_160_RATIO << 8) \
+ | (ACLK_100_RATIO << 4) \
+ | (ACLK_200_RATIO << 0))
+
+/* CLK_SRC_LEFTBUS */
+#define MUX_GDL_SEL_SCLKMPLL 0x0
+#define MUX_GDL_SEL_SCLKAPLL 0x1
+#define CLK_SRC_LEFTBUS_VAL (MUX_GDL_SEL_SCLKMPLL)
+
+/* CLK_DIV_LEFTBUS */
+#define GPL_RATIO 0x1
+#define GDL_RATIO 0x3
+#define CLK_DIV_LEFTBUS_VAL ((GPL_RATIO << 4) | (GDL_RATIO))
+
+/* CLK_SRC_RIGHTBUS */
+#define MUX_GDR_SEL_SCLKMPLL 0x0
+#define MUX_GDR_SEL_SCLKAPLL 0x1
+#define CLK_SRC_RIGHTBUS_VAL (MUX_GDR_SEL_SCLKMPLL)
+
+/* CLK_DIV_RIGHTBUS */
+#define GPR_RATIO 0x1
+#define GDR_RATIO 0x3
+#define CLK_DIV_RIGHTBUS_VAL ((GPR_RATIO << 4) | (GDR_RATIO))
+
+/* CLK_SRS_FSYS: 6 = SCLKMPLL */
+#define SATA_SEL_SCLKMPLL 0
+#define SATA_SEL_SCLKAPLL 1
+
+#define MMC_SEL_XXTI 0
+#define MMC_SEL_XUSBXTI 1
+#define MMC_SEL_SCLK_HDMI24M 2
+#define MMC_SEL_SCLK_USBPHY0 3
+#define MMC_SEL_SCLK_USBPHY1 4
+#define MMC_SEL_SCLK_HDMIPHY 5
+#define MMC_SEL_SCLKMPLL 6
+#define MMC_SEL_SCLKEPLL 7
+#define MMC_SEL_SCLKVPLL 8
+
+#define MMCC0_SEL MMC_SEL_SCLKMPLL
+#define MMCC1_SEL MMC_SEL_SCLKMPLL
+#define MMCC2_SEL MMC_SEL_SCLKMPLL
+#define MMCC3_SEL MMC_SEL_SCLKMPLL
+#define MMCC4_SEL MMC_SEL_SCLKMPLL
+#define CLK_SRC_FSYS_VAL ((SATA_SEL_SCLKMPLL << 24) \
+ | (MMCC4_SEL << 16) \
+ | (MMCC3_SEL << 12) \
+ | (MMCC2_SEL << 8) \
+ | (MMCC1_SEL << 4) \
+ | (MMCC0_SEL << 0))
+
+/* SCLK_MMC[0-4] = MOUTMMC[0-4]/(MMC[0-4]_RATIO + 1)/(MMC[0-4]_PRE_RATIO +1) */
+/* CLK_DIV_FSYS1 */
+#define MMC0_RATIO 0xF
+#define MMC0_PRE_RATIO 0x0
+#define MMC1_RATIO 0xF
+#define MMC1_PRE_RATIO 0x0
+#define CLK_DIV_FSYS1_VAL ((MMC1_PRE_RATIO << 24) \
+ | (MMC1_RATIO << 16) \
+ | (MMC0_PRE_RATIO << 8) \
+ | (MMC0_RATIO << 0))
+
+/* CLK_DIV_FSYS2 */
+#define MMC2_RATIO 0xF
+#define MMC2_PRE_RATIO 0x0
+#define MMC3_RATIO 0xF
+#define MMC3_PRE_RATIO 0x0
+#define CLK_DIV_FSYS2_VAL ((MMC3_PRE_RATIO << 24) \
+ | (MMC3_RATIO << 16) \
+ | (MMC2_PRE_RATIO << 8) \
+ | (MMC2_RATIO << 0))
+
+/* CLK_DIV_FSYS3 */
+#define MMC4_RATIO 0xF
+#define MMC4_PRE_RATIO 0x0
+#define CLK_DIV_FSYS3_VAL ((MMC4_PRE_RATIO << 8) \
+ | (MMC4_RATIO << 0))
+
+/* CLK_SRC_PERIL0 */
+#define UART_SEL_XXTI 0
+#define UART_SEL_XUSBXTI 1
+#define UART_SEL_SCLK_HDMI24M 2
+#define UART_SEL_SCLK_USBPHY0 3
+#define UART_SEL_SCLK_USBPHY1 4
+#define UART_SEL_SCLK_HDMIPHY 5
+#define UART_SEL_SCLKMPLL 6
+#define UART_SEL_SCLKEPLL 7
+#define UART_SEL_SCLKVPLL 8
+
+#define UART0_SEL UART_SEL_SCLKMPLL
+#define UART1_SEL UART_SEL_SCLKMPLL
+#define UART2_SEL UART_SEL_SCLKMPLL
+#define UART3_SEL UART_SEL_SCLKMPLL
+#define UART4_SEL UART_SEL_SCLKMPLL
+#define CLK_SRC_PERIL0_VAL ((UART4_SEL << 16) \
+ | (UART3_SEL << 12) \
+ | (UART2_SEL << 8) \
+ | (UART1_SEL << 4) \
+ | (UART0_SEL << 0))
+
+/* SCLK_UART[0-4] = MOUTUART[0-4]/(UART[0-4]_RATIO + 1) */
+/* CLK_DIV_PERIL0 */
+#define UART0_RATIO 7
+#define UART1_RATIO 7
+#define UART2_RATIO 7
+#define UART3_RATIO 7
+#define UART4_RATIO 7
+#define CLK_DIV_PERIL0_VAL ((UART4_RATIO << 16) \
+ | (UART3_RATIO << 12) \
+ | (UART2_RATIO << 8) \
+ | (UART1_RATIO << 4) \
+ | (UART0_RATIO << 0))
+
+/* CLK_SRC_LCD0 */
+#define FIMD_SEL_SCLKMPLL 6
+#define MDNIE0_SEL_XUSBXTI 1
+#define MDNIE_PWM0_SEL_XUSBXTI 1
+#define MIPI0_SEL_XUSBXTI 1
+#define CLK_SRC_LCD0_VAL ((MIPI0_SEL_XUSBXTI << 12) \
+ | (MDNIE_PWM0_SEL_XUSBXTI << 8) \
+ | (MDNIE0_SEL_XUSBXTI << 4) \
+ | (FIMD_SEL_SCLKMPLL << 0))
+
+/* Required period to generate a stable clock output */
+/* PLL_LOCK_TIME */
+#define PLL_LOCKTIME 0x1C20
+
+/* PLL Values */
+#define DISABLE 0
+#define ENABLE 1
+#define SET_PLL(mdiv, pdiv, sdiv) ((ENABLE << 31)\
+ | (mdiv << 16) \
+ | (pdiv << 8) \
+ | (sdiv << 0))
+
+/* APLL_CON0 */
+#define APLL_MDIV 0xFA
+#define APLL_PDIV 0x6
+#define APLL_SDIV 0x1
+#define APLL_CON0_VAL SET_PLL(APLL_MDIV, APLL_PDIV, APLL_SDIV)
+
+/* APLL_CON1 */
+#define APLL_AFC_ENB 0x1
+#define APLL_AFC 0xC
+#define APLL_CON1_VAL ((APLL_AFC_ENB << 31) | (APLL_AFC << 0))
+
+/* MPLL_CON0 */
+#define MPLL_MDIV 0xC8
+#define MPLL_PDIV 0x6
+#define MPLL_SDIV 0x1
+#define MPLL_CON0_VAL SET_PLL(MPLL_MDIV, MPLL_PDIV, MPLL_SDIV)
+
+/* MPLL_CON1 */
+#define MPLL_AFC_ENB 0x0
+#define MPLL_AFC 0x1C
+#define MPLL_CON1_VAL ((MPLL_AFC_ENB << 31) | (MPLL_AFC << 0))
+
+/* EPLL_CON0 */
+#define EPLL_MDIV 0x30
+#define EPLL_PDIV 0x3
+#define EPLL_SDIV 0x2
+#define EPLL_CON0_VAL SET_PLL(EPLL_MDIV, EPLL_PDIV, EPLL_SDIV)
+
+/* EPLL_CON1 */
+#define EPLL_K 0x0
+#define EPLL_CON1_VAL (EPLL_K >> 0)
+
+/* VPLL_CON0 */
+#define VPLL_MDIV 0x35
+#define VPLL_PDIV 0x3
+#define VPLL_SDIV 0x2
+#define VPLL_CON0_VAL SET_PLL(VPLL_MDIV, VPLL_PDIV, VPLL_SDIV)
+
+/* VPLL_CON1 */
+#define VPLL_SSCG_EN DISABLE
+#define VPLL_SEL_PF_DN_SPREAD 0x0
+#define VPLL_MRR 0x11
+#define VPLL_MFR 0x0
+#define VPLL_K 0x400
+#define VPLL_CON1_VAL ((VPLL_SSCG_EN << 31)\
+ | (VPLL_SEL_PF_DN_SPREAD << 29) \
+ | (VPLL_MRR << 24) \
+ | (VPLL_MFR << 16) \
+ | (VPLL_K << 0))
+/*
+ * UART GPIO_A0/GPIO_A1 Control Register Value
+ * 0x2: UART Function
+ */
+#define EXYNOS4_GPIO_A0_CON_VAL 0x22222222
+#define EXYNOS4_GPIO_A1_CON_VAL 0x222222
+
+/* ULCON: UART Line Control Value 8N1 */
+#define WORD_LEN_5_BIT 0x00
+#define WORD_LEN_6_BIT 0x01
+#define WORD_LEN_7_BIT 0x02
+#define WORD_LEN_8_BIT 0x03
+
+#define STOP_BIT_1 0x00
+#define STOP_BIT_2 0x01
+
+#define NO_PARITY 0x00
+#define ODD_PARITY 0x4
+#define EVEN_PARITY 0x5
+#define FORCED_PARITY_CHECK_AS_1 0x6
+#define FORCED_PARITY_CHECK_AS_0 0x7
+
+#define INFRAMODE_NORMAL 0x00
+#define INFRAMODE_INFRARED 0x01
+
+#define ULCON_VAL ((INFRAMODE_NORMAL << 6) \
+ | (NO_PARITY << 3) \
+ | (STOP_BIT_1 << 2) \
+ | (WORD_LEN_8_BIT << 0))
+
+/*
+ * UCON: UART Control Value
+ * Tx_interrupt Type: Level
+ * Rx_interrupt Type: Level
+ * Rx Timeout Enabled: Yes
+ * Rx-Error Atatus_Int Enable: Yes
+ * Loop_Back: No
+ * Break Signal: No
+ * Transmit mode : Interrupt request/polling
+ * Receive mode : Interrupt request/polling
+ */
+#define TX_PULSE_INTERRUPT 0
+#define TX_LEVEL_INTERRUPT 1
+#define RX_PULSE_INTERRUPT 0
+#define RX_LEVEL_INTERRUPT 1
+
+#define RX_TIME_OUT ENABLE
+#define RX_ERROR_STATE_INT_ENB ENABLE
+#define LOOP_BACK DISABLE
+#define BREAK_SIGNAL DISABLE
+
+#define TX_MODE_DISABLED 0X00
+#define TX_MODE_IRQ_OR_POLL 0X01
+#define TX_MODE_DMA 0X02
+
+#define RX_MODE_DISABLED 0X00
+#define RX_MODE_IRQ_OR_POLL 0X01
+#define RX_MODE_DMA 0X02
+
+#define UCON_VAL ((TX_LEVEL_INTERRUPT << 9) \
+ | (RX_LEVEL_INTERRUPT << 8) \
+ | (RX_TIME_OUT << 7) \
+ | (RX_ERROR_STATE_INT_ENB << 6) \
+ | (LOOP_BACK << 5) \
+ | (BREAK_SIGNAL << 4) \
+ | (TX_MODE_IRQ_OR_POLL << 2) \
+ | (RX_MODE_IRQ_OR_POLL << 0))
+
+/*
+ * UFCON: UART FIFO Control Value
+ * Tx FIFO Trigger LEVEL: 2 Bytes (001)
+ * Rx FIFO Trigger LEVEL: 2 Bytes (001)
+ * Tx Fifo Reset: No
+ * Rx Fifo Reset: No
+ * FIFO Enable: Yes
+ */
+#define TX_FIFO_TRIGGER_LEVEL_0_BYTES 0x00
+#define TX_FIFO_TRIGGER_LEVEL_2_BYTES 0x1
+#define TX_FIFO_TRIGGER_LEVEL_4_BYTES 0x2
+#define TX_FIFO_TRIGGER_LEVEL_6_BYTES 0x3
+#define TX_FIFO_TRIGGER_LEVEL_8_BYTES 0x4
+#define TX_FIFO_TRIGGER_LEVEL_10_BYTES 0x5
+#define TX_FIFO_TRIGGER_LEVEL_12_BYTES 0x6
+#define TX_FIFO_TRIGGER_LEVEL_14_BYTES 0x7
+
+#define RX_FIFO_TRIGGER_LEVEL_2_BYTES 0x0
+#define RX_FIFO_TRIGGER_LEVEL_4_BYTES 0x1
+#define RX_FIFO_TRIGGER_LEVEL_6_BYTES 0x2
+#define RX_FIFO_TRIGGER_LEVEL_8_BYTES 0x3
+#define RX_FIFO_TRIGGER_LEVEL_10_BYTES 0x4
+#define RX_FIFO_TRIGGER_LEVEL_12_BYTES 0x5
+#define RX_FIFO_TRIGGER_LEVEL_14_BYTES 0x6
+#define RX_FIFO_TRIGGER_LEVEL_16_BYTES 0x7
+
+#define TX_FIFO_TRIGGER_LEVEL TX_FIFO_TRIGGER_LEVEL_2_BYTES
+#define RX_FIFO_TRIGGER_LEVEL RX_FIFO_TRIGGER_LEVEL_4_BYTES
+#define TX_FIFO_RESET DISABLE
+#define RX_FIFO_RESET DISABLE
+#define FIFO_ENABLE ENABLE
+#define UFCON_VAL ((TX_FIFO_TRIGGER_LEVEL << 8) \
+ | (RX_FIFO_TRIGGER_LEVEL << 4) \
+ | (TX_FIFO_RESET << 2) \
+ | (RX_FIFO_RESET << 1) \
+ | (FIFO_ENABLE << 0))
+/*
+ * Baud Rate Division Value
+ * 115200 BAUD:
+ * UBRDIV_VAL = SCLK_UART/((115200 * 16) - 1)
+ * UBRDIV_VAL = (800 MHz)/((115200 * 16) - 1)
+ */
+#define UBRDIV_VAL 0x35
+
+/*
+ * Fractional Part of Baud Rate Divisor:
+ * 115200 BAUD:
+ * UBRFRACVAL = ((((SCLK_UART*10/(115200*16) -10))%10)*16/10)
+ * UBRFRACVAL = ((((800MHz*10/(115200*16) -10))%10)*16/10)
+ */
+#define UFRACVAL_VAL 0x4
+
+/*
+ * TZPC Register Value :
+ * R0SIZE: 0x0 : Size of secured ram
+ */
+#define R0SIZE 0x0
+
+/*
+ * TZPC Decode Protection Register Value :
+ * DECPROTXSET: 0xFF : Set Decode region to non-secure
+ */
+#define DECPROTXSET 0xFF
+#endif
diff --git a/board/samsung/galaxys2/lowlevel_init.S b/board/samsung/galaxys2/lowlevel_init.S
new file mode 100644
index 000000000..b99028019
--- /dev/null
+++ b/board/samsung/galaxys2/lowlevel_init.S
@@ -0,0 +1,362 @@
+/*
+ * Lowlevel setup for ORIGEN board based on EXYNOS4210
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 <version.h>
+#include <asm/arch/cpu.h>
+#include "galaxys2_setup.h"
+/*
+ * Register usages:
+ *
+ * r5 has zero always
+ * r7 has GPIO part1 base 0x11400000
+ * r6 has GPIO part2 base 0x11000000
+ */
+
+_TEXT_BASE:
+ .word CONFIG_SYS_TEXT_BASE
+
+ .globl lowlevel_init
+lowlevel_init:
+ push {lr}
+
+ /* r5 has always zero */
+ mov r5, #0
+ ldr r7, =EXYNOS4_GPIO_PART1_BASE
+ ldr r6, =EXYNOS4_GPIO_PART2_BASE
+
+ /* check reset status */
+ ldr r0, =(EXYNOS4_POWER_BASE + INFORM1_OFFSET)
+ ldr r1, [r0]
+
+ /* AFTR wakeup reset */
+ ldr r2, =S5P_CHECK_DIDLE
+ cmp r1, r2
+ beq exit_wakeup
+
+ /* LPA wakeup reset */
+ ldr r2, =S5P_CHECK_LPA
+ cmp r1, r2
+ beq exit_wakeup
+
+ /* Sleep wakeup reset */
+ ldr r2, =S5P_CHECK_SLEEP
+ cmp r1, r2
+ beq wakeup_reset
+
+ /*
+ * If U-boot is already running in ram, no need to relocate U-Boot.
+ * Memory controller must be configured before relocating U-Boot
+ * in ram.
+ */
+ ldr r0, =0x0ffffff /* r0 <- Mask Bits*/
+ bic r1, pc, r0 /* pc <- current addr of code */
+ /* r1 <- unmasked bits of pc */
+ ldr r2, _TEXT_BASE /* r2 <- original base addr in ram */
+ bic r2, r2, r0 /* r2 <- unmasked bits of r2*/
+ cmp r1, r2 /* compare r1, r2 */
+ beq 1f /* r0 == r1 then skip sdram init */
+
+ /* init system clock */
+ bl system_clock_init
+
+ /* Memory initialize */
+ bl mem_ctrl_asm_init
+
+1:
+ /* for UART */
+ bl uart_asm_init
+ bl tzpc_init
+ pop {pc}
+
+wakeup_reset:
+ bl system_clock_init
+ bl mem_ctrl_asm_init
+ bl tzpc_init
+
+exit_wakeup:
+ /* Load return address and jump to kernel */
+ ldr r0, =(EXYNOS4_POWER_BASE + INFORM0_OFFSET)
+
+ /* r1 = physical address of exynos4210_cpu_resume function */
+ ldr r1, [r0]
+
+ /* Jump to kernel*/
+ mov pc, r1
+ nop
+ nop
+
+/*
+ * system_clock_init: Initialize core clock and bus clock.
+ * void system_clock_init(void)
+ */
+system_clock_init:
+ push {lr}
+ ldr r0, =EXYNOS4_CLOCK_BASE
+
+ /* APLL(1), MPLL(1), CORE(0), HPM(0) */
+ ldr r1, =CLK_SRC_CPU_VAL
+ ldr r2, =CLK_SRC_CPU_OFFSET
+ str r1, [r0, r2]
+
+ /* wait ?us */
+ mov r1, #0x10000
+2: subs r1, r1, #1
+ bne 2b
+
+ ldr r1, =CLK_SRC_TOP0_VAL
+ ldr r2, =CLK_SRC_TOP0_OFFSET
+ str r1, [r0, r2]
+
+ ldr r1, =CLK_SRC_TOP1_VAL
+ ldr r2, =CLK_SRC_TOP1_OFFSET
+ str r1, [r0, r2]
+
+ /* DMC */
+ ldr r1, =CLK_SRC_DMC_VAL
+ ldr r2, =CLK_SRC_DMC_OFFSET
+ str r1, [r0, r2]
+
+ /*CLK_SRC_LEFTBUS */
+ ldr r1, =CLK_SRC_LEFTBUS_VAL
+ ldr r2, =CLK_SRC_LEFTBUS_OFFSET
+ str r1, [r0, r2]
+
+ /*CLK_SRC_RIGHTBUS */
+ ldr r1, =CLK_SRC_RIGHTBUS_VAL
+ ldr r2, =CLK_SRC_RIGHTBUS_OFFSET
+ str r1, [r0, r2]
+
+ /* SATA: SCLKMPLL(0), MMC[0:4]: SCLKMPLL(6) */
+ ldr r1, =CLK_SRC_FSYS_VAL
+ ldr r2, =CLK_SRC_FSYS_OFFSET
+ str r1, [r0, r2]
+
+ /* UART[0:4] */
+ ldr r1, =CLK_SRC_PERIL0_VAL
+ ldr r2, =CLK_SRC_PERIL0_OFFSET
+ str r1, [r0, r2]
+
+ /* FIMD0 */
+ ldr r1, =CLK_SRC_LCD0_VAL
+ ldr r2, =CLK_SRC_LCD0_OFFSET
+ str r1, [r0, r2]
+
+ /* wait ?us */
+ mov r1, #0x10000
+3: subs r1, r1, #1
+ bne 3b
+
+ /* CLK_DIV_CPU0 */
+ ldr r1, =CLK_DIV_CPU0_VAL
+ ldr r2, =CLK_DIV_CPU0_OFFSET
+ str r1, [r0, r2]
+
+ /* CLK_DIV_CPU1 */
+ ldr r1, =CLK_DIV_CPU1_VAL
+ ldr r2, =CLK_DIV_CPU1_OFFSET
+ str r1, [r0, r2]
+
+ /* CLK_DIV_DMC0 */
+ ldr r1, =CLK_DIV_DMC0_VAL
+ ldr r2, =CLK_DIV_DMC0_OFFSET
+ str r1, [r0, r2]
+
+ /*CLK_DIV_DMC1 */
+ ldr r1, =CLK_DIV_DMC1_VAL
+ ldr r2, =CLK_DIV_DMC1_OFFSET
+ str r1, [r0, r2]
+
+ /* CLK_DIV_LEFTBUS */
+ ldr r1, =CLK_DIV_LEFTBUS_VAL
+ ldr r2, =CLK_DIV_LEFTBUS_OFFSET
+ str r1, [r0, r2]
+
+ /* CLK_DIV_RIGHTBUS */
+ ldr r1, =CLK_DIV_RIGHTBUS_VAL
+ ldr r2, =CLK_DIV_RIGHTBUS_OFFSET
+ str r1, [r0, r2]
+
+ /* CLK_DIV_TOP */
+ ldr r1, =CLK_DIV_TOP_VAL
+ ldr r2, =CLK_DIV_TOP_OFFSET
+ str r1, [r0, r2]
+
+ /* MMC[0:1] */
+ ldr r1, =CLK_DIV_FSYS1_VAL /* 800(MPLL) / (15 + 1) */
+ ldr r2, =CLK_DIV_FSYS1_OFFSET
+ str r1, [r0, r2]
+
+ /* MMC[2:3] */
+ ldr r1, =CLK_DIV_FSYS2_VAL /* 800(MPLL) / (15 + 1) */
+ ldr r2, =CLK_DIV_FSYS2_OFFSET
+ str r1, [r0, r2]
+
+ /* MMC4 */
+ ldr r1, =CLK_DIV_FSYS3_VAL /* 800(MPLL) / (15 + 1) */
+ ldr r2, =CLK_DIV_FSYS3_OFFSET
+ str r1, [r0, r2]
+
+ /* CLK_DIV_PERIL0: UART Clock Divisors */
+ ldr r1, =CLK_DIV_PERIL0_VAL
+ ldr r2, =CLK_DIV_PERIL0_OFFSET
+ str r1, [r0, r2]
+
+ /* Set PLL locktime */
+ ldr r1, =PLL_LOCKTIME
+ ldr r2, =APLL_LOCK_OFFSET
+ str r1, [r0, r2]
+
+ ldr r1, =PLL_LOCKTIME
+ ldr r2, =MPLL_LOCK_OFFSET
+ str r1, [r0, r2]
+
+ ldr r1, =PLL_LOCKTIME
+ ldr r2, =EPLL_LOCK_OFFSET
+ str r1, [r0, r2]
+
+ ldr r1, =PLL_LOCKTIME
+ ldr r2, =VPLL_LOCK_OFFSET
+ str r1, [r0, r2]
+
+ /* APLL_CON1 */
+ ldr r1, =APLL_CON1_VAL
+ ldr r2, =APLL_CON1_OFFSET
+ str r1, [r0, r2]
+
+ /* APLL_CON0 */
+ ldr r1, =APLL_CON0_VAL
+ ldr r2, =APLL_CON0_OFFSET
+ str r1, [r0, r2]
+
+ /* MPLL_CON1 */
+ ldr r1, =MPLL_CON1_VAL
+ ldr r2, =MPLL_CON1_OFFSET
+ str r1, [r0, r2]
+
+ /* MPLL_CON0 */
+ ldr r1, =MPLL_CON0_VAL
+ ldr r2, =MPLL_CON0_OFFSET
+ str r1, [r0, r2]
+
+ /* EPLL */
+ ldr r1, =EPLL_CON1_VAL
+ ldr r2, =EPLL_CON1_OFFSET
+ str r1, [r0, r2]
+
+ /* EPLL_CON0 */
+ ldr r1, =EPLL_CON0_VAL
+ ldr r2, =EPLL_CON0_OFFSET
+ str r1, [r0, r2]
+
+ /* VPLL_CON1 */
+ ldr r1, =VPLL_CON1_VAL
+ ldr r2, =VPLL_CON1_OFFSET
+ str r1, [r0, r2]
+
+ /* VPLL_CON0 */
+ ldr r1, =VPLL_CON0_VAL
+ ldr r2, =VPLL_CON0_OFFSET
+ str r1, [r0, r2]
+
+ /* wait ?us */
+ mov r1, #0x30000
+4: subs r1, r1, #1
+ bne 4b
+
+ pop {pc}
+/*
+ * uart_asm_init: Initialize UART in asm mode, 115200bps fixed.
+ * void uart_asm_init(void)
+ */
+ .globl uart_asm_init
+uart_asm_init:
+
+ /* setup UART0-UART3 GPIOs (part1) */
+ mov r0, r7
+ ldr r1, =EXYNOS4_GPIO_A0_CON_VAL
+ str r1, [r0, #EXYNOS4_GPIO_A0_CON_OFFSET]
+ ldr r1, =EXYNOS4_GPIO_A1_CON_VAL
+ str r1, [r0, #EXYNOS4_GPIO_A1_CON_OFFSET]
+
+ ldr r0, =EXYNOS4_UART_BASE
+ add r0, r0, #EXYNOS4_DEFAULT_UART_OFFSET
+
+ ldr r1, =ULCON_VAL
+ str r1, [r0, #ULCON_OFFSET]
+ ldr r1, =UCON_VAL
+ str r1, [r0, #UCON_OFFSET]
+ ldr r1, =UFCON_VAL
+ str r1, [r0, #UFCON_OFFSET]
+ ldr r1, =UBRDIV_VAL
+ str r1, [r0, #UBRDIV_OFFSET]
+ ldr r1, =UFRACVAL_VAL
+ str r1, [r0, #UFRACVAL_OFFSET]
+ mov pc, lr
+ nop
+ nop
+ nop
+
+/* Setting TZPC[TrustZone Protection Controller] */
+tzpc_init:
+ ldr r0, =TZPC0_BASE
+ mov r1, #R0SIZE
+ str r1, [r0]
+ mov r1, #DECPROTXSET
+ str r1, [r0, #TZPC_DECPROT0SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT1SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT2SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT3SET_OFFSET]
+
+ ldr r0, =TZPC1_BASE
+ str r1, [r0, #TZPC_DECPROT0SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT1SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT2SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT3SET_OFFSET]
+
+ ldr r0, =TZPC2_BASE
+ str r1, [r0, #TZPC_DECPROT0SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT1SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT2SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT3SET_OFFSET]
+
+ ldr r0, =TZPC3_BASE
+ str r1, [r0, #TZPC_DECPROT0SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT1SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT2SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT3SET_OFFSET]
+
+ ldr r0, =TZPC4_BASE
+ str r1, [r0, #TZPC_DECPROT0SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT1SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT2SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT3SET_OFFSET]
+
+ ldr r0, =TZPC5_BASE
+ str r1, [r0, #TZPC_DECPROT0SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT1SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT2SET_OFFSET]
+ str r1, [r0, #TZPC_DECPROT3SET_OFFSET]
+
+ mov pc, lr
diff --git a/board/samsung/galaxys2/mem_setup.S b/board/samsung/galaxys2/mem_setup.S
new file mode 100644
index 000000000..d9a3800a6
--- /dev/null
+++ b/board/samsung/galaxys2/mem_setup.S
@@ -0,0 +1,365 @@
+/*
+ * Memory setup for GALAXYS2 board based on EXYNOS4210
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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>
+
+#define SET_MIU
+
+#define MEM_DLL
+
+#ifdef CONFIG_CLK_800_330_165
+#define DRAM_CLK_330
+#endif
+#ifdef CONFIG_CLK_1000_200_200
+#define DRAM_CLK_200
+#endif
+#ifdef CONFIG_CLK_1000_330_165
+#define DRAM_CLK_330
+#endif
+#ifdef CONFIG_CLK_1000_400_200
+#define DRAM_CLK_400
+#endif
+
+ .globl mem_ctrl_asm_init
+mem_ctrl_asm_init:
+
+ /*
+ * Async bridge configuration at CPU_core:
+ * 1: half_sync
+ * 0: full_sync
+ */
+ ldr r0, =0x10010350
+ mov r1, #1
+ str r1, [r0]
+
+#ifdef SET_MIU
+ ldr r0, =EXYNOS4_MIU_BASE @0x10600000
+#ifdef CONFIG_MIU_1BIT_INTERLEAVED
+ ldr r1, =0x0000000c
+ str r1, [r0, #0x400] @MIU_INTLV_CONFIG
+ ldr r1, =0x40000000
+ str r1, [r0, #0x808] @MIU_INTLV_START_ADDR
+ ldr r1, =0xbfffffff
+ str r1, [r0, #0x810] @MIU_INTLV_END_ADDR
+ ldr r1, =0x00000001
+ str r1, [r0, #0x800] @MIU_MAPPING_UPDATE
+#endif
+#ifdef CONFIG_MIU_2BIT_INTERLEAVED
+ ldr r1, =0x2000150c
+ str r1, [r0, #0x400] @MIU_INTLV_CONFIG
+ ldr r1, =0x40000000
+ str r1, [r0, #0x808] @MIU_INTLV_START_ADDR
+ ldr r1, =0xbfffffff
+ str r1, [r0, #0x810] @MIU_INTLV_END_ADDR
+ ldr r1, =0x00000001
+ str r1, [r0, #0x800] @MIU_MAPPING_UPDATE
+#endif
+#ifdef CONFIG_MIU_LINEAR
+ ldr r1, =0x40000000
+ str r1, [r0, #0x818] @MIU_SINGLE_MAPPING0_START_ADDR
+ ldr r1, =0x7fffffff
+ str r1, [r0, #0x820] @MIU_SINGLE_MAPPING0_END_ADDR
+ ldr r1, =0x80000000
+ str r1, [r0, #0x828] @MIU_SINGLE_MAPPING1_START_ADDR
+ ldr r1, =0xbfffffff
+ str r1, [r0, #0x830] @MIU_SINGLE_MAPPING1_END_ADDR]
+ ldr r1, =0x00000006
+ str r1, [r0, #0x800] @MIU_MAPPING_UPDATE
+#endif
+#endif
+ /* DREX0 */
+ ldr r0, =EXYNOS4_DMC0_BASE @0x10400000
+
+ ldr r1, =0xe0000086
+ str r1, [r0, #0x1C] @DMC_PHYCONTROL1
+
+ ldr r1, =0xE3855703
+ str r1, [r0, #0x44] @DMC_PHYZQCONTROL
+
+ mov r2, #0x100000
+1: subs r2, r2, #1
+ bne 1b
+
+ ldr r1, =0xe000008e
+ str r1, [r0, #0x1C] @DMC_PHYCONTROL1
+ ldr r1, =0xe0000086
+ str r1, [r0, #0x1C] @DMC_PHYCONTROL1
+
+ ldr r1, =0x71101008
+ str r1, [r0, #0x18] @DMC_PHYCONTROL0
+ ldr r1, =0x7110100A
+ str r1, [r0, #0x18] @DMC_PHYCONTROL0
+ ldr r1, =0xe0000086
+ str r1, [r0, #0x1C] @DMC_PHYCONTROL1
+ ldr r1, =0x7110100B
+ str r1, [r0, #0x18] @DMC_PHYCONTROL0
+
+ ldr r1, =0x00000000
+ str r1, [r0, #0x20] @DMC_PHYCONTROL2
+
+ ldr r1, =0x0FFF301a
+ str r1, [r0, #0x00] @DMC_CONCONTROL
+ ldr r1, =0x00312640
+ str r1, [r0, #0x04] @DMC_MEMCONTROL]
+
+#ifdef CONFIG_MIU_LINEAR
+ ldr r1, =0x40e01323
+ str r1, [r0, #0x08] @DMC_MEMCONFIG0
+ ldr r1, =0x60e01323
+ str r1, [r0, #0x0C] @DMC_MEMCONFIG1
+#else /* @MIU_1BIT_INTERLEAVED | MIU_2BIT_INTERLEAVED */
+ ldr r1, =0x20e01323
+ str r1, [r0, #0x08] @DMC_MEMCONFIG0
+ ldr r1, =0x40e01323
+ str r1, [r0, #0x0C] @DMC_MEMCONFIG1
+#endif
+
+ ldr r1, =0xff000000
+ str r1, [r0, #0x14] @DMC_PRECHCONFIG
+
+ ldr r1, =0x000000BC
+ str r1, [r0, #0x30] @DMC_TIMINGAREF
+
+#ifdef DRAM_CLK_330
+ ldr r1, =0x3545548d
+ str r1, [r0, #0x34] @DMC_TIMINGROW
+ ldr r1, =0x45430506
+ str r1, [r0, #0x38] @DMC_TIMINGDATA
+ ldr r1, =0x4439033c
+ str r1, [r0, #0x3C] @DMC_TIMINGPOWER
+#endif
+#ifdef DRAM_CLK_400
+ ldr r1, =0x4046654f
+ str r1, [r0, #0x34] @DMC_TIMINGROW
+ ldr r1, =0x56500506
+ str r1, [r0, #0x38] @DMC_TIMINGDATA
+ ldr r1, =0x5444033d
+ str r1, [r0, #0x3C] @DMC_TIMINGPOWER
+#endif
+ ldr r1, =0x07000000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+
+ mov r2, #0x100000
+2: subs r2, r2, #1
+ bne 2b
+
+ ldr r1, =0x00020000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+ ldr r1, =0x00030000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+ ldr r1, =0x00010002
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+ ldr r1, =0x00000328
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+
+ mov r2, #0x100000
+3: subs r2, r2, #1
+ bne 3b
+
+ ldr r1, =0x0a000000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+
+ mov r2, #0x100000
+4: subs r2, r2, #1
+ bne 4b
+
+ ldr r1, =0x07100000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+
+ mov r2, #0x100000
+5: subs r2, r2, #1
+ bne 5b
+
+ ldr r1, =0x00120000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+ ldr r1, =0x00130000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+ ldr r1, =0x00110002
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+ ldr r1, =0x00100328
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+
+ mov r2, #0x100000
+6: subs r2, r2, #1
+ bne 6b
+
+ ldr r1, =0x0a100000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+
+ mov r2, #0x100000
+7: subs r2, r2, #1
+ bne 7b
+
+ ldr r1, =0xe000008e
+ str r1, [r0, #0x1C] @DMC_PHYCONTROL1
+ ldr r1, =0xe0000086
+ str r1, [r0, #0x1C] @DMC_PHYCONTROL1
+
+ mov r2, #0x100000
+8: subs r2, r2, #1
+ bne 8b
+
+ /* DREX1 */
+ ldr r0, =EXYNOS4_DMC1_BASE @0x10410000
+
+ ldr r1, =0xe0000086
+ str r1, [r0, #0x1C] @DMC_PHYCONTROL1
+
+ ldr r1, =0xE3855703
+ str r1, [r0, #0x44] @DMC_PHYZQCONTROL
+
+ mov r2, #0x100000
+1: subs r2, r2, #1
+ bne 1b
+
+ ldr r1, =0xe000008e
+ str r1, [r0, #0x1C] @DMC_PHYCONTROL1
+ ldr r1, =0xe0000086
+ str r1, [r0, #0x1C] @DMC_PHYCONTROL1
+
+ ldr r1, =0x71101008
+ str r1, [r0, #0x18] @DMC_PHYCONTROL0
+ ldr r1, =0x7110100A
+ str r1, [r0, #0x18] @DMC_PHYCONTROL0
+ ldr r1, =0xe0000086
+ str r1, [r0, #0x1C] @DMC_PHYCONTROL1
+ ldr r1, =0x7110100B
+ str r1, [r0, #0x18] @DMC_PHYCONTROL0
+
+ ldr r1, =0x00000000
+ str r1, [r0, #0x20] @DMC_PHYCONTROL2
+
+ ldr r1, =0x0FFF301a
+ str r1, [r0, #0x00] @DMC_CONCONTROL
+ ldr r1, =0x00312640
+ str r1, [r0, #0x04] @DMC_MEMCONTROL]
+
+#ifdef CONFIG_MIU_LINEAR
+ ldr r1, =0x40e01323
+ str r1, [r0, #0x08] @DMC_MEMCONFIG0
+ ldr r1, =0x60e01323
+ str r1, [r0, #0x0C] @DMC_MEMCONFIG1
+#else /* @MIU_1BIT_INTERLEAVED | MIU_2BIT_INTERLEAVED */
+ ldr r1, =0x20e01323
+ str r1, [r0, #0x08] @DMC_MEMCONFIG0
+ ldr r1, =0x40e01323
+ str r1, [r0, #0x0C] @DMC_MEMCONFIG1
+#endif
+
+ ldr r1, =0xff000000
+ str r1, [r0, #0x14] @DMC_PRECHCONFIG
+
+ ldr r1, =0x000000BC
+ str r1, [r0, #0x30] @DMC_TIMINGAREF
+
+#ifdef DRAM_CLK_330
+ ldr r1, =0x3545548d
+ str r1, [r0, #0x34] @DMC_TIMINGROW
+ ldr r1, =0x45430506
+ str r1, [r0, #0x38] @DMC_TIMINGDATA
+ ldr r1, =0x4439033c
+ str r1, [r0, #0x3C] @DMC_TIMINGPOWER
+#endif
+#ifdef DRAM_CLK_400
+ ldr r1, =0x4046654f
+ str r1, [r0, #0x34] @DMC_TIMINGROW
+ ldr r1, =0x56500506
+ str r1, [r0, #0x38] @DMC_TIMINGDATA
+ ldr r1, =0x5444033d
+ str r1, [r0, #0x3C] @DMC_TIMINGPOWER
+#endif
+
+ ldr r1, =0x07000000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+
+ mov r2, #0x100000
+2: subs r2, r2, #1
+ bne 2b
+
+ ldr r1, =0x00020000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+ ldr r1, =0x00030000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+ ldr r1, =0x00010002
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+ ldr r1, =0x00000328
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+
+ mov r2, #0x100000
+3: subs r2, r2, #1
+ bne 3b
+
+ ldr r1, =0x0a000000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+
+ mov r2, #0x100000
+4: subs r2, r2, #1
+ bne 4b
+
+ ldr r1, =0x07100000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+
+ mov r2, #0x100000
+5: subs r2, r2, #1
+ bne 5b
+
+ ldr r1, =0x00120000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+ ldr r1, =0x00130000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+ ldr r1, =0x00110002
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+ ldr r1, =0x00100328
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+
+ mov r2, #0x100000
+6: subs r2, r2, #1
+ bne 6b
+
+ ldr r1, =0x0a100000
+ str r1, [r0, #0x10] @DMC_DIRECTCMD
+
+ mov r2, #0x100000
+7: subs r2, r2, #1
+ bne 7b
+
+ ldr r1, =0xe000008e
+ str r1, [r0, #0x1C] @DMC_PHYCONTROL1
+ ldr r1, =0xe0000086
+ str r1, [r0, #0x1C] @DMC_PHYCONTROL1
+
+ mov r2, #0x100000
+8: subs r2, r2, #1
+ bne 8b
+
+ /* turn on DREX0, DREX1 */
+ ldr r0, =0x10400000 @APB_DMC_0_BASE
+ ldr r1, =0x0FFF303a
+ str r1, [r0, #0x00] @DMC_CONCONTROL
+
+ ldr r0, =0x10410000 @APB_DMC_1_BASE
+ ldr r1, =0x0FFF303a
+ str r1, [r0, #0x00] @DMC_CONCONTROL
+
+ mov pc, lr
diff --git a/boards.cfg b/boards.cfg
index 3cf75c315..34c293fa8 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -298,6 +298,7 @@
omap4_sdp4430 arm armv7 sdp4430 ti omap4
omap5_uevm arm armv7 omap5_uevm ti omap5
dra7xx_evm arm armv7 dra7xx ti omap5
+galaxys2 arm armv7 galaxys2 samsung exynos
s5p_goni arm armv7 goni samsung s5pc1xx
smdkc100 arm armv7 smdkc100 samsung s5pc1xx
origen arm armv7 origen samsung exynos
diff --git a/common/cmd_gpio.c b/common/cmd_gpio.c
index 47eee8922..86e5a7b06 100644
--- a/common/cmd_gpio.c
+++ b/common/cmd_gpio.c
@@ -16,10 +16,10 @@
#endif
enum gpio_cmd {
- GPIO_INPUT,
- GPIO_SET,
- GPIO_CLEAR,
- GPIO_TOGGLE,
+ CMD_GPIO_INPUT,
+ CMD_GPIO_SET,
+ CMD_GPIO_CLEAR,
+ CMD_GPIO_TOGGLE,
};
static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -44,10 +44,10 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* parse the behavior */
switch (*str_cmd) {
- case 'i': sub_cmd = GPIO_INPUT; break;
- case 's': sub_cmd = GPIO_SET; break;
- case 'c': sub_cmd = GPIO_CLEAR; break;
- case 't': sub_cmd = GPIO_TOGGLE; break;
+ case 'i': sub_cmd = CMD_GPIO_INPUT; break;
+ case 's': sub_cmd = CMD_GPIO_SET; break;
+ case 'c': sub_cmd = CMD_GPIO_CLEAR; break;
+ case 't': sub_cmd = CMD_GPIO_TOGGLE; break;
default: goto show_usage;
}
@@ -63,14 +63,14 @@ static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
/* finally, let's do it: set direction and exec command */
- if (sub_cmd == GPIO_INPUT) {
+ if (sub_cmd == CMD_GPIO_INPUT) {
gpio_direction_input(gpio);
value = gpio_get_value(gpio);
} else {
switch (sub_cmd) {
- case GPIO_SET: value = 1; break;
- case GPIO_CLEAR: value = 0; break;
- case GPIO_TOGGLE: value = !gpio_get_value(gpio); break;
+ case CMD_GPIO_SET: value = 1; break;
+ case CMD_GPIO_CLEAR: value = 0; break;
+ case CMD_GPIO_TOGGLE: value = !gpio_get_value(gpio); break;
default: goto show_usage;
}
gpio_direction_output(gpio, value);
diff --git a/include/configs/galaxys2.h b/include/configs/galaxys2.h
new file mode 100644
index 000000000..2d09c584a
--- /dev/null
+++ b/include/configs/galaxys2.h
@@ -0,0 +1,262 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * Configuration settings for the SAMSUNG GALAXYS2 (EXYNOS4210) board.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/* High Level Configuration Options */
+#define CONFIG_SAMSUNG 1 /* SAMSUNG core */
+#define CONFIG_S5P 1 /* S5P Family */
+#define CONFIG_EXYNOS4210 1 /* which is a EXYNOS4210 SoC */
+#define CONFIG_GALAXYS2 1 /* working with GALAXYS2*/
+
+#include <asm/arch/cpu.h> /* get chip and board defs */
+
+#define CONFIG_ARCH_CPU_INIT
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO_LATE
+
+/* Keep L2 Cache Disabled */
+#define CONFIG_SYS_L2CACHE_OFF 1
+#define CONFIG_SYS_DCACHE_OFF 1
+
+#define CONFIG_SYS_SDRAM_BASE 0x40000000
+#define CONFIG_SYS_TEXT_BASE 0x40008000
+
+/* input clock of PLL: GALAXYS2 has 24MHz input clock */
+#define CONFIG_SYS_CLK_FREQ 24000000
+
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_INITRD_TAG
+#define CONFIG_CMDLINE_EDITING
+#define CONFIG_SKIP_LOWLEVEL_INIT
+
+#define CONFIG_VIDEO
+#define CONFIG_CFB_CONSOLE
+#define CONFIG_VGA_AS_SINGLE_DEVICE
+
+#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial\0" \
+ "stdout=serial,lcd\0" \
+ "stderr=serial,lcd\0"
+
+//#define CONFIG_MACH_TYPE MACH_TYPE_GALAXYS2
+#define CONFIG_MACH_TYPE 2838
+
+/* Power Down Modes */
+#define S5P_CHECK_SLEEP 0x00000BAD
+#define S5P_CHECK_DIDLE 0xBAD00000
+#define S5P_CHECK_LPA 0xABAD0000
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (1 << 20))
+
+/* select serial console configuration */
+#define CONFIG_SERIAL_MULTI 1
+#define CONFIG_SERIAL2 1 /* use SERIAL 2 */
+#define CONFIG_BAUDRATE 115200
+#define EXYNOS4_DEFAULT_UART_OFFSET 0x020000
+
+/* SD/MMC configuration */
+#define CONFIG_GENERIC_MMC 1
+#define CONFIG_MMC 1
+#define CONFIG_S5P_MMC 1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+
+/* Command definition*/
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_NFS
+
+#define CONFIG_DOS_PARTITION 1
+#define CONFIG_EFI_PARTITION 1
+
+#define CONFIG_BOOTDELAY 1
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+#define CONFIG_BOOTCOMMAND "run galaxy_boot"
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+ \
+ "kernel_name=/boot/vmlinux.uimg\0"\
+ "script_img=/boot/boot.scr.uimg\0"\
+ \
+ "run_disk_boot_script=" \
+ "if fatload $devtype} ${devnum}:${script_part} " \
+ "${loadaddr} ${script_img}; then " \
+ "source ${loadaddr}; " \
+ "elif ext2load ${devtype} ${devnum}:${script_part} " \
+ "${loadaddr} ${script_img}; then " \
+ "source ${loadaddr}; " \
+ "fi\0" \
+ \
+ "real_boot="\
+ "setenv bootargs "\
+ "${dev_extras} root=/dev/${devname}${rootpart} rootwait ro ;"\
+ "echo Load Address:${loadaddr};" \
+ "echo Cmdline:${bootargs}; " \
+ "if fatload ${devtype} ${devnum}:${kernel_part} " \
+ "${loadaddr} ${kernel_name}; then " \
+ "bootm ${loadaddr}; " \
+ "elif ext2load ${devtype} ${devnum}:${kernel_part} " \
+ "${loadaddr} ${kernel_name}; then " \
+ "bootm ${loadaddr};" \
+ "fi\0" \
+ \
+ "mmc_boot=mmc rescan; " \
+ "setenv devtype mmc; " \
+ "setenv devname mmcblk${devnum}p; " \
+ "mmc dev ${devnum}; " \
+ "run run_disk_boot_script; " \
+ "run real_boot\0" \
+ \
+ "boot_custom_emmc=setenv devnum 0; " \
+ "echo Booting from EMMC; "\
+ "setenv script_part 0xb; " \
+ "setenv kernel_part 0xb; " \
+ "setenv rootpart 0xb; " \
+ "run mmc_boot\0" \
+ \
+ "boot_android=" \
+ "setenv android_cmd loglevel=4 console=ram sec_debug.enable=0 " \
+ "sec_debug.enable_user=0 sec_log=0x100000@0x4d900000 " \
+ "s3cfb.bootloaderfb=0x5ec00000 ld9040.get_lcdtype=0x2 " \
+ "consoleblank=0 lpj=3981312 vmalloc=144m ;" \
+ "if test $sgs2_bootmode_val -eq 1; then "\
+ "setenv android_cmd ${android_cmd} bootmode=2; " \
+ "fi ;" \
+ "mmc dev 0; " \
+ "mmc read ${loadaddr} 0x16000 0x4000; " \
+ "setenv bootargs ${android_cmd}; "\
+ "echo Command Line: ${bootargs}; " \
+ "bootm ${loadaddr}\0" \
+ \
+ "galaxy_boot=" \
+ /*"setenv verify n; "*/ \
+ "setenv loadaddr 0x4EE08000; " \
+ "setenv dev_extras console=tty0 --no-log lpj=3981312; " \
+ "mmc rescan; " \
+ "sgs2_get_bootmode; " \
+ "echo [SGS2:bootmode] $sgs2_bootmode_val; " \
+ "if test $sgs2_bootmode_val -lt 2; then " \
+ "echo Regular boot; " \
+ "run boot_android; " \
+ "else; " \
+ "echo Custom boot from emmc; "\
+ "run boot_custom_emmc; " \
+ "fi; " \
+ "echo Failed to boot\0"
+
+/* Miscellaneous configurable options */
+#define CONFIG_SYS_LONGHELP /* undef to save memory */
+#define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */
+#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
+#define CONFIG_SYS_PROMPT "GALAXYS2 # "
+#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size*/
+#define CONFIG_SYS_PBSIZE 384 /* Print Buffer Size */
+#define CONFIG_SYS_MAXARGS 16 /* max number of command args */
+//#define CONFIG_DEFAULT_CONSOLE "console=ttySAC2,115200n8\0"
+#define CONFIG_DEFAULT_CONSOLE "console=tty0\0"
+
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
+/* memtest works on */
+#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
+#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_SDRAM_BASE + 0x6000000)
+#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 0xEE00000)
+
+#define CONFIG_SYS_HZ 1000
+
+/* valid baudrates */
+#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
+
+/* Stack sizes */
+#define CONFIG_STACKSIZE (256 << 10) /* 256KB */
+
+/* GALAXYS2 has 4 bank of DRAM */
+#define CONFIG_NR_DRAM_BANKS 4
+#define SDRAM_BANK_SIZE (256UL << 20UL) /* 256 MB */
+#define PHYS_SDRAM_1 CONFIG_SYS_SDRAM_BASE
+#define PHYS_SDRAM_1_SIZE SDRAM_BANK_SIZE
+#define PHYS_SDRAM_2 (CONFIG_SYS_SDRAM_BASE + SDRAM_BANK_SIZE)
+#define PHYS_SDRAM_2_SIZE SDRAM_BANK_SIZE
+#define PHYS_SDRAM_3 (CONFIG_SYS_SDRAM_BASE + (2 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_3_SIZE SDRAM_BANK_SIZE
+#define PHYS_SDRAM_4 (CONFIG_SYS_SDRAM_BASE + (3 * SDRAM_BANK_SIZE))
+#define PHYS_SDRAM_4_SIZE SDRAM_BANK_SIZE
+
+/* FLASH and environment organization */
+#define CONFIG_SYS_NO_FLASH 1
+#undef CONFIG_CMD_IMLS
+#define CONFIG_IDENT_STRING " for GALAXYS2"
+
+#ifdef CONFIG_USE_IRQ
+#define CONFIG_STACKSIZE_IRQ (4*1024) /* IRQ stack */
+#define CONFIG_STACKSIZE_FIQ (4*1024) /* FIQ stack */
+#endif
+
+#define CONFIG_CLK_1000_400_200
+
+/* MIU (Memory Interleaving Unit) */
+#define CONFIG_MIU_2BIT_21_7_INTERLEAVED
+
+#define CONFIG_ENV_IS_NOWHERE
+#define CONFIG_ENV_SIZE (16 << 10) /* 16 KB */
+
+#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_LOAD_ADDR - GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_CACHELINE_SIZE 32
+
+/* U-boot copy size from boot Media to DRAM.*/
+#define COPY_BL2_SIZE 0x80000
+#define BL2_START_OFFSET ((CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)/512)
+#define BL2_SIZE_BLOC_COUNT (COPY_BL2_SIZE/512)
+
+/* Enable devicetree support */
+#define CONFIG_OF_LIBFDT
+
+#define CONFIG_SOFT_I2C_GPIO_SCL exynos4_gpio_part1_get_nr(b, 7)
+#define CONFIG_SOFT_I2C_GPIO_SDA exynos4_gpio_part1_get_nr(b, 6)
+
+#define CONFIG_SOFT_I2C
+#define CONFIG_SOFT_I2C_READ_REPEATED_START
+#define CONFIG_SYS_I2C_SPEED 50000
+#define CONFIG_I2C_MULTI_BUS
+#define CONFIG_SYS_MAX_I2C_BUS 7
+
+#define CONFIG_POWER
+#define CONFIG_POWER_I2C
+#define CONFIG_POWER_MAX8997
+
+#define CONFIG_USB_GADGET
+#define CONFIG_USB_GADGET_S3C_UDC_OTG
+#define CONFIG_USB_GADGET_DUALSPEED
+
+#define CONFIG_PWM 1 //for the S5P timer
+
+#endif /* __CONFIG_H */