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
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
|
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -177,6 +177,11 @@ config NEED_RET_TO_USER
config ARCH_MTD_XIP
bool
+config ARM_L1_CACHE_SHIFT_4
+ bool
+ help
+ Setting ARM L1 cache line size to 16 bytes.
+
config VECTORS_BASE
hex
default 0xffff0000 if MMU || CPU_HIGH_VECTOR
@@ -380,6 +385,15 @@ config ARCH_HIGHBANK
help
Support for the Calxeda Highbank SoC based boards.
+config ARCH_CNS21XX
+ bool "Cavium Networks CNS21xx family"
+ select CPU_FA526
+ select PLAT_FA
+ select PLAT_FA_TIME
+ select ARM_L1_CACHE_SHIFT_4
+ help
+ Support for Cavium Networks CNS21xx family.
+
config ARCH_CLPS711X
bool "Cirrus Logic CLPS711x/EP721x/EP731x-based"
select CPU_ARM720T
@@ -1042,6 +1056,8 @@ source "arch/arm/mach-davinci/Kconfig"
source "arch/arm/mach-dove/Kconfig"
+source "arch/arm/mach-cns21xx/Kconfig"
+
source "arch/arm/mach-ep93xx/Kconfig"
source "arch/arm/mach-footbridge/Kconfig"
--- /dev/null
+++ b/arch/arm/mach-cns21xx/Kconfig
@@ -0,0 +1,6 @@
+if ARCH_CNS21XX
+
+menu "Cavium Networks CNS21xx based machines"
+endmenu
+
+endif
--- /dev/null
+++ b/arch/arm/mach-cns21xx/Makefile
@@ -0,0 +1,10 @@
+#
+# Makefile for the linux kernel.
+#
+
+# Object file lists.
+
+obj-y := core.o irq.o mm.o time.o
+
+# machine specific files
+
--- /dev/null
+++ b/arch/arm/mach-cns21xx/Makefile.boot
@@ -0,0 +1,3 @@
+ zreladdr-y += 0x00008000
+params_phys-y := 0x00000100
+initrd_phys-y := 0x00C00000
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -137,6 +137,7 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x0020
# by CONFIG_* macro name.
machine-$(CONFIG_ARCH_AT91) := at91
machine-$(CONFIG_ARCH_BCMRING) := bcmring
+machine-$(CONFIG_ARCH_CNS21XX) := cns21xx
machine-$(CONFIG_ARCH_CLPS711X) := clps711x
machine-$(CONFIG_ARCH_CNS3XXX) := cns3xxx
machine-$(CONFIG_ARCH_DAVINCI) := davinci
--- /dev/null
+++ b/arch/arm/mach-cns21xx/common.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2008 Cavium Networks
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _MACH_CNS21XX_COMMON_H
+#define _MACH_CNS21XX_COMMON_H
+
+void cns21xx_restart(char mode, const char *cmd);
+void cns21xx_map_io(void);
+void cns21xx_init_irq(void);
+
+extern struct sys_timer cns21xx_timer;
+
+#endif /* _MACH_CNS21XX_COMMON_H */
--- /dev/null
+++ b/arch/arm/mach-cns21xx/mm.c
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2008 Cavium Networks
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/mm.h>
+#include <linux/init.h>
+
+#include <asm/mach/map.h>
+
+#include <mach/hardware.h>
+#include <mach/cns21xx.h>
+
+#include "common.h"
+
+/*
+ * Standard IO mapping
+ */
+static struct map_desc cns21xx_io_desc[] __initdata = {
+ {
+ .virtual = CNS21XX_FLASH_BANK0_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_FLASH_BANK0_BASE),
+ .length = SZ_256M,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_IDE_DEVICE_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_IDE_DEVICE_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_GDMAC_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_GDMAC_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_NIC_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_NIC_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_SPI_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_SPI_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_PCM_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_PCM_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_I2C_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_I2C_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_I2S_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_I2S_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_DDRC_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_DDRC_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_SMC_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_SMC_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_IDE_CTRL_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_IDE_CTRL_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_MISC_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_MISC_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_CPM_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_CPM_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_UART0_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_UART0_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_UART1_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_UART1_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_TIMER_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_TIMER_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_WDT_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_WDT_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_RTC_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_RTC_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_GPIOA_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_GPIOA_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_GPIOB_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_GPIOB_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_PCI_CFGDATA_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_PCI_CFGDATA_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_PCI_CFGADDR_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_PCI_CFGADDR_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_OHCI_CONFIG_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_OHCI_CONFIG_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_OHCI_CTRL_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_OHCI_CTRL_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_EHCI_CONFIG_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_EHCI_CONFIG_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_EHCI_CTRL_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_EHCI_CTRL_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_USB_DEVICE_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_USB_DEVICE_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }, {
+ .virtual = CNS21XX_INTC_BASE_VIRT,
+ .pfn = __phys_to_pfn(CNS21XX_INTC_BASE),
+ .length = SZ_4K,
+ .type = MT_DEVICE
+ }
+};
+
+void __init cns21xx_map_io(void)
+{
+ iotable_init(cns21xx_io_desc, ARRAY_SIZE(cns21xx_io_desc));
+}
--- /dev/null
+++ b/arch/arm/mach-cns21xx/include/mach/hardware.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2008 Cavium Networks
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _CNS21XX_HARDWARE_H
+#define _CNS21XX_HARDWARE_H
+
+#ifndef __ASSEMBLY__
+extern unsigned long cns21xx_get_pll_freq(void);
+extern unsigned long cns21xx_get_cpu_freq(void);
+extern unsigned long cns21xx_get_ahb_freq(void);
+extern unsigned long cns21xx_get_apb_freq(void);
+#endif
+
+#endif /* _CNS21XX_HARDWARE_H */
--- /dev/null
+++ b/arch/arm/mach-cns21xx/include/mach/debug-macro.S
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2008 Cavium Networks
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#include <mach/cns21xx.h>
+
+/* TODO: make it configurable */
+#define CNS21XX_DEBUG_UART_BASE CNS21XX_UART0_BASE
+#define CNS21XX_DEBUG_UART_BASE_VIRT CNS21XX_UART0_BASE_VIRT
+
+ .macro addruart, rp, rv
+ mov \rp, #(CNS21XX_DEBUG_UART_BASE) @ physical
+ mov \rv, #(CNS21XX_DEBUG_UART_BASE_VIRT & 0xff000000) @virtual
+ orr \rv, \rv, #(CNS21XX_DEBUG_UART_BASE_VIRT & 0x00ff0000)
+ orr \rv, \rv, #(CNS21XX_DEBUG_UART_BASE_VIRT & 0x0000ff00)
+ orr \rv, \rv, #(CNS21XX_DEBUG_UART_BASE_VIRT & 0x000000ff)
+ .endm
+
+#define UART_SHIFT 2
+#include <asm/hardware/debug-8250.S>
--- /dev/null
+++ b/arch/arm/mach-cns21xx/include/mach/entry-macro.S
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2008 Cavium Networks
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#include <mach/cns21xx.h>
+#include <mach/irqs.h>
+
+#define INTC_IRQ_STATUS 0x1c
+
+ .macro disable_fiq
+ .endm
+
+ .macro get_irqnr_preamble, base, tmp
+ .endm
+
+ .macro arch_ret_to_user, tmp1, tmp2
+ .endm
+
+ .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
+ ldr \base, =(CNS21XX_INTC_BASE_VIRT + INTC_IRQ_STATUS)
+ ldr \irqstat, [\base]
+ mov \irqnr, #0
+9001:
+ tst \irqstat, #1
+ bne 9002f
+ add \irqnr, \irqnr, #1
+ mov \irqstat, \irqstat, lsr #1
+ cmp \irqnr, #CNS21XX_NR_INTC_IRQS
+ bcc 9001b
+9002:
+ .endm
+
+ .macro irq_prio_table
+ .endm
--- /dev/null
+++ b/arch/arm/mach-cns21xx/include/mach/io.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2008 Cavium Networks
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _CNS21XX_IO_H
+#define _CNS21XX_IO_H
+
+#define IO_SPACE_LIMIT 0xffffffff
+
+#define __io(p) __typesafe_io(p)
+#define __mem_pci(a) (a)
+
+#endif /* _CNS21XX_IO_H */
--- /dev/null
+++ b/arch/arm/mach-cns21xx/include/mach/irqs.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2008 Cavium Networks
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _CNS21XX_IRQS_H
+#define _CNS21XX_IRQS_H
+
+#define CNS21XX_IRQ_TIMER1 0
+#define CNS21XX_IRQ_TIMER2 1
+#define CNS21XX_IRQ_CPM 2
+#define CNS21XX_IRQ_WDT 3
+#define CNS21XX_IRQ_GPIO 4
+#define CNS21XX_IRQ_PCI_INTA 5
+#define CNS21XX_IRQ_PCI_INTB 6
+#define CNS21XX_IRQ_PCI_BROKEN 7
+#define CNS21XX_IRQ_AHB2PCI 8
+#define CNS21XX_IRQ_UART0 9
+#define CNS21XX_IRQ_UART1 10
+#define CNS21XX_IRQ_GDMAC_TC 11
+#define CNS21XX_IRQ_GDMAC_ERR 12
+#define CNS21XX_IRQ_PCMCIA 13
+#define CNS21XX_IRQ_RTC 14
+#define CNS21XX_IRQ_PCM 15
+#define CNS21XX_IRQ_USB_DEVICE 16
+#define CNS21XX_IRQ_IDE 17
+#define CNS21XX_IRQ_NIC_STATUS 18
+#define CNS21XX_IRQ_NIC_TXTC 19
+#define CNS21XX_IRQ_NIC_RXRC 20
+#define CNS21XX_IRQ_NIC_TXQE 21
+#define CNS21XX_IRQ_NIC_RXQF 22
+#define CNS21XX_IRQ_OHCI 23
+#define CNS21XX_IRQ_EHCI 24
+#define CNS21XX_IRQ_I2S 25
+#define CNS21XX_IRQ_SPI 26
+#define CNS21XX_IRQ_I2C 27
+#define CNS21XX_IRQ_USB_VBUS 28
+#define CNS21XX_IRQ_EXT_29 29
+#define CNS21XX_IRQ_EXT_30 30
+#define CNS21XX_IRQ_HSDMAC 31
+
+#define CNS21XX_GPIO_IRQ_BASE 32
+
+#define CNS21XX_NR_INTC_IRQS 32
+#define CNS21XX_NR_GPIO_IRQS 64
+
+#define NR_IRQS 96
+
+#endif /* _CNS21XX_IRQS_H */
--- /dev/null
+++ b/arch/arm/mach-cns21xx/include/mach/timex.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2008 Cavium Networks
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _CNS21XX_TIMEX_H
+#define _CNS21XX_TIMEX_H
+
+#define CLOCK_TICK_RATE 43750000
+
+#endif /* _CNS21XX_TIMEX_H */
--- /dev/null
+++ b/arch/arm/mach-cns21xx/include/mach/uncompress.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2008 Cavium Networks
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _CNS21XX_UNCOMPRESS_H
+#define _CNS21XX_UNCOMPRESS_H
+
+#define UART_BASE 0x78000000
+
+#define UART_REG(offs) (*((volatile unsigned int *)(UART_BASE + offs)))
+
+#define UART_THR UART_REG(0x00)
+#define UART_LSR UART_REG(0x14)
+#define THR_EMPTY (1 << 5)
+
+#define UART_THR_EMPTY() (((UART_LSR) & THR_EMPTY) == (THR_EMPTY))
+
+static void putc(int c)
+{
+ if (c != 0) {
+ while (!UART_THR_EMPTY())
+ barrier();
+
+ UART_THR = (int)(c & 0xFF);
+ }
+}
+
+static inline void flush(void)
+{
+}
+
+#define arch_decomp_setup()
+#define arch_decomp_wdog()
+
+#endif /* _CNS21XX_UNCOMPRESS_H */
--- /dev/null
+++ b/arch/arm/mach-cns21xx/include/mach/system.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2008 Cavium Networks
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _CNS21XX_SYSTEM_H
+#define _CNS21XX_SYSTEM_H
+
+#include <mach/cns21xx.h>
+#include <mach/cns21xx_powermgmt.h>
+
+static inline void arch_idle(void)
+{
+ /*
+ * Because of broken hardware we have to enable interrupts or the CPU
+ * will never wakeup... Acctualy it is not very good to enable
+ * interrupts here since scheduler can miss a tick, but there is
+ * no other way around this. Platforms that needs it for power saving
+ * should call enable_hlt() in init code, since by default it is
+ * disabled.
+ */
+ local_irq_enable();
+ cpu_do_idle();
+}
+
+#endif /* _CNS21XX_SYSTEM_H */
--- /dev/null
+++ b/arch/arm/mach-cns21xx/irq.c
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2008 Cavium Networks
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/io.h>
+#include <linux/ioport.h>
+
+#include <asm/system_misc.h>
+
+#include <mach/cns21xx.h>
+
+#define INTC_INTERRUPT_RAW_STATUS_REG 0x000
+#define INTC_EDGE_INTERRUPT_SOURCE_CLEAR_REG 0x004
+#define INTC_INTERRUPT_MASK_REG 0x008
+#define INTC_INTERRUPT_MASK_CLEAR_REG 0x00c
+#define INTC_INTERRUPT_TRIGGER_MODE_REG 0x010
+#define INTC_INTERRUPT_TRIGGER_LEVEL_REG 0x014
+#define INTC_FIQ_SELECT_REG 0x018
+#define INTC_IRQ_STATUS_REG 0x01c
+#define INTC_FIQ_STATUS_REG 0x020
+#define INTC_SOFTWARE_INTERRUPT_REG 0x024
+#define INTC_SOFTWARE_INTERRUPT_CLEAR_REG 0x028
+#define INTC_SOFTWARE_PRIORITY_MASK_REG 0x02c
+#define INTC_POWER_MANAGEMENT_INTERRUPT_REG 0x034
+
+#define INTC_VECTOR_ADDRESS_REG(_x) ((_x) + 0x040)
+#define INTC_PRIORITY_REG(_x) ((_x) + 0x0c0)
+#define INTC_IRQ_VECTOR_ADDRESS_REG 0x140
+#define INTC_VECTOR_INTERRUPT_ENABLE_REG 0x144
+
+#define INTC_SIZE 0x148
+
+static unsigned int cns21xx_irq_types[CNS21XX_NR_INTC_IRQS] = {
+ [CNS21XX_IRQ_TIMER1] = IRQ_TYPE_EDGE_RISING,
+ [CNS21XX_IRQ_TIMER2] = IRQ_TYPE_EDGE_RISING,
+ [CNS21XX_IRQ_CPM] = IRQ_TYPE_EDGE_FALLING,
+ [CNS21XX_IRQ_WDT] = IRQ_TYPE_EDGE_RISING,
+ [CNS21XX_IRQ_GPIO] = IRQ_TYPE_NONE,
+ [CNS21XX_IRQ_PCI_INTA] = IRQ_TYPE_LEVEL_LOW,
+ [CNS21XX_IRQ_PCI_INTB] = IRQ_TYPE_LEVEL_LOW,
+ [CNS21XX_IRQ_PCI_BROKEN] = IRQ_TYPE_LEVEL_HIGH,
+ [CNS21XX_IRQ_AHB2PCI] = IRQ_TYPE_LEVEL_HIGH,
+ [CNS21XX_IRQ_UART0] = IRQ_TYPE_LEVEL_HIGH,
+ [CNS21XX_IRQ_UART1] = IRQ_TYPE_LEVEL_HIGH,
+ [CNS21XX_IRQ_GDMAC_TC] = IRQ_TYPE_LEVEL_HIGH,
+ [CNS21XX_IRQ_GDMAC_ERR] = IRQ_TYPE_LEVEL_HIGH,
+ [CNS21XX_IRQ_PCMCIA] = IRQ_TYPE_NONE,
+ [CNS21XX_IRQ_RTC] = IRQ_TYPE_LEVEL_HIGH,
+ [CNS21XX_IRQ_PCM] = IRQ_TYPE_LEVEL_LOW,
+ [CNS21XX_IRQ_USB_DEVICE] = IRQ_TYPE_LEVEL_LOW,
+ [CNS21XX_IRQ_IDE] = IRQ_TYPE_LEVEL_HIGH,
+ [CNS21XX_IRQ_NIC_STATUS] = IRQ_TYPE_LEVEL_HIGH,
+ [CNS21XX_IRQ_NIC_TXTC] = IRQ_TYPE_EDGE_RISING,
+ [CNS21XX_IRQ_NIC_RXRC] = IRQ_TYPE_EDGE_RISING,
+ [CNS21XX_IRQ_NIC_TXQE] = IRQ_TYPE_EDGE_RISING,
+ [CNS21XX_IRQ_NIC_RXQF] = IRQ_TYPE_EDGE_RISING,
+ [CNS21XX_IRQ_OHCI] = IRQ_TYPE_LEVEL_LOW,
+ [CNS21XX_IRQ_EHCI] = IRQ_TYPE_LEVEL_LOW,
+ [CNS21XX_IRQ_I2S] = IRQ_TYPE_LEVEL_LOW,
+ [CNS21XX_IRQ_SPI] = IRQ_TYPE_LEVEL_LOW,
+ [CNS21XX_IRQ_I2C] = IRQ_TYPE_LEVEL_LOW,
+ [CNS21XX_IRQ_USB_VBUS] = IRQ_TYPE_EDGE_RISING,
+ [CNS21XX_IRQ_EXT_29] = IRQ_TYPE_NONE,
+ [CNS21XX_IRQ_EXT_30] = IRQ_TYPE_NONE,
+ [CNS21XX_IRQ_HSDMAC] = IRQ_TYPE_EDGE_RISING,
+};
+
+static void __iomem *cns21xx_intc_base;
+
+static inline void cns21xx_intc_writel(u32 val, unsigned int reg)
+{
+ __raw_writel(val, cns21xx_intc_base + reg);
+}
+
+static inline u32 cns21xx_intc_readl(unsigned int reg)
+{
+ return __raw_readl(cns21xx_intc_base + reg);
+}
+
+static void cns21xx_irq_ack(struct irq_data *d)
+{
+ cns21xx_intc_writel(1 << d->irq, INTC_EDGE_INTERRUPT_SOURCE_CLEAR_REG);
+}
+
+static void cns21xx_irq_mask(struct irq_data *d)
+{
+ cns21xx_intc_writel(1 << d->irq, INTC_INTERRUPT_MASK_REG);
+}
+
+static void cns21xx_irq_unmask(struct irq_data *d)
+{
+ cns21xx_intc_writel(1 << d->irq, INTC_INTERRUPT_MASK_CLEAR_REG);
+}
+
+static struct irq_chip cns21xx_irq_chip = {
+ .name = "INTC",
+ .irq_ack = cns21xx_irq_ack,
+ .irq_mask = cns21xx_irq_mask,
+ .irq_unmask = cns21xx_irq_unmask,
+};
+
+static struct resource cns21xx_intc_resource = {
+ .name = "INTC",
+ .flags = IORESOURCE_MEM,
+ .start = CNS21XX_INTC_BASE,
+ .end = CNS21XX_INTC_BASE + INTC_SIZE - 1,
+};
+
+void __init cns21xx_init_irq(void)
+{
+ unsigned int mode = 0;
+ unsigned int level = 0;
+ int i;
+
+ /*
+ * Disable arch_idle() by default since it is buggy
+ * For more info see arch/arm/mach-cns21xx/include/mach/system.h
+ */
+ disable_hlt();
+
+ request_resource(&iomem_resource, &cns21xx_intc_resource);
+ cns21xx_intc_base = ioremap(cns21xx_intc_resource.start, INTC_SIZE);
+
+ cns21xx_intc_writel(0xffffffff, INTC_INTERRUPT_MASK_REG);
+ cns21xx_intc_writel(0xffffffff, INTC_EDGE_INTERRUPT_SOURCE_CLEAR_REG);
+ cns21xx_intc_writel(0xffffffff, INTC_SOFTWARE_INTERRUPT_CLEAR_REG);
+ cns21xx_intc_writel(0, INTC_SOFTWARE_PRIORITY_MASK_REG);
+ cns21xx_intc_writel(0, INTC_FIQ_SELECT_REG);
+ cns21xx_intc_writel(0, INTC_VECTOR_INTERRUPT_ENABLE_REG);
+
+ for (i = 0; i < ARRAY_SIZE(cns21xx_irq_types); i++) {
+ irq_flow_handler_t handler;
+
+ switch (cns21xx_irq_types[i]) {
+ case IRQ_TYPE_EDGE_RISING:
+ handler = handle_edge_irq;
+ mode |= (1 << i);
+ break;
+
+ case IRQ_TYPE_EDGE_FALLING:
+ handler = handle_edge_irq;
+ mode |= (1 << i);
+ level |= (1 << i);
+ break;
+
+ case IRQ_TYPE_LEVEL_LOW:
+ handler = handle_level_irq;
+ level |= (1 << i);
+ break;
+
+ case IRQ_TYPE_LEVEL_HIGH:
+ case IRQ_TYPE_NONE:
+ handler = handle_level_irq;
+ break;
+
+ default:
+ BUG();
+ break;
+ }
+
+ irq_set_chip(i, &cns21xx_irq_chip);
+ irq_set_handler(i, handler);
+ set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
+ }
+
+ cns21xx_intc_writel(mode, INTC_INTERRUPT_TRIGGER_MODE_REG);
+ cns21xx_intc_writel(level, INTC_INTERRUPT_TRIGGER_LEVEL_REG);
+}
--- /dev/null
+++ b/arch/arm/mach-cns21xx/time.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/irq.h>
+
+#include <asm/mach/time.h>
+
+#include <plat/time.h>
+#include <mach/hardware.h>
+#include <mach/cns21xx.h>
+
+#include "common.h"
+
+static void __init cns21xx_timer_init(void)
+{
+ fa_timer_init(CNS21XX_TIMER_BASE, CNS21XX_IRQ_TIMER1, FA_TIMER1,
+ cns21xx_get_apb_freq());
+}
+
+struct sys_timer cns21xx_timer = {
+ .init = cns21xx_timer_init,
+};
--- /dev/null
+++ b/arch/arm/mach-cns21xx/include/mach/cns21xx_powermgmt.h
@@ -0,0 +1,591 @@
+/*
+ * Copyright (c) 2008 Cavium Networks
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _CNS21XX_POWERMGMT_H
+#define _CNS21XX_POWERMGMT_H
+
+#define PWRMGT_MEM_MAP_VALUE(reg_offset) \
+ (*((u32 volatile *)(CNS21XX_CPM_BASE_VIRT + reg_offset)))
+
+/*
+ * define access macros
+ */
+#define PWRMGT_CLOCK_GATE_CONTROL0_REG PWRMGT_MEM_MAP_VALUE(0x00)
+#define PWRMGT_CLOCK_GATE_CONTROL1_REG PWRMGT_MEM_MAP_VALUE(0x04)
+#define PWRMGT_SOFTWARE_RESET_CONTROL_REG PWRMGT_MEM_MAP_VALUE(0x08)
+#define PWRMGT_SYSTEM_CLOCK_CONTROL_REG PWRMGT_MEM_MAP_VALUE(0x0C)
+#define PWRMGT_PLL_POWER_DOWN_CONTROL_REG PWRMGT_MEM_MAP_VALUE(0x10)
+#define PWRMGT_CPU_INITIALIZATION_REG PWRMGT_MEM_MAP_VALUE(0x14)
+#define PWRMGT_PAD_DRIVE_STRENGTH_CONTROL_REG PWRMGT_MEM_MAP_VALUE(0x1C)
+#define PWRMGT_USB_DEVICE_POWERMGT_REG PWRMGT_MEM_MAP_VALUE(0x20)
+#define PWRMGT_REGULATOR_CONTROL_REG PWRMGT_MEM_MAP_VALUE(0x24)
+#define PWRMGT_RTC_XTAL_CONTROL_REG PWRMGT_MEM_MAP_VALUE(0x28)
+#define PWRMGT_PLL250_CONTROL_REG PWRMGT_MEM_MAP_VALUE(0x2C)
+
+
+/*
+ * define constants macros
+ */
+#define PWRMGT_GLOBAL_SOFTWARE_RESET_MASK_BIT_INDEX 0
+#define PWRMGT_PCMCIA_SOFTWARE_RESET_BIT_INDEX 1
+#define PWRMGT_IDE_SOFTWARE_RESET_BIT_INDEX 2
+#define PWRMGT_VIC_SOFTWARE_RESET_BIT_INDEX 3
+#define PWRMGT_DMA_SOFTWARE_RESET_BIT_INDEX 4
+#define PWRMGT_NIC_SOFTWARE_RESET_BIT_INDEX 5
+#define PWRMGT_USB_HOST_SOFTWARE_RESET_BIT_INDEX 6
+#define PWRMGT_PCI_BRIDGE_SOFTWARE_RESET_BIT_INDEX 7
+#define PWRMGT_P2S_SOFTWARE_RESET_BIT_INDEX 8
+#define PWRMGT_UART0_SOFTWARE_RESET_BIT_INDEX 9
+#define PWRMGT_UART1_SOFTWARE_RESET_BIT_INDEX 10
+#define PWRMGT_TIMER_SOFTWARE_RESET_BIT_INDEX 11
+#define PWRMGT_WDTIMER_SOFTWARE_RESET_BIT_INDEX 12
+#define PWRMGT_GPIO_SOFTWARE_RESET_BIT_INDEX 13
+#define PWRMGT_USB_DEVICE_SOFTWARE_RESET_BIT_INDEX 14
+#define PWRMGT_FAST_ETHERNET_PHY_SOFTWARE_RESET_BIT_INDEX 15
+#define PWRMGT_HSDMA_SOFTWARE_RESET_BIT_INDEX 16
+
+#define PWRMGT_PLL_FREQUENCY_175MHZ (0 << 0)
+#define PWRMGT_PLL_FREQUENCY_200MHZ (1 << 0)
+#define PWRMGT_PLL_FREQUENCY_225MHZ (2 << 0)
+#define PWRMGT_PLL_FREQUENCY_250MHZ (3 << 0)
+
+#define PWRMGT_CPUCLK_DIVIDER_BY_1 (0 << 2)
+#define PWRMGT_CPUCLK_DIVIDER_BY_2 (1 << 2)
+#define PWRMGT_CPUCLK_DIVIDER_BY_3 (2 << 2)
+#define PWRMGT_CPUCLK_DIVIDER_BY_4 (3 << 2)
+
+#define PWRMGT_HCLK_DIVIDER_BY_1 (0 << 4)
+#define PWRMGT_HCLK_DIVIDER_BY_2 (1 << 4)
+#define PWRMGT_HCLK_DIVIDER_BY_3 (2 << 4)
+#define PWRMGT_HCLK_DIVIDER_BY_4 (3 << 4)
+
+#define PWRMGT_HCLK_SOURCE_FCLK (0 << 6)
+#define PWRMGT_HCLK_SOURCE_125MHZ (1 << 6)
+
+#define PWRMGT_PCLK_DIVIDER_BY_1 (0 << 8)
+#define PWRMGT_PCLK_DIVIDER_BY_2 (1 << 8)
+#define PWRMGT_PCLK_DIVIDER_BY_3 (2 << 8)
+#define PWRMGT_PCLK_DIVIDER_BY_4 (3 << 8)
+
+#define PWRMGT_PCICLK_DIVIDER_BY_1 (0 << 10)
+#define PWRMGT_PCICLK_DIVIDER_BY_2 (1 << 10)
+#define PWRMGT_PCICLK_DIVIDER_BY_3 (2 << 10)
+#define PWRMGT_PCICLK_DIVIDER_BY_4 (3 << 10)
+
+
+#define PWRMGT_PLLCLK_TO_CPUCLK_RATIO_BY_1 1
+#define PWRMGT_PLLCLK_TO_CPUCLK_RATIO_BY_2 2
+#define PWRMGT_PLLCLK_TO_CPUCLK_RATIO_BY_3 3
+#define PWRMGT_PLLCLK_TO_CPUCLK_RATIO_BY_4 4
+
+#define PWRMGT_CPUCLK_TO_HCLK_RATIO_BY_1 1
+#define PWRMGT_CPUCLK_TO_HCLK_RATIO_BY_2 2
+#define PWRMGT_CPUCLK_TO_HCLK_RATIO_BY_3 3
+#define PWRMGT_CPUCLK_TO_HCLK_RATIO_BY_4 4
+
+#define PWRMGT_HCLK_TO_PCLK_RATIO_BY_1 1
+#define PWRMGT_HCLK_TO_PCLK_RATIO_BY_2 2
+#define PWRMGT_HCLK_TO_PCLK_RATIO_BY_3 3
+#define PWRMGT_HCLK_TO_PCLK_RATIO_BY_4 4
+
+/*
+ * Macro defines for Clock Gate Control
+ */
+#define HAL_PWRMGT_DISABLE_DRAMC_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG &= ~(0x1); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_NIC_CLOCK() \
+{ \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~(0x1 << 0); \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG |= (0x0F << 20); \
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG |= (0x1 << 5); \
+}
+
+#define HAL_PWRMGT_DISABLE_NIC_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG &= ~(0x0F << 20); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_PCI_BRIDGE_33M_CLOCK() \
+{ \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~(0x1 << 1); \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~(0x3 << 10); \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= (0x1 << 10); \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG |= (0x1 << 28) | (0x1 << 30); \
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG |= (0x1 << 7); \
+}
+
+#define HAL_PWRMGT_ENABLE_PCI_BRIDGE_66M_CLOCK() \
+{ \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~(0x1 << 1); \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~(0x3 << 10); \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= (0x0 << 10); \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG |= (0x1 << 28) | (0x1 << 30); \
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG |= (0x1 << 7); \
+}
+
+#define HAL_PWRMGT_DISABLE_PCI_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG &= ~((0x1 << 28) | (0x1 << 30)); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_USB_CLOCK() \
+{ \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~(0xF << 1); \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG |= (0x1 << 24); \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG |= (0x1 << 28); \
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG |= (0x1 << 6) | (0x1 << 14); \
+}
+
+#define HAL_PWRMGT_DISABLE_USB_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG &= ~(0x1 << 24); \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG &= ~(0x1 << 28); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_DMA_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG |= (0x1 << 16); \
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG |= (0x1 << 4); \
+}
+
+#define HAL_PWRMGT_DISABLE_DMA_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG &= ~(0x1 << 16); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_IDE_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG |= (0x1 << 8) | (0x1 << 9); \
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG |= (0x1 << 2); \
+}
+
+#define HAL_PWRMGT_DISABLE_IDE_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG &= ~((0x1 << 8) | (0x1 << 9)); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_UART0_CLOCK() \
+{ \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~((0x1 << 1) | (0x1 << 2) | (0x1 << 5)); \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG |= (0x1 << 12); \
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG |= (0x1 << 9); \
+}
+
+#define HAL_PWRMGT_DISABLE_UART0_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG &= ~(0x1 << 12); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_UART1_CLOCK() \
+{ \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~((0x1 << 1) | (0x1 << 2) | (0x1 << 5)); \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG |= (0x1 << 13); \
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG |= (0x1 << 10); \
+}
+
+#define HAL_PWRMGT_DISABLE_UART1_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG &= ~(0x1 << 13); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_PCMCIA_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG |= (0x1 << 4) | (0x1 << 5); \
+}
+
+#define HAL_PWRMGT_DISABLE_PCMCIA_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG &= ~((0x1 << 4) | (0x1 << 5)); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_GPIO_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG |= (0x1 << 25); \
+}
+
+#define HAL_PWRMGT_DISABLE_GPIO_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG &= ~(0x1 << 25); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_WDTIMER_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG |= (0x1 << 21) | (0x1 << 22); \
+}
+
+#define HAL_PWRMGT_DISABLE_WDTIMER_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG &= ~((0x1 << 21) | (0x1 << 22)); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_RTC_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG |= (0x1 << 23); \
+}
+
+#define HAL_PWRMGT_DISABLE_RTC_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG &= ~(0x1 << 23); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_TIMER_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG |= (0x1 << 17) | (0x1 << 18) | (0x1 << 19); \
+}
+
+#define HAL_PWRMGT_DISABLE_TIMER_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG &= ~((0x1 << 17) | (0x1 << 18) | (0x1 << 19)); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_I2C_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG |= (0x1 << 1); \
+}
+
+#define HAL_PWRMGT_DISABLE_I2C_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG &= ~(0x1 << 1); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_I2S_CLOCK() \
+{ \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~((0x1 << 5) | (0x1 << 6)); \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG |= (0x1 << 1) | (0x1 << 10); \
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG |= (0x1 << 8); \
+}
+
+#define HAL_PWRMGT_DISABLE_I2S_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG &= ~((0x1 << 1) | (0x1 << 10)); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_PCM_CLOCK() \
+{ \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~(0x1 << 5); \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG |= (0x1 << 1) | (0x1 << 6); \
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG |= (0x1 << 8); \
+}
+
+#define HAL_PWRMGT_DISABLE_PCM_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG &= ~((0x1 << 1) | (0x1 << 6)); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_SPI_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG |= (0x1 << 0) | (0x1 << 1); \
+}
+
+#define HAL_PWRMGT_DISABLE_SPI_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG &= ~((0x1 << 0) | (0x1 << 1)); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_VIC_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG |= (0x1 << 12); \
+}
+
+#define HAL_PWRMGT_DISABLE_VIC_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG &= ~(0x1 << 12); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_SMC_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG |= (0x1 << 4) | (0x1 << 5); \
+}
+
+#define HAL_PWRMGT_DISABLE_SMC_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL0_REG &= ~((0x1 << 4) | (0x1 << 5)); \
+}
+
+
+#define HAL_PWRMGT_ENABLE_HSDMA_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG |= (0x1 << 29); \
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG |= (0x1 << 16); \
+}
+
+#define HAL_PWRMGT_DISABLE_HSDMA_CLOCK() \
+{ \
+ PWRMGT_CLOCK_GATE_CONTROL1_REG &= ~(0x1 << 29); \
+}
+
+
+
+/*
+ * Macro defines for Reset Control
+ */
+#define HAL_PWRMGT_GLOBAL_SOFTWARE_RESET() \
+{ \
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG |= (0x1); \
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG &= ~(0x1); \
+}
+
+
+/*
+ * Macro defines for System Clock Control
+ */
+#define HAL_PWRMGT_SET_PLL_FREQUENCY_175MHZ() \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~0x3; \
+}
+
+
+#define HAL_PWRMGT_SET_PLL_FREQUENCY_200MHZ() \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~0x3; \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= 0x1; \
+}
+
+
+#define HAL_PWRMGT_SET_PLL_FREQUENCY_225MHZ() \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~0x3; \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= 0x2; \
+}
+
+
+#define HAL_PWRMGT_SET_PLL_FREQUENCY_250MHZ() \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~0x3; \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= 0x3; \
+}
+
+
+#define HAL_PWRMGT_CONFIG_PLLCLK_TO_CPUCLK_RATIO(ratio) \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~(0x3 << 2); \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= (((ratio - 1) & 0x3) << 2); \
+}
+
+
+#define HAL_PWRMGT_CONFIG_CPUCLK_TO_HCLK_RATIO(ratio) \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~(0x3 << 4); \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= (((ratio - 1) & 0x3) << 4); \
+}
+
+
+#define HAL_PWRMGT_HCLK_SOURCE_FCLK() \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~(0x1 << 6); \
+}
+
+
+#define HAL_PWRMGT_HCLK_SOURCE_125MHZ() \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= (0x1 << 6); \
+}
+
+
+#define HAL_PWRMGT_GIGA_NIC_CLOCK_SOURCE_HCLK() \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~(0x1 << 7); \
+}
+
+
+#define HAL_PWRMGT_GIGA_NIC_CLOCK_SOURCE_62_5MHZ() \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= (0x1 << 7); \
+}
+
+
+#define HAL_PWRMGT_CONFIG_HCLK_TO_PCLK_RATIO(ratio) \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~(0x3 << 8); \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= (((ratio - 1) & 0x3) << 8); \
+}
+
+
+#define HAL_PWRMGT_I2S_CLOCK_SOURCE_8192000HZ() \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~(0x3 << 12); \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= (0x0 << 12); \
+}
+
+
+#define HAL_PWRMGT_I2S_CLOCK_SOURCE_11289600HZ() \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~(0x3 << 12); \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= (0x1 << 12); \
+}
+
+
+#define HAL_PWRMGT_I2S_CLOCK_SOURCE_12288000HZ() \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~(0x3 << 12); \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= (0x2 << 12); \
+}
+
+
+#define HAL_PWRMGT_CONFIGURE_MDC_CLOCK_DIVIDER(divided_value) \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~(0x3 << 14); \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= ((divided_value & 0x3) << 14); \
+}
+
+
+#define HAL_PWRMGT_CONFIGURE_CLOCK_OUT_PIN(pin_source_select, divided_value) \
+{ \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG &= ~(0x3F << 16); \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= ((pin_source_select & 0xF) << 16); \
+ PWRMGT_SYSTEM_CLOCK_CONTROL_REG |= ((divided_value & 0x3) << 20); \
+}
+
+
+/*
+ * Macro defines for PLL Power Down Control
+ */
+#define HAL_PWRMGT_POWER_DOWN_SYSTEM_XTAL_PAD() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG |= (0x1 << 7)
+
+#define HAL_PWRMGT_POWER_ON_SYSTEM_XTAL_PAD() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~(0x1 << 7)
+
+
+#define HAL_PWRMGT_POWER_DOWN_PLL_X5() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG |= (0x1 << 0)
+
+#define HAL_PWRMGT_POWER_ON_PLL_X5() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~(0x1 << 0)
+
+
+#define HAL_PWRMGT_POWER_DOWN_PLL_X8() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG |= (0x1 << 1)
+
+#define HAL_PWRMGT_POWER_ON_PLL_X8() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~(0x1 << 1)
+
+
+#define HAL_PWRMGT_POWER_DOWN_PLL_X3() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG |= (0x1 << 2)
+
+#define HAL_PWRMGT_POWER_ON_PLL_X3() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~(0x1 << 2)
+
+
+#define HAL_PWRMGT_POWER_DOWN_USBH_PHY_PLL() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG |= (0x1 << 3)
+
+#define HAL_PWRMGT_POWER_ON_USBH_PHY_PLL() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~(0x1 << 3)
+
+
+#define HAL_PWRMGT_POWER_DOWN_USBD_PHY_PLL() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG |= (0x1 << 4)
+
+#define HAL_PWRMGT_POWER_ON_USBD_PHY_PLL() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~(0x1 << 4)
+
+
+#define HAL_PWRMGT_POWER_DOWN_PLL_X2250() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG |= (0x1 << 5)
+
+#define HAL_PWRMGT_POWER_ON_PLL_X2250() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~(0x1 << 5)
+
+
+#define HAL_PWRMGT_POWER_DOWN_PLL_X7() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG |= (0x1 << 6)
+
+#define HAL_PWRMGT_POWER_ON_PLL_X7() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG &= ~(0x1 << 6)
+
+
+#define HAL_PWRMGT_POWER_DOWN_ALL_PLL() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG = 0x7F;
+
+#define HAL_PWRMGT_POWER_ON_ALL_PLL() \
+ PWRMGT_PLL_POWER_DOWN_CONTROL_REG = 0;
+
+
+/*
+ * Macro defines for Pad Drive Strength Control
+ */
+#define HAL_PWRMGT_SELECT_PAD_DRIVE_STRENGTH_PCMCIA_CARDBUS_MODE() \
+{ \
+ PWRMGT_PAD_DRIVE_STRENGTH_CONTROL_REG &= ~(0x3 << 0); \
+}
+
+#define HAL_PWRMGT_SELECT_PAD_DRIVE_STRENGTH_PCI_MODE() \
+{ \
+ PWRMGT_PAD_DRIVE_STRENGTH_CONTROL_REG &= ~(0x3 << 0); \
+ PWRMGT_PAD_DRIVE_STRENGTH_CONTROL_REG |= (0x1 << 0); \
+}
+
+#define HAL_PWRMGT_SELECT_PAD_DRIVE_STRENGTH_MII_MODE() \
+{ \
+ PWRMGT_PAD_DRIVE_STRENGTH_CONTROL_REG |= (0x1 << 2); \
+}
+
+#define HAL_PWRMGT_SELECT_PAD_DRIVE_STRENGTH_RGMII_MODE() \
+{ \
+ PWRMGT_PAD_DRIVE_STRENGTH_CONTROL_REG &= ~(0x1 << 2); \
+}
+
+#define HAL_PWRMGT_ENABLE_MII_PAD_SIGNAL_NOT_BOUNDED() \
+{ \
+ PWRMGT_PAD_DRIVE_STRENGTH_CONTROL_REG |= (0x1 << 3); \
+}
+
+#define HAL_PWRMGT_DISABLE_MII_PAD_SIGNAL_NOT_BOUNDED() \
+{ \
+ PWRMGT_PAD_DRIVE_STRENGTH_CONTROL_REG &= ~(0x1 << 3); \
+}
+
+
+/*
+ * Macro defines for USB Device Power Management
+ */
+#define HAL_PWRMGT_REMOTE_WAKEUP_USB_HOST() \
+{ \
+ PWRMGT_USB_DEVICE_POWERMGT_REG |= (0x1 << 4); \
+}
+
+#define HAL_PWRMGT_USB_DEVICE_PHY_CLOCK_SOURCE_EXTERNAL_12MHZ() \
+{ \
+ PWRMGT_USB_DEVICE_POWERMGT_REG &= ~(0x1 << 5); \
+}
+
+#define HAL_PWRMGT_USB_DEVICE_PHY_CLOCK_SOURCE_INTERNAL_12MHZ() \
+{ \
+ PWRMGT_USB_DEVICE_POWERMGT_REG |= (0x1 << 5); \
+}
+
+
+/*
+ * Macro defines for Regulator Control
+ */
+
+#endif /* _CNS21XX_POWERMGMT_H */
--- /dev/null
+++ b/arch/arm/mach-cns21xx/include/mach/cns21xx.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2008 Cavium Networks
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _CNS21XX_H
+#define _CNS21XX_H
+
+#define CNS21XX_FLASH_BANK0_BASE 0x10000000
+#define CNS21XX_FLASH_BANK1_BASE 0x11000000
+#define CNS21XX_FLASH_BANK2_BASE 0x12000000
+#define CNS21XX_FLASH_BANK3_BASE 0x13000000
+#define CNS21XX_PCMCIA_ATTR_BASE 0x14000000
+#define CNS21XX_PCMCIA_MEM_BASE 0x15000000
+#define CNS21XX_PCMCIA_IO_BASE 0x16000000
+#define CNS21XX_IDE_DEVICE_BASE 0x18000000
+#define CNS21XX_SDRAM_MEMORY_BASE 0x20000000
+#define CNS21XX_GDMAC_BASE 0x60000000
+#define CNS21XX_NIC_BASE 0x70000000
+#define CNS21XX_SPI_BASE 0x71000000
+#define CNS21XX_PCM_BASE 0x71000000
+#define CNS21XX_I2C_BASE 0x71000000
+#define CNS21XX_I2S_BASE 0x71000000
+#define CNS21XX_DDRC_BASE 0x72000000
+#define CNS21XX_SMC_BASE 0x73000000
+#define CNS21XX_PCMCIA_CTRL_BASE 0x73000000
+#define CNS21XX_IDE_CTRL_BASE 0x74000000
+#define CNS21XX_MISC_BASE 0x76000000
+#define CNS21XX_CPM_BASE 0x77000000
+#define CNS21XX_UART0_BASE 0x78000000
+#define CNS21XX_UART1_BASE 0x78800000
+#define CNS21XX_TIMER_BASE 0x79000000
+#define CNS21XX_WDT_BASE 0x7a000000
+#define CNS21XX_RTC_BASE 0x7b000000
+#define CNS21XX_GPIOA_BASE 0x7c000000
+#define CNS21XX_GPIOB_BASE 0x7c800000
+#define CNS21XX_PCI_CFGDATA_BASE 0xa0000000
+#define CNS21XX_PCI_CFGADDR_BASE 0xa4000000
+#define CNS21XX_PCI_IO_BASE 0xa8000000
+#define CNS21XX_PCI_MEMORY_BASE 0xb0000000
+#define CNS21XX_OHCI_CONFIG_BASE 0xc0000000
+#define CNS21XX_OHCI_CTRL_BASE 0xc4000000
+#define CNS21XX_EHCI_CONFIG_BASE 0xc8000000
+#define CNS21XX_EHCI_CTRL_BASE 0xcc000000
+#define CNS21XX_USB_DEVICE_BASE 0xd0000000
+#define CNS21XX_INTC_BASE 0xfffff000
+
+#define CNS21XX_FLASH_BANK0_BASE_VIRT 0xe0000000
+#define CNS21XX_FLASH_BANK1_BASE_VIRT 0xe2000000
+#define CNS21XX_FLASH_BANK2_BASE_VIRT 0xe4000000
+#define CNS21XX_FLASH_BANK3_BASE_VIRT 0xe8000000
+#define CNS21XX_IDE_DEVICE_BASE_VIRT 0xfef00000
+#define CNS21XX_GDMAC_BASE_VIRT 0xfef01000
+#define CNS21XX_NIC_BASE_VIRT 0xfef02000
+#define CNS21XX_SPI_BASE_VIRT 0xfef03000
+#define CNS21XX_PCM_BASE_VIRT 0xfef04000
+#define CNS21XX_I2C_BASE_VIRT 0xfef05000
+#define CNS21XX_I2S_BASE_VIRT 0xfef06000
+#define CNS21XX_DDRC_BASE_VIRT 0xfef07000
+#define CNS21XX_SMC_BASE_VIRT 0xfef08000
+#define CNS21XX_PCMCIA_CTRL_BASE_VIRT 0xfef09000
+#define CNS21XX_IDE_CTRL_BASE_VIRT 0xfef0A000
+#define CNS21XX_MISC_BASE_VIRT 0xfef0B000
+#define CNS21XX_CPM_BASE_VIRT 0xfef0C000
+#define CNS21XX_UART0_BASE_VIRT 0xfef0D000
+#define CNS21XX_UART1_BASE_VIRT 0xfef0E000
+#define CNS21XX_TIMER_BASE_VIRT 0xfef0F000
+#define CNS21XX_WDT_BASE_VIRT 0xfef10000
+#define CNS21XX_RTC_BASE_VIRT 0xfef11000
+#define CNS21XX_GPIOA_BASE_VIRT 0xfef12000
+#define CNS21XX_GPIOB_BASE_VIRT 0xfef13000
+#define CNS21XX_PCI_CFGDATA_BASE_VIRT 0xfef14000
+#define CNS21XX_PCI_CFGADDR_BASE_VIRT 0xfef15000
+#define CNS21XX_OHCI_CONFIG_BASE_VIRT 0xfef16000
+#define CNS21XX_OHCI_CTRL_BASE_VIRT 0xfef17000
+#define CNS21XX_EHCI_CONFIG_BASE_VIRT 0xfef18000
+#define CNS21XX_EHCI_CTRL_BASE_VIRT 0xfef19000
+#define CNS21XX_USB_DEVICE_BASE_VIRT 0xfef1a000
+#define CNS21XX_INTC_BASE_VIRT 0xfef1b000
+
+#define CNS21XX_PHYS_IO CNS21XX_UART0_BASE
+#define CNS21XX_IO_PAGE_OFFSET ((CNS21XX_UART0_BASE_VIRT) >> 18) & 0xfffc
+
+#endif /* _CNS21XX_H */
--- /dev/null
+++ b/arch/arm/mach-cns21xx/core.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2008 Cavium Networks
+ * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+
+#include <mach/hardware.h>
+#include <mach/cns21xx.h>
+#include <mach/cns21xx_powermgmt.h>
+
+static unsigned long cns21xx_pll_freq;
+static unsigned long cns21xx_cpu_freq;
+static unsigned long cns21xx_ahb_freq;
+static unsigned long cns21xx_apb_freq;
+
+static void cns21xx_init_freq(void)
+{
+ static int freq_init_done;
+ unsigned int t;
+
+ if (freq_init_done)
+ return;
+
+ t = PWRMGT_SYSTEM_CLOCK_CONTROL_REG;
+ switch (t & 0x3) {
+ case 0x00:
+ cns21xx_pll_freq = 175000000;
+ break;
+
+ case 0x01:
+ cns21xx_pll_freq = 200000000;
+ break;
+
+ case 0x02:
+ cns21xx_pll_freq = 225000000;
+ break;
+
+ case 0x03:
+ cns21xx_pll_freq = 250000000;
+ break;
+ }
+
+ cns21xx_cpu_freq = cns21xx_pll_freq / (((t >> 2) & 0x3) + 1);
+ cns21xx_ahb_freq = cns21xx_cpu_freq / (((t >> 4) & 0x3) + 1);
+ cns21xx_apb_freq = cns21xx_ahb_freq / (((t >> 8) & 0x3) + 1);
+
+ freq_init_done = 1;
+}
+
+unsigned long cns21xx_get_pll_freq(void)
+{
+ cns21xx_init_freq();
+ return cns21xx_pll_freq;
+}
+
+unsigned long cns21xx_get_cpu_freq(void)
+{
+ cns21xx_init_freq();
+ return cns21xx_cpu_freq;
+}
+
+unsigned long cns21xx_get_ahb_freq(void)
+{
+ cns21xx_init_freq();
+ return cns21xx_ahb_freq;
+}
+
+unsigned long cns21xx_get_apb_freq(void)
+{
+ cns21xx_init_freq();
+ return cns21xx_apb_freq;
+}
+
+void cns21xx_restart(char mode, const char *cmd)
+{
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG |=
+ (1UL << PWRMGT_GLOBAL_SOFTWARE_RESET_MASK_BIT_INDEX);
+ PWRMGT_SOFTWARE_RESET_CONTROL_REG &=
+ ~(1UL << PWRMGT_GLOBAL_SOFTWARE_RESET_MASK_BIT_INDEX);
+}
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -846,6 +846,7 @@ config ARM_L1_CACHE_SHIFT_6
config ARM_L1_CACHE_SHIFT
int
default 6 if ARM_L1_CACHE_SHIFT_6
+ default 4 if ARM_L1_CACHE_SHIFT_4
default 5
config ARM_DMA_MEM_BUFFERABLE
--- a/arch/arm/mm/cache-fa.S
+++ b/arch/arm/mm/cache-fa.S
@@ -28,7 +28,7 @@
/*
* The total size of the data cache.
*/
-#ifdef CONFIG_ARCH_GEMINI
+#if (defined(CONFIG_ARCH_GEMINI) || defined(CONFIG_ARCH_CNS21XX))
#define CACHE_DSIZE 8192
#else
#define CACHE_DSIZE 16384
--- /dev/null
+++ b/arch/arm/mach-cns21xx/include/mach/cns21xx_misc.h
@@ -0,0 +1,507 @@
+/*******************************************************************************
+ *
+ * Copyright (c) 2008 Cavium Networks
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
+ * NONINFRINGEMENT. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA or
+ * visit http://www.gnu.org/licenses/.
+ *
+ * This file may also be available under a different license from Cavium.
+ * Contact Cavium Networks for more information
+ *
+ ******************************************************************************/
+
+#ifndef _STAR_MISC_H_
+#define _STAR_MISC_H_
+
+#include <mach/cns21xx.h>
+
+#define MISC_MEM_MAP_VALUE(reg_offset) \
+ (*((u32 volatile *)(CNS21XX_MISC_BASE_VIRT + reg_offset)))
+
+/*
+ * define access macros
+ */
+#define MISC_MEMORY_REMAP_REG MISC_MEM_MAP_VALUE(0x00)
+#define MISC_CHIP_CONFIG_REG MISC_MEM_MAP_VALUE(0x04)
+#define MISC_DEBUG_PROBE_DATA_REG MISC_MEM_MAP_VALUE(0x08)
+#define MISC_DEBUG_PROBE_SELECTION_REG MISC_MEM_MAP_VALUE(0x0C)
+#define MISC_PCI_CONTROL_BROKEN_MASK_REG MISC_MEM_MAP_VALUE(0x10)
+#define MISC_PCI_BROKEN_STATUS_REG MISC_MEM_MAP_VALUE(0x14)
+#define MISC_PCI_DEVICE_VENDOR_ID_REG MISC_MEM_MAP_VALUE(0x18)
+#define MISC_USB_HOST_PHY_CONTROL_TEST_REG MISC_MEM_MAP_VALUE(0x1C)
+#define MISC_GPIOA_PIN_ENABLE_REG MISC_MEM_MAP_VALUE(0x20)
+#define MISC_GPIOB_PIN_ENABLE_REG MISC_MEM_MAP_VALUE(0x24)
+#define MISC_GPIOA_RESISTOR_CONFIG_REG MISC_MEM_MAP_VALUE(0x28)
+#define MISC_GPIOA_DRIVE_STRENGTH_CONFIG_REG MISC_MEM_MAP_VALUE(0x2C)
+#define MISC_FAST_ETHERNET_PHY_CONFIG_REG MISC_MEM_MAP_VALUE(0x30)
+#define MISC_SOFTWARE_TEST_1_REG MISC_MEM_MAP_VALUE(0x38)
+#define MISC_SOFTWARE_TEST_2_REG MISC_MEM_MAP_VALUE(0x3C)
+
+#define MISC_E_FUSE_0_REG MISC_MEM_MAP_VALUE(0x60)
+#define MISC_E_FUSE_1_REG MISC_MEM_MAP_VALUE(0x64)
+
+
+/*
+ * define constants macros
+ */
+#define MISC_PARALLEL_FLASH_BOOT 0
+#define MISC_SPI_SERIAL_FLASH_BOOT 1
+
+#define MISC_LITTLE_ENDIAN 0
+#define MISC_BIG_ENDIAN 1
+
+#define MISC_FARADAY_ICE 0
+#define MISC_ARM_ICE 1
+
+#define MISC_EXT_INT29_PINS ((0x1 << 0))
+#define MISC_EXT_INT30_PINS ((0x1 << 1))
+#define MISC_EXT_INT31_PINS ((0x1 << 2))
+#define MISC_I2C_PINS ((0x1 << 13) | (0x1 << 14))
+#define MISC_I2S_PINS ((0x1 << 15) | (0x1 << 16) | (0x1 << 17))
+#define MISC_I2SSD_PINS (1 << 15)
+#define MISC_I2SWS_PINS (1 << 16)
+#define MISC_I2SCLK_PINS (1 << 17)
+#define MISC_PCM_PINS ((0x1 << 18) | (0x1 << 19) | (0x1 << 20) | (0x1 << 21))
+#define MISC_PCMDR_PINS (1 << 18)
+#define MISC_PCMDT_PINS (1 << 19)
+#define MISC_PCMFS_PINS (1 << 20)
+#define MISC_PCMCLK_PINS (1 << 21)
+#define MISC_LED0_PINS ((0x1 << 22))
+#define MISC_LED1_PINS ((0x1 << 23))
+#define MISC_LED2_PINS ((0x1 << 24))
+#define MISC_LED012_PINS ((0x1 << 22) | (0x1 << 23) | (0x1 << 24))
+#define MISC_WDTIMER_RESET_PINS ((0x1 << 25))
+#define MISC_SPIDR_PINS (0x1 << 26)
+#define MISC_SPICLK_PINS (0x1 << 27)
+#define MISC_SPICSN0_PINS (0x1 << 28)
+#define MISC_SPICSN1_PINS (0x1 << 29)
+#define MISC_SPICSN2_PINS (0x1 << 30)
+#define MISC_SPICSN3_PINS (0x1 << 31)
+#define MISC_SPI_PINS ((0x1 << 26) | (0x1 << 27) | (0x1 << 28) | (0x1 << 29) | (0x1 << 30) | (0x1 << 31))
+#define MISC_MDC_MDIO_PINS ((0x1 << 0) | (0x1 << 1))
+#define MISC_NIC_COL_PINS ((0x1 << 2))
+#define MISC_IDE_PINS ((0xFF << 3))
+#define MISC_SRAM_BANK1_PINS ((0x1 << 11) | (0x1 << 14))
+#define MISC_SRAM_BANK2_PINS ((0x1 << 12) | (0x1 << 15))
+#define MISC_SRAM_BANK3_PINS ((0x1 << 13) | (0x1 << 16))
+#define MISC_PCMCIA_PINS ((0x1 << 17) | (0x1 << 18) | (0x1 << 19) | (0x1 << 20))
+#define MISC_UART1_PINS ((0x1 << 21) | (0x1 << 22))
+#define MISC_PCI_PINS (((u32)0x1FF << 23))
+
+#define MISC_UART0_ACT0_Pin (0x1 << 2)
+#define MISC_UART1_ACT1_Pin (0x1 << 3)
+
+#define MISC_GPIOA_PIN_0 0
+#define MISC_GPIOA_PIN_1 1
+#define MISC_GPIOA_PIN_2 2
+#define MISC_GPIOA_PIN_3 3
+#define MISC_GPIOA_PIN_4 4
+#define MISC_GPIOA_PIN_5 5
+#define MISC_GPIOA_PIN_6 6
+#define MISC_GPIOA_PIN_7 7
+#define MISC_GPIOA_PIN_8 8
+#define MISC_GPIOA_PIN_9 9
+#define MISC_GPIOA_PIN_10 10
+
+#define MISC_GPIOA_75K_RESISTOR_PULL_DOWN 1
+#define MISC_GPIOA_75K_RESISTOR_PULL_UP 2
+#define MISC_GPIOA_75K_RESISTOR_PULL_KEEPER 3
+
+#define MISC_GPIOA_DRIVE_STRENGTH_4MA 0
+#define MISC_GPIOA_DRIVE_STRENGTH_8MA 1
+
+
+/*
+ * macro declarations
+ */
+#define HAL_MISC_ENABLE_SPI_SERIAL_FLASH_BANK_ACCESS() \
+{ \
+ (MISC_CHIP_CONFIG_REG) |= (0x1 << 4); \
+}
+
+#define HAL_MISC_DISABLE_SPI_SERIAL_FLASH_BANK_ACCESS() \
+{ \
+ (MISC_CHIP_CONFIG_REG) &= ~(0x1 << 4); \
+}
+
+
+/*
+ * Macro defines for GPIOA and GPIOB Pin Enable Register
+ */
+#define HAL_MISC_ENABLE_EXT_INT29_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_EXT_INT29_PINS); \
+}
+
+#define HAL_MISC_DISABLE_EXT_INT29_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_EXT_INT29_PINS); \
+}
+
+#define HAL_MISC_ENABLE_EXT_INT30_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_EXT_INT30_PINS); \
+}
+
+#define HAL_MISC_DISABLE_EXT_INT30_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_EXT_INT30_PINS); \
+}
+
+#define HAL_MISC_ENABLE_I2C_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_I2C_PINS); \
+}
+
+#define HAL_MISC_DISABLE_I2C_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_I2C_PINS); \
+}
+
+#define HAL_MISC_ENABLE_I2S_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_I2S_PINS); \
+}
+
+#define HAL_MISC_DISABLE_I2S_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_I2S_PINS); \
+}
+
+#define HAL_MISC_DISABLE_I2SSD_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_I2SSD_PINS); \
+}
+
+#define HAL_MISC_DISABLE_I2SWS_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_I2SWS_PINS); \
+}
+
+#define HAL_MISC_DISABLE_I2SCLK_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_I2SCLK_PINS); \
+}
+
+#define HAL_MISC_ENABLE_PCM_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_PCM_PINS); \
+}
+
+#define HAL_MISC_DISABLE_PCM_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_PCM_PINS); \
+}
+
+#define HAL_MISC_DISABLE_PCMDR_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_PCMDR_PINS); \
+}
+
+#define HAL_MISC_DISABLE_PCMDT_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_PCMDT_PINS); \
+}
+
+#define HAL_MISC_DISABLE_PCMFS_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_PCMFS_PINS); \
+}
+
+#define HAL_MISC_DISABLE_PCMCLK_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_PCMCLK_PINS); \
+}
+
+#define HAL_MISC_ENABLE_LED0_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_LED0_PINS); \
+}
+
+#define HAL_MISC_DISABLE_LED0_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_LED0_PINS); \
+}
+
+#define HAL_MISC_ENABLE_LED1_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_LED1_PINS); \
+}
+
+#define HAL_MISC_DISABLE_LED1_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_LED1_PINS); \
+}
+
+#define HAL_MISC_ENABLE_LED2_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_LED2_PINS); \
+}
+
+#define HAL_MISC_DISABLE_LED2_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_LED2_PINS); \
+}
+
+#define HAL_MISC_ENABLE_LED012_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_LED012_PINS); \
+}
+
+#define HAL_MISC_DISABLE_LED012_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_LED012_PINS); \
+}
+
+#define HAL_MISC_ENABLE_WDTIMER_RESET_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_WDTIMER_RESET_PINS); \
+}
+
+#define HAL_MISC_DISABLE_WDTIMER_RESET_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_WDTIMER_RESET_PINS); \
+}
+
+#define HAL_MISC_ENABLE_SPI_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_SPI_PINS); \
+}
+
+#define HAL_MISC_ENABLE_SPIDR_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_SPIDR_PINS); \
+}
+
+#define HAL_MISC_ENABLE_SPICLK_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_SPICLK_PINS); \
+}
+
+#define HAL_MISC_ENABLE_SPICSN0_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_SPICSN0_PINS); \
+}
+
+#define HAL_MISC_ENABLE_SPICSN0_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_SPICSN0_PINS); \
+}
+
+#define HAL_MISC_ENABLE_SPICSN1_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_SPICSN1_PINS); \
+}
+
+#define HAL_MISC_ENABLE_SPICSN2_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_SPICSN2_PINS); \
+}
+
+#define HAL_MISC_ENABLE_SPICSN3_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_SPICSN3_PINS); \
+}
+
+#define HAL_MISC_DISABLE_SPI_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_SPI_PINS); \
+}
+
+#define HAL_MISC_DISABLE_SPIDR_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_SPIDR_PINS); \
+}
+
+#define HAL_MISC_DISABLE_SPICLK_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_SPICLK_PINS); \
+}
+
+#define HAL_MISC_DISABLE_SPICSN0_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_SPICSN0_PINS); \
+}
+
+#define HAL_MISC_DISABLE_SPICSN1_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_SPICSN1_PINS); \
+}
+
+#define HAL_MISC_DISABLE_SPICSN2_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_SPICSN2_PINS); \
+}
+
+#define HAL_MISC_DISABLE_SPICSN3_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_SPICSN3_PINS); \
+}
+
+#define HAL_MISC_ENABLE_UART0_ACT0_PIN() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_UART0_ACT0_Pin); \
+}
+
+#define HAL_MISC_DISABLE_UART0_ACT0_PIN() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_UART0_ACT0_Pin); \
+}
+
+#define HAL_MISC_ENABLE_UART1_ACT1_PIN() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) |= (MISC_UART1_ACT1_Pin); \
+}
+
+#define HAL_MISC_DISABLE_UART1_ACT1_PIN() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) &= ~(MISC_UART1_ACT1_Pin); \
+}
+
+#define HAL_MISC_ENABLE_MDC_MDIO_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) |= (MISC_MDC_MDIO_PINS); \
+}
+
+#define HAL_MISC_DISABLE_MDC_MDIO_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) &= ~(MISC_MDC_MDIO_PINS); \
+}
+
+#define HAL_MISC_ENABLE_NIC_COL_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) |= (MISC_NIC_COL_PINS); \
+}
+
+#define HAL_MISC_DISABLE_NIC_COL_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) &= ~(MISC_NIC_COL_PINS); \
+}
+
+#define HAL_MISC_ENABLE_IDE_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) |= (MISC_IDE_PINS); \
+}
+
+#define HAL_MISC_DISABLE_IDE_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) &= ~(MISC_IDE_PINS); \
+}
+
+#define HAL_MISC_ENABLE_SRAM_BANK1_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) |= (MISC_SRAM_BANK1_PINS); \
+}
+
+#define HAL_MISC_DISABLE_SRAM_BANK1_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) &= ~(MISC_SRAM_BANK1_PINS); \
+}
+
+#define HAL_MISC_ENABLE_SRAM_BANK2_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) |= (MISC_SRAM_BANK2_PINS); \
+}
+
+#define HAL_MISC_DISABLE_SRAM_BANK2_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) &= ~(MISC_SRAM_BANK2_PINS); \
+}
+
+#define HAL_MISC_ENABLE_SRAM_BANK3_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) |= (MISC_SRAM_BANK3_PINS); \
+}
+
+#define HAL_MISC_DISABLE_SRAM_BANK3_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) &= ~(MISC_SRAM_BANK3_PINS); \
+}
+
+#define HAL_MISC_ENABLE_PCMCIA_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) |= (MISC_PCMCIA_PINS); \
+}
+
+#define HAL_MISC_DISABLE_PCMCIA_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) &= ~(MISC_PCMCIA_PINS); \
+}
+
+#define HAL_MISC_ENABLE_UART1_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) |= (MISC_UART1_PINS); \
+}
+
+#define HAL_MISC_DISABLE_UART1_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) &= ~(MISC_UART1_PINS); \
+}
+
+#define HAL_MISC_ENABLE_PCI_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) |= (MISC_PCI_PINS); \
+}
+
+#define HAL_MISC_DISABLE_PCI_PINS() \
+{ \
+ (MISC_GPIOB_PIN_ENABLE_REG) &= ~(MISC_PCI_PINS); \
+}
+
+#define HAL_MISC_ENABLE_ALL_SHARED_GPIO_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) = (0x0); \
+ (MISC_GPIOB_PIN_ENABLE_REG) = (0x0); \
+}
+
+#define HAL_MISC_DISABLE_ALL_SHARED_GPIO_PINS() \
+{ \
+ (MISC_GPIOA_PIN_ENABLE_REG) = (0xFFFFFFFF); \
+ (MISC_GPIOB_PIN_ENABLE_REG) = (0xFFFFFFFF); \
+}
+
+#define HAL_MISC_CONFIGURE_GPIOA_RESISTOR(pin_index, value) \
+{ \
+ (MISC_GPIOA_RESISTOR_CONFIG_REG) &= ~(0x3 << (2 * pin_index)); \
+ (MISC_GPIOA_RESISTOR_CONFIG_REG) |= ((value & 0x3) << (2 * pin_index)); \
+}
+
+#define HAL_MISC_CONFIGURE_GPIOA_DRIVE_STRENGTH(pin_index, value) \
+{ \
+ (MISC_GPIOA_DRIVE_STRENGTH_CONFIG_REG) &= ~(0x1 << pin_index); \
+ (MISC_GPIOA_DRIVE_STRENGTH_CONFIG_REG) |= (value << pin_index); \
+}
+
+#define HAL_MISC_SELECT_FAST_ETHERNET_PHY_LED_MODE0() \
+{ \
+ (MISC_FAST_ETHERNET_PHY_CONFIG_REG) = (0x0); \
+}
+
+#define HAL_MISC_SELECT_FAST_ETHERNET_PHY_LED_MODE1() \
+{ \
+ (MISC_FAST_ETHERNET_PHY_CONFIG_REG) = (0x1); \
+}
+
+#define HAL_MISC_SELECT_FAST_ETHERNET_PHY_LED_MODE2() \
+{ \
+ (MISC_FAST_ETHERNET_PHY_CONFIG_REG) = (0x2); \
+}
+
+#define HAL_MISC_SELECT_FAST_ETHERNET_PHY_LED_MODE3() \
+{ \
+ (MISC_FAST_ETHERNET_PHY_CONFIG_REG) = (0x3); \
+}
+
+
+#endif // end of #ifndef _STAR_MISC_H_
|