aboutsummaryrefslogtreecommitdiffstats
path: root/meta-moblin/packages/linux/linux-moblin-2.6.33.2/linux-2.6.34-pch-dma.patch
blob: e3fddb2df7c5c60d5bee9c9b1e25cbac1ec52ba1 (plain)
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
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
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
---
 drivers/dma/Kconfig                |    9 
 drivers/dma/Makefile               |    1 
 drivers/dma/pch_dma/Makefile       |    5 
 drivers/dma/pch_dma/pch_common.h   |  146 ++++
 drivers/dma/pch_dma/pch_debug.h    |   60 +
 drivers/dma/pch_dma/pch_dma_hal.c  | 1203 +++++++++++++++++++++++++++++++++++++
 drivers/dma/pch_dma/pch_dma_hal.h  |  594 ++++++++++++++++++
 drivers/dma/pch_dma/pch_dma_main.c | 1026 +++++++++++++++++++++++++++++++
 drivers/dma/pch_dma/pch_dma_main.h |  264 ++++++++
 drivers/dma/pch_dma/pch_dma_pci.c  |  694 +++++++++++++++++++++
 drivers/dma/pch_dma/pch_dma_pci.h  |   74 ++
 11 files changed, 4076 insertions(+)

--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -51,6 +51,15 @@ config LNW_DMA_DEBUG
 	help
 	  Enable logging in the LNW DMA drivers
 
+config PCH_UART_DMA
+	tristate "PCH DMA Controller"
+	depends on PCI && SERIAL_8250_PCH_DMA
+	select DMA_ENGINE
+	default y
+	help
+	  This value must equal to SERIAL_8250_PCH. This config PCH_UART_DMA is
+	  referred by PCH UART.
+
 config INTEL_IOATDMA
 	tristate "Intel I/OAT DMA support"
 	depends on PCI && X86
--- a/drivers/dma/Makefile
+++ b/drivers/dma/Makefile
@@ -14,4 +14,5 @@ obj-$(CONFIG_TXX9_DMAC) += txx9dmac.o
 obj-$(CONFIG_SH_DMAE) += shdma.o
 obj-$(CONFIG_COH901318) += coh901318.o coh901318_lli.o
 obj-$(CONFIG_AMCC_PPC440SPE_ADMA) += ppc4xx/
+obj-$(CONFIG_PCH_UART_DMA) += pch_dma/
 obj-$(CONFIG_TIMB_DMA) += timb_dma.o
--- /dev/null
+++ b/drivers/dma/pch_dma/Makefile
@@ -0,0 +1,5 @@
+#enable for debug;this can be added in Kconfig
+#EXTRA_CFLAGS += -DDEBUG
+
+obj-$(CONFIG_PCH_UART_DMA) += pch_dma.o
+pch_dma-objs := pch_dma_pci.o pch_dma_hal.o pch_dma_main.o
--- /dev/null
+++ b/drivers/dma/pch_dma/pch_common.h
@@ -0,0 +1,146 @@
+/*!
+ * @file ioh_common.h
+ * @brief Provides the macro definitions used by all files.
+ * @version 1.0.0.0
+ * @section
+ * 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; version 2 of the License.
+ *
+ * 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.
+ */
+
+/*
+ * History:
+ * Copyright (C) 2008 OKI SEMICONDUCTOR Co., LTD.
+ * All rights reserved.
+ *
+ * created:
+ *	WIPRO 03/07/2009
+ * modified:
+ *	WIPRO 05/08/2009
+ *
+ */
+
+#ifndef __IOH_COMMON_H__
+#define __IOH_COMMON_H__
+
+/*! @ingroup	Global
+@def		    IOH_WRITE8
+@brief			Macro for writing 8 bit data to an io/mem address
+*/
+#define IOH_WRITE8(val, addr)   iowrite8((val), (void __iomem *)(addr))
+/*! @ingroup	Global
+@def		    IOH_LOG
+@brief			Macro for writing 16 bit data to an io/mem address
+*/
+#define IOH_WRITE16(val, addr)  iowrite16((val), (void __iomem *)(addr))
+/*! @ingroup	Global
+@def		    IOH_LOG
+@brief			Macro for writing 32 bit data to an io/mem address
+*/
+#define IOH_WRITE32(val, addr)  iowrite32((val), (void __iomem *)(addr))
+
+/*! @ingroup	Global
+@def		    IOH_READ8
+@brief			Macro for reading 8 bit data from an io/mem address
+*/
+#define IOH_READ8(addr)   ioread8((void __iomem *)(addr))
+/*! @ingroup	Global
+@def		    IOH_READ16
+@brief			Macro for reading 16 bit data from an io/mem address
+*/
+#define IOH_READ16(addr)  ioread16((void __iomem *)(addr))
+/*! @ingroup	Global
+@def		    IOH_READ32
+@brief			Macro for reading 32 bit data from an io/mem address
+*/
+#define IOH_READ32(addr)  ioread32((void __iomem *)(addr))
+/*! @ingroup	Global
+@def		    IOH_WRITE32_F
+@brief			Macro for writing 32 bit data to an io/mem address
+*/
+#define IOH_WRITE32_F(val, addr) do \
+	{ IOH_WRITE32((val), (addr)); (void)IOH_READ32((addr)); } while (0);
+
+/*! @ingroup	Global
+@def		    IOH_WRITE_BYTE
+@brief			Macro for writing 1 byte data to an io/mem address
+*/
+#define IOH_WRITE_BYTE IOH_WRITE8
+/*! @ingroup	Global
+@def		    IOH_WRITE_WORD
+@brief			Macro for writing 1 word data to an io/mem address
+*/
+#define IOH_WRITE_WORD IOH_WRITE16
+/*! @ingroup	Global
+@def		    IOH_WRITE_LONG
+@brief			Macro for writing long data to an io/mem address
+*/
+#define IOH_WRITE_LONG IOH_WRITE32
+
+/*! @ingroup	Global
+@def		    IOH_READ_BYTE
+@brief			Macro for reading 1 byte data from an io/mem address
+*/
+#define IOH_READ_BYTE  IOH_READ8
+/*! @ingroup	Global
+@def		    IOH_READ_WORD
+@brief			Macro for reading 1 word data from an io/mem address
+*/
+#define IOH_READ_WORD  IOH_READ16
+/*! @ingroup	Global
+@def		    IOH_READ_LONG
+@brief			Macro for reading long data from an io/mem address
+*/
+#define IOH_READ_LONG  IOH_READ32
+
+/* Bit Manipulation Macros */
+
+/*! @ingroup	Global
+@def		    IOH_READ_LONG
+@brief			macro to set a specified bit(mask) at the
+			specified address
+*/
+#define IOH_SET_ADDR_BIT(addr, bitmask) IOH_WRITE_LONG((IOH_READ_LONG(addr) |\
+							 (bitmask)), (addr))
+
+/*! @ingroup	Global
+@def	    IOH_READ_LONG
+@brief		macro to clear a specified bit(mask) at the specified address
+*/
+#define IOH_CLR_ADDR_BIT(addr, bitmask) IOH_WRITE_LONG((IOH_READ_LONG(addr) &\
+							 ~(bitmask)), (addr))
+
+/*! @ingroup	Global
+@def		    IOH_READ_LONG
+@brief			macro to set a specified bitmask for a variable
+*/
+#define IOH_SET_BITMSK(var, bitmask) ((var) |= (bitmask))
+
+/*! @ingroup	Global
+@def		    IOH_READ_LONG
+@brief			macro to clear a specified bitmask for a variable
+*/
+#define IOH_CLR_BITMSK(var, bitmask) ((var) &= (~(bitmask)))
+
+/*! @ingroup	Global
+@def		    IOH_READ_LONG
+@brief			macro to set a specified bit for a variable
+*/
+#define IOH_SET_BIT(var, bit) ((var) |= (1<<(bit)))
+
+/*! @ingroup	Global
+@def		    IOH_READ_LONG
+@brief			macro to clear a specified bit for a variable
+*/
+#define IOH_CLR_BIT(var, bit) ((var) &= ~(1<<(bit)))
+
+#endif
--- /dev/null
+++ b/drivers/dma/pch_dma/pch_debug.h
@@ -0,0 +1,60 @@
+/*!
+ * @file ioh_debug.h
+ * @brief Provides the macro definitions used for debugging.
+ * @version 1.0.0.0
+ * @section
+ * 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; version 2 of the License.
+ *
+ * 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.
+ */
+
+/*
+ * History:
+ * Copyright (C) 2008 OKI SEMICONDUCTOR Co., LTD.
+ * All rights reserved.
+ *
+ * created:
+ *	WIPRO 03/07/2009
+ * modified:
+ *	WIPRO 05/08/2009
+ *
+ */
+
+#ifndef __IOH_DEBUG_H__
+#define __IOH_DEBUG_H__
+
+#ifdef MODULE
+#define IOH_LOG(level, fmt, args...) printk(level "%s:" fmt "\n",\
+						 THIS_MODULE->name, ##args)
+#else
+#define IOH_LOG(level, fmt, args...) printk(level "%s:" fmt "\n" ,\
+							 __FILE__, ##args)
+#endif
+
+
+#ifdef DEBUG
+	#define IOH_DEBUG(fmt, args...) IOH_LOG(KERN_DEBUG, fmt, ##args)
+#else
+	#define IOH_DEBUG(fmt, args...)
+#endif
+
+#ifdef IOH_TRACE_ENABLED
+	#define IOH_TRACE IOH_DEBUG
+#else
+	#define IOH_TRACE(fmt, args...)
+#endif
+
+#define IOH_TRACE_ENTER IOH_TRACE("Enter %s", __func__)
+#define IOH_TRACE_EXIT 	IOH_TRACE("Exit %s", __func__)
+
+
+#endif
--- /dev/null
+++ b/drivers/dma/pch_dma/pch_dma_hal.c
@@ -0,0 +1,1203 @@
+/**
+ * @file ioh_dma_hal.c
+ *
+ * @brief
+ *		This file defines the IOH_DMA_CONTROLLER HAL API functions.
+ *
+ * @version 0.90
+ * @section
+ * 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; version 2 of the License.
+ *
+ * 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.
+ *
+ * <hr>
+ */
+
+/*
+ * History:
+ * Copyright (C) 2008 OKI SEMICONDUCTOR Co., LTD.
+ * All rights reserved.
+ *
+ * created:
+ *	WIPRO 03/07/2009
+ * modified:
+ *	WIPRO 08/14/2009
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/io.h>
+#include <linux/string.h>
+#include <linux/module.h>
+
+#include "pch_common.h"
+#include "pch_debug.h"
+#include "pch_dma_hal.h"
+
+/*!	@ingroup	HALLayer
+	@def		IOH_DMA_BIT_SET
+	@brief		Macro for setting selected bits of a register.
+	@remarks	This macro is used to set the selected bits
+				at a given 32 bit location. Normally it is
+				used to set the bits of given register.
+*/
+#define IOH_DMA_BIT_SET(reg, bitmask) \
+		 IOH_WRITE_LONG(((IOH_READ_LONG((reg)) | bitmask)), (reg))
+
+/*!	@ingroup	HALLayer
+	@def		IOH_DMA_BIT_CLEAR
+	@brief		Macro for re-setting selected bits of a register.
+	@remarks	This macro is used to reset the selected bits
+				at a given 32 bit location. Normally it is
+				used to reset the bits of given register.
+*/
+#define IOH_DMA_BIT_CLEAR(regAddr, bitMask) \
+		IOH_WRITE_LONG((IOH_READ_LONG((regAddr)) & (~(bitMask))), \
+		(regAddr))
+
+/*!	@ingroup	HALLayer
+	@def		DEFAULT_CONTROL_REGISTER_VALUE
+	@brief		Macro for setting selected bits of control register.
+	@remarks	This macro is used to set the mode and direction
+				bit of the control register of a specific
+				channel without affecting the settings of other
+				channels.
+*/
+#define DEFAULT_CONTROL_REGISTER_VALUE	(0x33333333)
+
+/*!	@ingroup	HALLayer
+	@def		dma_clear_interrupt_status
+	@brief		Macro for clearing the interrupt status of the
+				DMA.
+	@remarks	This macro is used to clear the interrupt status
+				bits of the DMA during handling of interrupts.
+*/
+#define dma_clear_interrupt_status(addr, stat0, stat2)		\
+do {								\
+	IOH_WRITE_LONG((stat0), ((addr) + DMA_STS0_OFFSET));	\
+	IOH_WRITE_LONG((stat2), ((addr) + DMA_STS2_OFFSET));	\
+} while (0)
+
+/*!	@ingroup	HALLayer
+	@def		dma_get_interrupt_status
+	@brief		Macro for getting the interrupt status of a
+				specific channel
+	@remarks	This macro is used to get the interrupt status
+				of the DMA during handling of interrupts.
+*/
+#define dma_get_interrupt_status(ch, stat0, stat2)			\
+(									\
+	((ch) < 8) ?							\
+	(((stat0) & (DMA_INTERRUPT_OCCUR << ch)) != 0)			\
+	:								\
+	(((stat2) & (DMA_INTERRUPT_OCCUR << (ch - 8))) != 0)		\
+)
+
+/*!	@ingroup	HALLayer
+	@def		dma_get_abort_status
+	@brief		Macro for getting the abort status of a specific
+				channel.
+	@remarks	This macro is used to get the abort status
+				of the DMA during handling of interrupts.
+*/
+#define dma_get_abort_status(ch, stat0, stat2)				\
+(									\
+	((ch) < 8) ?							\
+	(((stat0) & (DMA_ABORT_OCCUR << ch)) != 0)			\
+	:								\
+	(((stat2) & (DMA_ABORT_OCCUR << (ch - 8))) != 0)		\
+)
+
+/* Global Varibles */
+/*!	@ingroup	Global
+	@var		ioh_dma_channel_info
+	@brief		Retains the specific channel information.
+*/
+struct ioh_dma_controller_info ioh_dma_channel_info[IOH_DMA_CHANNELS_MAX];
+
+/* Channel Allocation Table for DMA */
+/*!	@ingroup	Global
+	@var		ioh_dma_channel_table
+	@brief		Retains the specific channel allocation
+				information.
+*/
+struct ioh_dma_channel_alloc_table ioh_dma_channel_table[IOH_DMA_CHANNELS_MAX]
+= {
+	/* 4 channel DMA device0 (Reserved for GE.) */
+	{IOH_DMA_4CH0, IOH_DMA_TX_DATA_REQ0, PCI_DEVICE_ID_IOH_SPI, 0, 0, 0, 0},
+	{IOH_DMA_4CH0, IOH_DMA_RX_DATA_REQ0, PCI_DEVICE_ID_IOH_SPI, 1, 0, 0, 0},
+	{IOH_DMA_4CH0, 0, 0, 2, 0, 0, 0},
+	{IOH_DMA_4CH0, 0, 0, 3, 0, 0, 0},
+
+	/* 4 channel DMA device1 (Not reserved.) */
+	{IOH_DMA_4CH1, 0, 0, 0, 0, 0, 0},
+	{IOH_DMA_4CH1, 0, 0, 1, 0, 0, 0},
+	{IOH_DMA_4CH1, 0, 0, 2, 0, 0, 0},
+	{IOH_DMA_4CH1, 0, 0, 3, 0, 0, 0},
+
+	/* 4 channel DMA device2 (Not reserved.) */
+	{IOH_DMA_4CH2, 0, 0, 0, 0, 0, 0},
+	{IOH_DMA_4CH2, 0, 0, 1, 0, 0, 0},
+	{IOH_DMA_4CH2, 0, 0, 2, 0, 0, 0},
+	{IOH_DMA_4CH2, 0, 0, 3, 0, 0, 0},
+
+	/* 4 channel DMA device3 (Not reserved.) */
+	{IOH_DMA_4CH3, 0, 0, 0, 0, 0, 0},
+	{IOH_DMA_4CH3, 0, 0, 1, 0, 0, 0},
+	{IOH_DMA_4CH3, 0, 0, 2, 0, 0, 0},
+	{IOH_DMA_4CH3, 0, 0, 3, 0, 0, 0},
+
+	/* 4 channel DMA device4 (Not reserved.) */
+	{IOH_DMA_4CH4, 0, 0, 0, 0, 0, 0},
+	{IOH_DMA_4CH4, 0, 0, 1, 0, 0, 0},
+	{IOH_DMA_4CH4, 0, 0, 2, 0, 0, 0},
+	{IOH_DMA_4CH4, 0, 0, 3, 0, 0, 0},
+
+	/* 8 channel DMA device0 (Reserved for GE.) */
+	{IOH_DMA_8CH0, IOH_DMA_TX_DATA_REQ0, PCI_DEVICE_ID_IOH_UART0, 0, 0, 0,
+	 0},
+	{IOH_DMA_8CH0, IOH_DMA_RX_DATA_REQ0, PCI_DEVICE_ID_IOH_UART0, 1, 0, 0,
+	 0},
+	{IOH_DMA_8CH0, IOH_DMA_TX_DATA_REQ0, PCI_DEVICE_ID_IOH_UART1, 2, 0, 0,
+	 0},
+	{IOH_DMA_8CH0, IOH_DMA_RX_DATA_REQ0, PCI_DEVICE_ID_IOH_UART1, 3, 0, 0,
+	 0},
+	{IOH_DMA_8CH0, IOH_DMA_TX_DATA_REQ0, PCI_DEVICE_ID_IOH_UART2, 4, 0, 0,
+	 0},
+	{IOH_DMA_8CH0, IOH_DMA_RX_DATA_REQ0, PCI_DEVICE_ID_IOH_UART2, 5, 0, 0,
+	 0},
+	{IOH_DMA_8CH0, IOH_DMA_TX_DATA_REQ0, PCI_DEVICE_ID_IOH_UART3, 6, 0, 0,
+	 0},
+	{IOH_DMA_8CH0, IOH_DMA_RX_DATA_REQ0, PCI_DEVICE_ID_IOH_UART3, 7, 0, 0,
+	 0},
+
+	/* 8 channel DMA device1 */
+	{IOH_DMA_8CH1, 0, 0, 0, 0, 0, 0},
+	{IOH_DMA_8CH1, 0, 0, 1, 0, 0, 0},
+	{IOH_DMA_8CH1, 0, 0, 2, 0, 0, 0},
+	{IOH_DMA_8CH1, 0, 0, 3, 0, 0, 0},
+	{IOH_DMA_8CH1, 0, 0, 4, 0, 0, 0},
+	{IOH_DMA_8CH1, 0, 0, 5, 0, 0, 0},
+	{IOH_DMA_8CH1, 0, 0, 6, 0, 0, 0},
+	{IOH_DMA_8CH1, 0, 0, 7, 0, 0, 0},
+
+	/* 8 channel DMA device2 */
+	{IOH_DMA_8CH2, 0, 0, 0, 0, 0, 0},
+	{IOH_DMA_8CH2, 0, 0, 1, 0, 0, 0},
+	{IOH_DMA_8CH2, 0, 0, 2, 0, 0, 0},
+	{IOH_DMA_8CH2, 0, 0, 3, 0, 0, 0},
+	{IOH_DMA_8CH2, 0, 0, 4, 0, 0, 0},
+	{IOH_DMA_8CH2, 0, 0, 5, 0, 0, 0},
+	{IOH_DMA_8CH2, 0, 0, 6, 0, 0, 0},
+	{IOH_DMA_8CH2, 0, 0, 7, 0, 0, 0},
+
+	/* 8 channel DMA device3 (Doubts in allocating.) */
+	{IOH_DMA_8CH3, 0, 0, 0, 0, 0, 0},
+	{IOH_DMA_8CH3, 0, 0, 1, 0, 0, 0},
+	{IOH_DMA_8CH3, 0, 0, 2, 0, 0, 0},
+	{IOH_DMA_8CH3, 0, 0, 3, 0, 0, 0},
+	{IOH_DMA_8CH3, 0, 0, 4, 0, 0, 0},
+	{IOH_DMA_8CH3, 0, 0, 5, 0, 0, 0},
+	{IOH_DMA_8CH3, 0, 0, 6, 0, 0, 0},
+	{IOH_DMA_8CH3, 0, 0, 7, 0, 0, 0},
+
+	/* 12 channel DMA device0 */
+	{IOH_DMA_12CH0, 0, 0, 0, 0, 0, 0},
+	{IOH_DMA_12CH0, 0, 0, 1, 0, 0, 0},
+	{IOH_DMA_12CH0, 0, 0, 2, 0, 0, 0},
+	{IOH_DMA_12CH0, 0, 0, 3, 0, 0, 0},
+	{IOH_DMA_12CH0, 0, 0, 4, 0, 0, 0},
+	{IOH_DMA_12CH0, 0, 0, 5, 0, 0, 0},
+	{IOH_DMA_12CH0, 0, 0, 6, 0, 0, 0},
+	{IOH_DMA_12CH0, 0, 0, 7, 0, 0, 0},
+	{IOH_DMA_12CH0, 0, 0, 8, 0, 0, 0},
+	{IOH_DMA_12CH0, 0, 0, 9, 0, 0, 0},
+	{IOH_DMA_12CH0, 0, 0, 10, 0, 0, 0},
+	{IOH_DMA_12CH0, 0, 0, 11, 0, 0, 0}
+};
+
+/* Function Definitions */
+
+/*!	@ingroup	HALLayerAPI
+	@fn			void __init dma_init(u32 base, u32 dev_type)
+	@brief		Initializes local data structures for the DMAC device.
+	@remarks	This function is called when a DMA device is detected.
+				It initializes the data structures associated
+				with the obtained device. The main tasks
+				performed by this function are:
+				- Waits until the status of a DMA channel
+				becomes idle and then disables it.
+				- Initializes the data structures that can
+				be used further.
+
+	@param		base		[@ref IN]	The base address.
+	@param		dev_type	[@ref IN]	The type of the device.
+
+	@return	None.
+
+	@see
+			- ioh_dma_probe
+ */
+
+void __init dma_init(u32 base, u32 dev_type)
+{
+	int i;
+	u32 counter;
+	u16 DMAStatus;
+
+	for (i = 0; i < IOH_DMA_CHANNELS_MAX; i++) {
+		if (ioh_dma_channel_table[i].dma_dev_id == dev_type) {
+			counter = COUNTER_LIMIT;
+
+			ioh_dma_channel_table[i].ch_found = 1;
+			ioh_dma_channel_table[i].ch_alloced = 0;
+			ioh_dma_channel_table[i].base = base;
+
+			do {
+				get_dma_status(i, &DMAStatus);
+			} while ((counter--) && (DMAStatus != DMA_STATUS_IDLE));
+
+			(void)dma_disable_ch(i);
+			IOH_DEBUG("dma_init -> Channel %d disabled.\n", i);
+
+			(void)dma_enable_disable_interrupt
+			    (i, IOH_DMA_INTERRUPT_DISABLE);
+			IOH_DEBUG
+			    ("dma_init -> Interrupt disabled for channel %d.\n",
+			     i);
+		}
+	}
+
+	IOH_DEBUG("Function dma_init invoked successfully.\n");
+}
+
+/*!	@ingroup	HALLayerAPI
+	@fn			void dma_exit(u32 dev_type)
+	@brief		De-initializes the DMA device.
+	@remarks	The main tasks performed by this function are:
+				- Waits for a small interval for each channel
+				if the channel is not idle so that it can
+				complete its transfer.
+				- Disables the channel.
+				- Disables the concerned interrupt.
+
+	@param		dev_type	[@ref IN]	The type of the device.
+
+	@return		None
+
+	@see
+		- ioh_dma_remove
+		- ioh_dma_suspend
+*/
+void dma_exit(u32 dev_type)
+{
+	int i;
+	u32 counter;
+	u16 DMAStatus;
+
+	for (i = 0; i < IOH_DMA_CHANNELS_MAX; i++) {
+		if (ioh_dma_channel_table[i].dma_dev_id == dev_type &&
+		    ioh_dma_channel_table[i].ch_found == 1) {
+			counter = COUNTER_LIMIT;
+			get_dma_status(i, &DMAStatus);
+
+			while ((counter > 0) &&
+			       (DMAStatus != DMA_STATUS_IDLE)) {
+				counter--;
+				get_dma_status(i, &DMAStatus);
+			}
+
+			(void)dma_disable_ch(i);
+			IOH_DEBUG("dma_exit -> Channel %d disabled.\n", i);
+
+			(void)dma_enable_disable_interrupt
+			    (i, IOH_DMA_INTERRUPT_DISABLE);
+			IOH_DEBUG("dma_exit -> Interrupt disabled for channel "
+				  "%d.\n", i);
+		}
+	}
+
+	IOH_DEBUG("Function dma_exit invoked successfully.\n");
+}
+
+/*!	@ingroup	HALLayerAPI
+	@fn	int dma_set_mode(int channel,
+			struct ioh_dma_mode_param stModeParam)
+	@brief		Sets the Mode of transfer for DMA.
+	@remarks	Does the setting of direction of transfer, access size
+				type and transfer mode. This function does not
+				perform any register write. The main tasks
+				performed by this function are:
+				- Set the DMATransferDirection field of @ref
+				ioh_dma_channel_info with the direction of
+				transfer specified.
+				- Set the DMAAccessSize field of @ref
+				ioh_dma_channel_info with the Access Size Type
+				specified.
+				- Set the DMATransferMode field of @ref
+				ioh_dma_channel_info structure with the DMA mode
+				specified.
+
+	@param	channel	[@ref IN]	The channel for which mode is to be set.
+	@param	stModeParam	[@ref IN]	Structure which contains the
+					parameters for the setting of Mode.
+
+	@return		int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+
+	@see
+			- ioh_set_dma_mode
+ */
+int dma_set_mode(int channel, struct ioh_dma_mode_param stModeParam)
+{
+	ioh_dma_channel_info[channel].DMAAccessSize = stModeParam.DMASizeType;
+	ioh_dma_channel_info[channel].DMATransferMode =
+	    stModeParam.DMATransferMode;
+	ioh_dma_channel_info[channel].DMATransferDirection =
+	    stModeParam.TransferDirection;
+
+	IOH_DEBUG("Function dma_set_mode returns %d.\n", IOH_DMA_SUCCESS);
+	return IOH_DMA_SUCCESS;
+}
+
+/*! @ingroup	HALLayerAPI
+	@fn		int dma_set_addr(int channel, u32 iaddr, u32 oaddr)
+	@brief		Sets the Inside and Outside address in the case
+				of ONE SHOT MODE
+	@remarks	This function updates Inside address and outside
+				address to be set in ONE SHOT mode. The main
+				tasks performed by this function are:
+				- Set the field in_addr of the @ref
+				ioh_dma_channel_info structure of the
+				corresponding channel to the value of the
+				argument iaddr.
+				- Set the field out_addr of the @ref
+				ioh_dma_channle_info structure of the
+				corresponding channel to the value of the
+				argument oaddr.
+
+	@param		channel	[@ref IN]	Channel for which addresses is
+				to be set.
+	@param		iaddr	[@ref IN]	Inside address to be set
+	@param		oaddr	[@ref IN]	Outside address to be set
+
+	@return		int
+			- @ref IOH_DMA_SUCCESS	--> On Success.
+
+	@see
+			- ioh_set_dma_addr
+
+  */
+int dma_set_addr(int channel, u32 iaddr, u32 oaddr)
+{
+	ioh_dma_channel_info[channel].in_addr = iaddr;
+	ioh_dma_channel_info[channel].out_addr = oaddr;
+
+	IOH_DEBUG("Function dma_set_addr returns %d.\n", IOH_DMA_SUCCESS);
+	return IOH_DMA_SUCCESS;
+}
+
+/*! @ingroup	HALLayerAPI
+	@fn			int dma_enable_ch(int channel)
+	@brief		Enables the DMA channel specified.
+	@remarks	This function sets the entire DMA settings such as
+				the transfer direction, transfer mode and
+				enables the channel. The main tasks performed by
+				this function are:
+				- Sets the transfer direction.
+				- Sets the transfer mode.
+				- Enabling the channel.
+
+	@param		channel		[@ref IN]	Channel number that
+					is to be enabled.
+
+	@return		int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+
+	@see
+			- ioh_enable_dma
+ */
+int dma_enable_ch(int channel)
+{
+	u32 base_address;
+	u16 transfer_mode;
+	u32 ctl0;
+	u32 ctrl_val = DEFAULT_CONTROL_REGISTER_VALUE;
+	int ch;
+
+	/* Marking the channel as enabled. */
+	ioh_dma_channel_info[channel].bChEnabled = 1;
+
+	ch = ioh_dma_channel_table[channel].channel;
+	base_address = ioh_dma_channel_table[channel].base;
+
+	ctl0 = 0;
+
+	/* Setting of transfer direction. */
+	if (ioh_dma_channel_info[channel].DMATransferDirection ==
+	    IOH_DMA_DIR_OUT_TO_IN) {
+		ctl0 |= IOH_DMA_DIR_OUT_TO_IN;
+	}
+
+	/* Setting the transfer mode features. */
+	transfer_mode = ioh_dma_channel_info[channel].DMATransferMode;
+
+	/* If scatter gather mode. */
+	if (transfer_mode == DMA_SCATTER_GATHER_MODE) {
+		u32 next_desc;
+
+		next_desc = ((u32) ioh_dma_channel_info[channel].pHeadOfList);
+		IOH_WRITE_LONG(next_desc, (base_address + (DMA_NX_AD_OFFSET +
+							   (ch * 0x10))));
+
+		ctl0 |= DMA_SCATTER_GATHER_MODE;
+	}
+	/* If one shot mode. */
+	else {
+		u32 in_address = ioh_dma_channel_info[channel].in_addr;
+		u32 out_address = ioh_dma_channel_info[channel].out_addr;
+		u32 access_size = ioh_dma_channel_info[channel].DMAAccessSize;
+		u32 count = ioh_dma_channel_info[channel].DMATransferSize;
+
+		ctl0 |= DMA_ONE_SHOT_MODE;
+
+		count |= access_size;
+
+		IOH_WRITE_LONG(in_address,
+			       (base_address +
+				(DMA_IN_AD_OFFSET + (ch * 0x10))));
+		IOH_WRITE_LONG(out_address,
+			       (base_address +
+				(DMA_OUT_AD_OFFSET + (ch * 0x10))));
+		IOH_WRITE_LONG(count,
+			       (base_address + (DMA_SZ_OFFSET + (ch * 0x10))));
+	}
+
+	/* Enabling the interrupts. */
+	(void)dma_enable_disable_interrupt(channel, IOH_DMA_INTERRUPT_ENABLE);
+
+	/* Updating Control register. */
+	if (ch < 8) {
+		/* Clearing the three bits corresponding
+		   to the mode and transfer direction of
+		   specific channel.
+		 */
+		ctrl_val &= ~((MSK_ALL_THREE) << (ch * DMA_SHIFT_MODE_BITS));
+
+		/* Setting the transfer mode and direction. */
+		ctrl_val |= (ctl0 << (ch * DMA_SHIFT_MODE_BITS));
+
+		/* Updating to the register. */
+		IOH_WRITE_LONG(ctrl_val, (base_address + DMA_CTL0_OFFSET));
+
+		IOH_DEBUG("dma_enable -> Control register(0) value: "
+			  "%x.\n",
+			  IOH_READ_LONG((base_address + DMA_CTL0_OFFSET)));
+	} else {
+		/* Clearing the three bits corresponding
+		   to the mode and transfer direction of
+		   specific channel.
+		 */
+		ctrl_val &=
+		    ~((MSK_ALL_THREE) << ((ch - 8) * DMA_SHIFT_MODE_BITS));
+
+		/* Setting the transfer mode and direction. */
+		ctrl_val |= (ctl0 << ((ch - 8) * DMA_SHIFT_MODE_BITS));
+
+		/* Updating to the register. */
+		IOH_WRITE_LONG(ctrl_val, (base_address + DMA_CTL3_OFFSET));
+
+		IOH_DEBUG("dma_enable -> Control register(3) value: "
+			  "%x.\n",
+			  IOH_READ_LONG((base_address + DMA_CTL3_OFFSET)));
+	}
+
+	IOH_DEBUG("Function dma_enable_ch returns %d.\n", IOH_DMA_SUCCESS);
+	return IOH_DMA_SUCCESS;
+}
+
+/*! @ingroup	HALLayerAPI
+	@fn			int dma_disable_ch(int channel)
+	@brief		Disables the DMA channel specified.
+	@remarks	This function performs the necessary
+				register updation in-order to disable
+				the DMA channel.
+
+	@param		channel	[@ref IN]	Channel to be disabled.
+
+	@return		int
+			- @ref IOH_DMA_SUCCESS
+
+	@see
+			- ioh_disable_dma
+ */
+int dma_disable_ch(int channel)
+{
+	u32 base_address;
+	u16 ch;
+
+	ch = ioh_dma_channel_table[channel].channel;
+	base_address = ioh_dma_channel_table[channel].base;
+
+	if (channel < 8) {
+		/* Clearing the mode bits of the channel */
+		IOH_DMA_BIT_CLEAR((base_address + DMA_CTL0_OFFSET),
+				  (DMA_MASK_MODE_BITS <<
+				   (ch * DMA_SHIFT_MODE_BITS)));
+	} else {
+		/* Clearing the mode bits of the channel */
+		IOH_DMA_BIT_CLEAR((base_address + DMA_CTL3_OFFSET),
+				  (DMA_MASK_MODE_BITS <<
+				   ((ch - 8) * DMA_SHIFT_MODE_BITS)));
+	}
+
+	/* Updating the enable variable. */
+	ioh_dma_channel_info[channel].bChEnabled = (u16) 0;
+
+	IOH_DEBUG("Function dma_disable_ch returns " "%d.\n", IOH_DMA_SUCCESS);
+	return IOH_DMA_SUCCESS;
+}
+
+/*! @ingroup	HALLayerAPI
+	@fn			int dma_set_count (int channel, u32 count)
+	@brief		Sets the count value .
+	@remarks	Updates the transfer size for ONE_SHOT_MODE
+				of DMA Transfer. The main tasks performed by
+				this function are:
+				- Set the DMATransferSize field of the
+				@ref ioh_dma_channel_info structure to the
+				value of the argument count.
+
+	@param		channel		[@ref IN]	Channel number for
+					which value is to be set
+	@param		count		[@ref IN]	Transfer Size value.
+
+	@return		int
+			- @ref IOH_DMA_SUCCESS
+
+	@see
+			- ioh_set_dma_count
+ */
+int dma_set_count(int channel, u32 count)
+{
+	ioh_dma_channel_info[channel].DMATransferSize = count;
+
+	IOH_DEBUG("Function dma_set_count returns %d.\n", IOH_DMA_SUCCESS);
+	return IOH_DMA_SUCCESS;
+}
+
+/*! @ingroup	HALLayerAPI
+	@fn		int dma_add_desc(int channel,
+				struct ioh_dma_desc *start,
+				struct ioh_dma_desc *end)
+	@brief		Adds descriptors to the existing list of descriptors.
+	@remarks	This function accepts the descriptor list and appends
+				it to the existing list of descriptors. The main
+				tasks performed by this function are:
+				- Obtains the virtual address of the end of the
+				currently set descriptor list. If it is not
+				successful returns with an error.
+				- Appends the value of the argument start to the
+				nextDesc field of the descriptor pointed by the
+				pTailOfList field of the
+				@ref ioh_dma_channel_info structure with the
+				value of the argument start after appropriately
+				setting the last two bits to denote
+				Follow_Next_Descriptor_Without_Interrupt.
+				- Updates the value of the argument end to the
+				pTailOfList field of the @ref
+				ioh_dma_channel_info structure for the
+				corresponding channel.
+
+	@param		channel		[@ref IN]	Channel number.
+	@param		start		[@ref IN]	Reference to first
+						descriptor of list.
+	@param		end		[@ref IN]	Reference to last
+						descriptor of list.
+
+	@return		int
+			- @ref IOH_DMA_SUCCESS	--> If appending of the
+			descriptor is successful.
+
+	@see
+		- ioh_add_dma_desc
+*/
+int dma_add_desc(int channel, struct ioh_dma_desc *start,
+		 struct ioh_dma_desc *end)
+{
+	struct ioh_dma_desc *desc_addr;
+
+	desc_addr = ioh_dma_channel_info[channel].pTailOfList;
+
+	/* Obtaining the virtual address. */
+	desc_addr = (struct ioh_dma_desc *) phys_to_virt((u32) desc_addr);
+
+	/* If virtual address calculation successful. */
+	desc_addr->nextDesc = (u32) start;
+	ioh_dma_channel_info[channel].pTailOfList = end;
+
+	IOH_DEBUG("Function dma_add_desc returns %d.\n", IOH_DMA_SUCCESS);
+	return IOH_DMA_SUCCESS;
+}
+
+/*! @ingroup	HALLayerAPI
+	@fn	void  dma_set_callback (int channel,  void (*ioh_dma_cbr)
+			( int value,unsigned long data1),unsigned long data)
+	@brief		To set callback function.
+	@remarks	Sets the callback function to be called for a channel.
+				The main task performed by this function is:
+				- Updates the callback pointer for the channel
+				in the structure ioh_dma_channel_info with the
+				parameter passed.
+
+	@param		channel		[@ref IN]	Channel number.
+	@param		ioh_dma_cbr	[@ref IN]	Function pointer
+						to call back function.
+	@param		data		[@ref IN]	The data to be passed to
+						the callback function during
+						invoking.
+
+	@return	None.
+
+	@see
+		- ioh_dma_set_callback
+  */
+void dma_set_callback(int channel,
+		      void (*ioh_dma_cbr) (int value, unsigned long data1),
+		      unsigned long data)
+{
+	ioh_dma_channel_info[channel].call_back_func_ptr = ioh_dma_cbr;
+	ioh_dma_channel_info[channel].callback_data = data;
+
+	IOH_DEBUG("Function dma_set_callback invoked successfully.\n");
+}
+
+/*! @ingroup	HALLayerAPI
+	@fn		irqreturn_t dma_interrupt (int irq, void *dev_id)
+	@brief		Interrupt handler.
+	@remarks	Handles the interrupt for the DMA. The main tasks
+				performed by this function are:
+				- Checks each DMA channels whether a DMA
+				transmission end or DMA status interrupt has
+				occurred.
+				- If a transmission end interrupt has occurred,
+				then invoke the callback function with @ref
+				IOH_DMA_END, denoting that the DMA transmission
+				has end.
+				- If a DMA abort interrupt has occurred, then
+				invoke the callback function with @ref
+				IOH_DMA_ABORT, denoting that a DMA abort has
+				occurred.
+
+	@param		irq		[@ref IN]	Interrupt Request number
+	@param		dev_id	[@ref IN]	dev_id of device for which
+					interrupt is raised .
+
+	@return		irqreturn_t
+			- IRQ_HANDLED	--> If interrupt has been processed.
+			- IRQ_NONE	--> If no interrupt has been processed.
+
+ */
+irqreturn_t dma_interrupt(int irq, void *dev_id)
+{
+	irqreturn_t retval = IRQ_NONE;
+	u32 status_reg0;
+	u32 status_reg2;
+	u32 base_address;
+	u32 dev_type;
+	u32 i;
+	u16 status;
+
+	base_address = ((struct ioh_dma_devices *) dev_id)->base_addr;
+	dev_type = ((struct ioh_dma_devices *) dev_id)->dev_typ;
+
+	/* Reading the status registers. */
+	status_reg0 = IOH_READ_LONG((base_address + DMA_STS0_OFFSET));
+	status_reg2 = IOH_READ_LONG((base_address + DMA_STS2_OFFSET));
+	IOH_DEBUG("dma_interrupt -> Status register STS0: %x STS2: "
+		  "%x.\n", status_reg0, status_reg2);
+
+	/* Clearing the interrupts. */
+	dma_clear_interrupt_status(base_address, status_reg0, status_reg2);
+
+	/* Handling the interrupts. */
+	for (i = 0; i < IOH_DMA_CHANNELS_MAX; i++) {
+		if ((ioh_dma_channel_table[i].dma_dev_id == dev_type) &&
+		    (ioh_dma_channel_table[i].ch_alloced == 1) &&
+		    (ioh_dma_channel_info[i].bChEnabled == 1)
+		    ) {
+			status =
+			    dma_get_interrupt_status(ioh_dma_channel_table
+						     [i].channel, status_reg0,
+						     status_reg2);
+			IOH_DEBUG
+			    ("dma_interrupt -> Interrupt status for ch: %d is "
+			    "%x.\n", i, status);
+
+			if (status == 1) {
+				int value = IOH_DMA_END;
+
+				status =
+				    dma_get_abort_status(ioh_dma_channel_table
+							 [i].channel,
+							 status_reg0,
+							 status_reg2);
+
+				if (status == 1) {
+					value = IOH_DMA_ABORT;
+
+					IOH_DEBUG
+					    ("dma_interrupt -> DMA Abort "
+					    "interrupt from channel%d.\n", i);
+				}
+#ifdef DEBUG
+				else {
+					IOH_DEBUG
+					    ("dma_interrupt -> DMA Completion "
+					    "interrupt "
+					     "from channel%d.\n", i);
+				}
+#endif
+				if (ioh_dma_channel_info[i].
+				    call_back_func_ptr) {
+					u32 data =
+					    ioh_dma_channel_info
+					    [i].callback_data;
+					(ioh_dma_channel_info
+					 [i].call_back_func_ptr) (value, data);
+				}
+
+				/* Determining whether the channel has been
+				disabled. */
+				{
+					u32 ctrl_val;
+					s32 ch =
+					    ioh_dma_channel_table[i].channel;
+					u32 base_address =
+					    ioh_dma_channel_table[i].base;
+
+					if (ch < 8) {
+						ctrl_val =
+						    IOH_READ_LONG((base_address
+							    + DMA_CTL0_OFFSET));
+
+						ctrl_val &=
+						    ((0x3) <<
+						    (ch * DMA_SHIFT_MODE_BITS));
+					} else {
+						ctrl_val =
+						    IOH_READ_LONG((base_address
+							    + DMA_CTL3_OFFSET));
+						ctrl_val &=
+						    ((0x3) <<
+						     ((ch - 8) *
+						      DMA_SHIFT_MODE_BITS));
+					}
+
+					ioh_dma_channel_info[i].bChEnabled =
+					    (ctrl_val != 0) ? 1 : 0;
+
+				}	/* End */
+
+				retval = IRQ_HANDLED;
+			}
+		}
+	}
+
+	IOH_DEBUG("Function dma_interrupt returns %d.\n", retval);
+	return retval;
+}
+
+/*! @ingroup	HALLayerAPI
+	@fn		int dma_direct_start (int channel)
+	@brief		To generate the DMA request which each Function-IP
+				transmits.
+	@remarks	This function is used to initiate the DMA
+				transfer process. The main task performed by
+				this function is:
+				- Sets the value of DMAn Direct Start bit in the
+				Control register 2 to start DMA transfer on
+				channel n.
+
+	@param		channel	[@ref IN]	Channel number for which DMA
+						transfer is to be started.
+
+	@return		int
+			- @ref IOH_DMA_SUCCESS	--> On Success.
+
+	@see
+			- ioh_dma_direct_start
+ */
+int dma_direct_start(int channel)
+{
+	int ch;
+	u32 base_address;
+
+	ch = ioh_dma_channel_table[channel].channel;
+	base_address = ioh_dma_channel_table[channel].base;
+
+	if (ch < 8) {
+		IOH_DMA_BIT_SET((base_address + DMA_CTL2_OFFSET),
+				(DMA_DIR_START << ch));
+	} else {
+		IOH_DMA_BIT_SET((base_address + DMA_CTL2_OFFSET),
+				(DMA_DIR_START << (ch + 6)));
+	}
+
+	IOH_DEBUG("dma_direct_start -> Direct2 RegValue: "
+		  "%x.\n", IOH_READ_LONG((base_address + DMA_CTL2_OFFSET)));
+
+	IOH_DEBUG("Function dma_direct_start returns "
+		  "%d.\n", IOH_DMA_SUCCESS);
+	return IOH_DMA_SUCCESS;
+}
+
+/*! @ingroup	HALLayerAPI
+	@fn			int dma_set_priority (int channel, int priority)
+	@brief		Set the priority.
+	@remarks	Sets the priority for a channel. The main task
+				performed by this function is:
+				- Set the value of DMAn Priority Level bits for
+				the channel in the Control register1.
+
+	@param		channel	[@ref IN]	DMA channel number.
+	@param		priority	[@ref IN]	Priority to be set for
+							the DMA channel.
+
+	@return		int
+			- @ref IOH_DMA_SUCCESS	--> On Success.
+
+	@see
+			- ioh_set_dma_priority
+  */
+int dma_set_priority(int channel, int priority)
+{
+	int ch;
+	u32 base_address;
+	u32 reg_val;
+
+	ch = ioh_dma_channel_table[channel].channel;
+	base_address = ioh_dma_channel_table[channel].base;
+
+	reg_val = IOH_READ_LONG((base_address + DMA_CTL1_OFFSET));
+
+	if (ch < 8) {
+		reg_val &=
+		    ~(DMA_MASK_PRIORITY_BITS << (ch * DMA_SHIFT_PRIORITY_BITS));
+		reg_val |= (((u32) priority) << (ch * DMA_SHIFT_PRIORITY_BITS));
+	} else {
+		reg_val &=
+		    ~(DMA_MASK_PRIORITY_BITS <<
+		      (((ch - 8) * DMA_SHIFT_PRIORITY_BITS) + 2));
+		reg_val |=
+		    (((u32) priority) <<
+		     (((ch - 8) * DMA_SHIFT_PRIORITY_BITS) + 2));
+	}
+
+	IOH_WRITE_LONG(reg_val, (base_address + DMA_CTL1_OFFSET));
+
+	IOH_DEBUG("Function dma_set_priority returns "
+		  "%d.\n", IOH_DMA_SUCCESS);
+	return IOH_DMA_SUCCESS;
+}
+
+/*! @ingroup	HALLayerAPI
+	@fn	int dma_enable_disable_interrupt (int channel, int bEnable)
+	@brief		Enables or Disables Interrupts .
+	@remarks	Writes the corresponding register to either
+				enable or disable interrupts. The main tasks
+				performed by this function are:
+				- If bEnable is DMA_INTERRUPT_ENABLE (1),
+				sets the DMAn Interrupt Enable bit in control
+				register2.
+				- If bEnable is DMA_INTERRUPT_DISABLE (0),
+				clears the DMAn Interrupt Enable bit in control
+				register2.
+
+	@param	channel	[@ref IN]	Channel number
+	@param	bEnable	[@ref IN]	Flag to indicate whether
+						to enable or disable interrupt.
+
+	@return		int
+			- @ref IOH_DMA_SUCCESS	--> On Success.
+
+	@see
+		- dma_init
+		- dma_exit
+  */
+int dma_enable_disable_interrupt(int channel, int bEnable)
+{
+	u32 base_address;
+	u16 ch;
+
+	ch = ioh_dma_channel_table[channel].channel;
+	base_address = ioh_dma_channel_table[channel].base;
+
+	if (ch < 8) {
+		if (IOH_DMA_INTERRUPT_ENABLE == bEnable) {
+			IOH_DMA_BIT_SET((base_address + DMA_CTL2_OFFSET),
+					(DMA_INTERRUPT_BIT << ch));
+		} else {	/* if(bEnable == IOH_DMA_INTERRUPT_DISABLE) */
+
+			IOH_DMA_BIT_CLEAR((base_address + DMA_CTL2_OFFSET),
+					  (DMA_INTERRUPT_BIT << ch));
+		}
+
+	} else {
+		if (IOH_DMA_INTERRUPT_ENABLE == bEnable) {
+			IOH_DMA_BIT_SET((base_address + DMA_CTL2_OFFSET),
+					(DMA_INTERRUPT_BIT << (ch + 8)));
+		} else {	/* if(bEnable == IOH_DMA_INTERRUPT_DISABLE) */
+
+			IOH_DMA_BIT_CLEAR((base_address + DMA_CTL2_OFFSET),
+					  (DMA_INTERRUPT_BIT << (ch + 8)));
+		}
+	}
+
+	IOH_DEBUG("dma_enable_disable_interrupt -> CTL2 Register Value: "
+		  "%x.\n", IOH_READ_LONG((base_address + DMA_CTL2_OFFSET)));
+
+	IOH_DEBUG("Function dma_enable_disable_interrupt returns "
+		  "%d.\n", IOH_DMA_SUCCESS);
+	return IOH_DMA_SUCCESS;
+}
+
+/*! @ingroup	HALLayerAPI
+	@fn		void get_dma_status(int channel, u16 *pDMAStatus)
+	@brief		Gets the Status of DMA.
+	@remarks	Gets the status of the specified DMA Channel. The
+				main task performed by this function is:
+				- Reads the data in the DMAn (for channel .n.)
+				Status bit of Status register0 (4ch or 8ch) or
+				Status register2 (12ch) and copy the value into
+				pDMAStatus.
+
+	@param		channel		[@ref IN]		Channel number.
+	@param		pDMAStatus	[@ref INOUT]	Address of variable to
+						which
+						status information is copied.
+
+	@return	None.
+
+	@see
+		- dma_exit
+		- dma_init
+		- ioh_set_dma_mode
+		- ioh_set_dma_addr
+		- ioh_set_dma_count
+		- ioh_set_dma_desc
+		- ioh_add_dma_desc
+		- ioh_enable_dma
+		- ioh_disable_dma
+		- ioh_set_dma_priority
+		- ioh_dma_direct_start
+
+  */
+
+void get_dma_status(int channel, u16 *pDMAStatus)
+{
+	u32 status_val;
+	u32 base_address;
+	u16 ch;
+
+	ch = ioh_dma_channel_table[channel].channel;
+	base_address = ioh_dma_channel_table[channel].base;
+
+	if (ch < 8) {
+		status_val = IOH_READ_LONG(base_address + DMA_STS0_OFFSET);
+		*pDMAStatus = (u16) ((status_val >> (DMA_SHIFT_STATUS_BITS +
+						     (ch *
+						      DMA_SIZE_STATUS_BITS))) &
+				     (DMA_MASK_STATUS_BITS));
+	} else {
+		status_val = IOH_READ_LONG(base_address + DMA_STS2_OFFSET);
+		*pDMAStatus = (u16) ((status_val >> (DMA_SHIFT_STATUS_BITS +
+						     ((ch -
+						       8) *
+						      DMA_SIZE_STATUS_BITS))) &
+				     (DMA_MASK_STATUS_BITS));
+	}
+
+	IOH_DEBUG("Function get_dma_status invoked successfully.\n");
+}
+
+/*!	@ingroup	HALLayerAPI
+	@fn		int dma_set_desc(int channel,
+				struct ioh_dma_desc *start,
+				struct ioh_dma_desc *end)
+	@brief		Sets descriptors .
+	@remarks	This functions sets the descriptor settings for
+				SCATTER GATHER mode. It does not perform any
+				register settings, instead retains the data for
+				further use. The main tasks performed by this
+				function are:
+				- Sets the pHeadOfList field of the @ref
+				ioh_dma_channel_info structure to the value of
+				the argument start.
+				- Set the pTailOfList field of the @ref
+				ioh_dma_channel_info structure to the value of
+				the argument end.
+
+	@param		channel	[@ref IN]	Channel number.
+	@param		start	[@ref IN]	Reference to first descriptor
+							of list.
+	@param		end	[@ref IN]	Reference to last descriptor
+							of list.
+
+	@see
+			- ioh_set_dma_desc
+ */
+
+int dma_set_desc(int channel, struct ioh_dma_desc *start,
+		 struct ioh_dma_desc *end)
+{
+	ioh_dma_channel_info[channel].pHeadOfList = start;
+	ioh_dma_channel_info[channel].pTailOfList = end;
+
+	IOH_DEBUG("Function dma_set_desc returns %d.\n", IOH_DMA_SUCCESS);
+	return IOH_DMA_SUCCESS;
+}
+
+/*!	@ingroup	InternalFunction
+	@fn			void get_free_ch(int index)
+	@brief		Get a free channel info entry and populate the entry.
+	@remarks	Reset all the entries within the array
+				ioh_dma_channel_info[index]
+
+	@param		index	[@ref IN]	Index in the
+					ioh_dma_channel_table
+
+	@return	None
+
+	@see
+			- dma_request_ch
+ */
+void get_free_ch(int index)
+{
+	memset((void *)&ioh_dma_channel_info[index], 0,
+	       sizeof(struct ioh_dma_controller_info));
+	IOH_DEBUG("Function get_free_ch invoked successfully.\n");
+}
+
+/*! @ingroup	HALLayerAPI
+	@fn			int dma_request_ch(u32 req_dev_id, int dreq)
+	@brief		Reserves a channel based on request.
+	@remarks	This function is invoked when a kernel module requests
+				to reserve a DMA channel. The main tasks
+				performed by this function are:
+				- Checks the @ref ioh_dma_channel_table for a
+				matching entry corresponding to the dev_id of
+				the requesting device and dreq signal.
+				- If there is a matching entry, checks if this
+				channel is already allocated.
+				- If no invoke get_free_ch to reset the entries
+				for the corresponding channel and return the
+				entry index.
+				- If no matching entry is found return -EBUSY.
+
+	@param		req_dev_id	[@ref IN]	Device id of the device
+							that requests DMA  .
+	@param		dreq	[@ref IN]	DMA request signal number.
+
+	@return		int
+			- DMA channel number (>=0)	--> On Success.
+			- -EBUSY	--> DMA channel cannot be allocated..
+
+	@see
+			- ioh_request_dma
+ */
+
+int dma_request_ch(u32 req_dev_id, int dreq)
+{
+	int retval;
+	int i;
+
+	for (i = 0; i < IOH_DMA_CHANNELS_MAX; i++) {
+		if ((ioh_dma_channel_table[i].req_device_id == req_dev_id) &&
+		    (ioh_dma_channel_table[i].request_signal == dreq)) {
+			if ((1 == ioh_dma_channel_table[i].ch_found) &&
+			    (0 == ioh_dma_channel_table[i].ch_alloced)) {
+				get_free_ch(i);
+				IOH_DEBUG
+				    ("dma_request_ch -> Function get_free_ch "
+				     "invoked successfully.\n");
+				ioh_dma_channel_table[i].ch_alloced = 1;
+				retval = i;
+
+				break;
+			}
+		}
+	}
+
+	if (IOH_DMA_CHANNELS_MAX == i) {
+		retval = -EBUSY;
+		IOH_LOG(KERN_ERR, "dma_request_ch ->  Not able to allocate "
+			"channel.\n");
+	}
+
+	IOH_DEBUG("Function dma_request_ch returns %d.\n", retval);
+	return retval;
+}
+
+/*!	@ingroup	HALLayerAPI
+	@fn			int dma_free_ch(int channel)
+	@brief		Frees the requested channel.
+	@remarks	This function is invoked when a kernel
+				module requests to free a DMA channel. The main
+				tasks performed by this function are:
+				- If the channel is already free return
+					IOH_DMA_SUCCESS.
+				- Else disable the channel by invoking
+				@ref dma_disable_ch API.
+				- Disable the channel interrupt by invoking
+				@ref dma_enable_disable_interrupt
+				- Mark the channel as free in the structures
+				@ref ioh_dma_channel_info and @ref
+				ioh_dma_channel_table and return @ref
+				IOH_DMA_SUCCESS.
+
+	@param		channel	[@ref IN]	DMA channel number to be freed.
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+
+	@see
+			- ioh_free_dma
+ */
+
+int dma_free_ch(int channel)
+{
+	int retval;
+
+	if (ioh_dma_channel_table[channel].ch_alloced == (u16) 0) {
+		IOH_DEBUG("dma_free_ch -> Channel is already free\n");
+		retval = IOH_DMA_SUCCESS;
+	} else {
+		/* To stop any active transfer on DMA, disable DMA */
+		(void)dma_disable_ch(channel);
+		IOH_DEBUG("dma_free_ch -> Function dma_disable_ch invoked "
+			  "successfully.\n");
+
+		(void)dma_enable_disable_interrupt(channel,
+						   IOH_DMA_INTERRUPT_DISABLE);
+		IOH_DEBUG
+		    ("dma_free_ch -> Function dma_enable_disable_interrupt "
+		     "invoked successfully.\n");
+
+		ioh_dma_channel_table[channel].ch_alloced = 0;
+
+		retval = IOH_DMA_SUCCESS;
+	}
+
+	IOH_DEBUG("Function dma_free_ch returns %d.\n", IOH_DMA_SUCCESS);
+	return retval;
+}
--- /dev/null
+++ b/drivers/dma/pch_dma/pch_dma_hal.h
@@ -0,0 +1,594 @@
+/**
+ * @file ioh_dma_hal.h
+ *
+ * @brief
+ *		This file declares the structures & data types used by the HAL
+ *		functions of IOH_DMA_CONTROLLER driver.
+ *
+ * @version 0.90
+ * @section
+ * 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; version 2 of the License.
+ *
+ * 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.
+ *
+ * <hr>
+ */
+
+/*
+ * History:
+ * Copyright (C) 2008 OKI SEMICONDUCTOR Co., LTD.
+ * All rights reserved.
+ *
+ * created:
+ *	WIPRO 03/07/2009
+ * modified:
+ *	WIPRO 08/14/2009
+ *
+ */
+
+#ifndef __IOH_DMA_HAL_H__
+#define __IOH_DMA_HAL_H__
+
+#include <linux/interrupt.h>
+#include "pch_dma_main.h"
+
+/*!
+	@defgroup	DMA
+*/
+
+/*!	@defgroup	Global
+	@ingroup	DMA
+	@brief		This group contains all the global data
+				structures used by the DMA module.
+*/
+
+/*!	defgroup	InternalFunction
+	@ingroup	DMA
+	@brief		This group contains all the function which
+				are used by other APIs for performing some
+				small tasks for facilitating the logic
+				of the driver.
+*/
+
+/*!	@defgroup	PCILayer
+	@ingroup	DMA
+	@brief		This group contains all the utilities
+				used to interface the DMA module with
+				the PCI subsystem of the Kernel.
+*/
+
+/*!	@defgroup	InterfaceLayer
+	@ingroup	DMA
+	@brief		This group contains all the utilities
+				used by the DMA module to interface with
+				the other modules.
+*/
+
+/*!	@defgroup	HALLayer
+	@ingroup	DMA
+	@brief		This group contains all the utilities
+				used to DMA module to interact with the
+				hardware.
+*/
+
+/*!	@defgroup	PCILayerAPI
+	@ingroup	PCILayer
+	@brief		This group contains the APIs used to
+				interface the DMA module with the PCI
+				subsystem of the Kernel.
+*/
+
+/*!	@defgroup	PCILayerFacilitators
+	@ingroup	PCILayer
+	@brief		This group contains the data structures
+				used by the PCILayerAPIs for their
+				functioning.
+*/
+
+/*!	@defgroup	HALLayerAPI
+	@ingroup	HALLayer
+	@brief		This group contains the APIs used to
+				communicate with the hardware.
+*/
+
+/*!	@defgroup	HALLayerFacilitators
+	@ingroup	HALLayer
+	@brief		This group contains the data structures
+				used to communicate with the hardware.
+*/
+
+/*!	@defgroup	InterfaceLayerAPI
+	@ingroup	InterfaceLayer
+	@brief		This group contains the APIs used by the
+				DMA module to interface with other modules.
+*/
+
+/*!	@defgroup	InterfaceLayerFacilitators
+	@ingroup	InterfaceLayer
+	@brief		This group contains the data structures
+				used by the DMA module to interface with
+				other modules.
+*/
+
+/*** Device specific limitations and properties. ***/
+
+/*!	@ingroup	DMA
+	@def		IOH_DMA_CHANNELS_MAX
+	@brief		The maximum number of channels allowed
+				in any of the IOH device.
+*/
+#define IOH_DMA_CHANNELS_MAX				(64)
+
+/*!	@ingroup	DMA
+	@def		IOH_DMA_MAX_DEVS
+	@brief		The no. of DMA devices allowable.
+
+	@see
+		- ioh_dma_devices
+*/
+#define IOH_DMA_MAX_DEVS					(4)
+
+/*!	@ingroup	DMA
+	@def		IOH_DMA_8BIT_SIZE_MAX
+	@brief		The maximum number of transfer size in
+				bytes for a channel if access size is set
+				to 8BIT.
+*/
+#define IOH_DMA_8BIT_SIZE_MAX			(2047)
+
+/*!	@ingroup	DMA
+	@def		IOH_DMA_16BIT_SIZE_MAX
+	@brief		The maximum number of transfer size in
+				bytes for a channel if access size is set
+				to 16BIT.
+*/
+#define IOH_DMA_16BIT_SIZE_MAX			(4094)
+
+/*!	@ingroup	DMA
+	@def		IOH_DMA_32BIT_SIZE_MAX
+	@brief		The maximum number of transfer size in
+				bytes for a channel if access size is set
+				to 32BIT.
+*/
+#define IOH_DMA_32BIT_SIZE_MAX			(4096)
+
+/********/
+
+/*** Device IDs of DMA requesting devices. ***/
+/*!	@ingroup	DMA
+	@def		PCI_DEVICE_ID_IOH_UART0
+	@brief		The deviceID of the IOH GE UART
+				device 0 which can use the DMA features.
+*/
+#define PCI_DEVICE_ID_IOH_UART0						(0x8811)
+
+/*!	@ingroup	DMA
+	@def		PCI_DEVICE_ID_IOH_UART1
+	@brief		The deviceID of the IOH GE UART
+				device 1 which can use the DMA features.
+*/
+#define PCI_DEVICE_ID_IOH_UART1						(0x8812)
+
+/*!	@ingroup	DMA
+	@def		PCI_DEVICE_ID_IOH_UART2
+	@brief		The deviceID of the IOH GE UART
+				device 2 which can use the DMA features.
+*/
+#define PCI_DEVICE_ID_IOH_UART2						(0x8813)
+
+/*!	@ingroup	DMA
+	@def		PCI_DEVICE_ID_IOH_UART3
+	@brief		The deviceID of the IOH GE UART
+				device 3 which can use the DMA features.
+*/
+#define PCI_DEVICE_ID_IOH_UART3						(0x8814)
+
+/*!	@ingroup	DMA
+	@def		PCI_DEVICE_ID_IOH_SPI
+	@brief		The deviceID of the IOH GE SPI
+				device which can use the DMA features.
+*/
+#define PCI_DEVICE_ID_IOH_SPI	(0x8816)
+
+/*** Internal device IDs used for identifing the DMAC . ***/
+/*!	@ingroup	Global
+	@def		IOH_DMA_4CH0
+	@brief		The device ID for the first DMA device
+				with 4 channels.
+*/
+#define IOH_DMA_4CH0						(0x40)
+
+/*!	@ingroup	Global
+	@def		IOH_DMA_4CH1
+	@brief		The device ID for the second DMA device
+				with 4 channels.
+*/
+#define IOH_DMA_4CH1						(0x41)
+
+/*!	@ingroup	Global
+	@def		IOH_DMA_4CH2
+	@brief		The device ID for the third DMA device
+				with 4 channels.
+*/
+#define IOH_DMA_4CH2						(0x42)
+
+/*!	@ingroup	Global
+	@def		IOH_DMA_4CH3
+	@brief		The device ID for the fourth DMA device
+				with 4 channels.
+*/
+#define IOH_DMA_4CH3						(0x43)
+
+/*!	@ingroup	Global
+	@def		IOH_DMA_4CH4
+	@brief		The device ID for the fifth DMA device
+				with 4 channels.
+*/
+#define IOH_DMA_4CH4						(0x44)
+
+/*!	@ingroup	Global
+	@def		IOH_DMA_8CH0
+	@brief		The device ID for the first DMA device
+				with 8 channels.
+*/
+#define IOH_DMA_8CH0						(0x80)
+
+/*!	@ingroup	Global
+	@def		IOH_DMA_8CH1
+	@brief		The device ID for the second DMA device
+				with 8 channels.
+*/
+#define IOH_DMA_8CH1						(0x81)
+
+/*!	@ingroup	Global
+	@def		IOH_DMA_8CH2
+	@brief		The device ID for the third DMA device
+				with 8 channels.
+*/
+#define IOH_DMA_8CH2						(0x82)
+
+/*!	@ingroup	Global
+	@def		IOH_DMA_8CH3
+	@brief		The device ID for the fourth DMA device
+				with 8 channels.
+*/
+#define IOH_DMA_8CH3						(0x83)
+
+/*!	@ingroup	Global
+	@def		IOH_DMA_12CH0
+	@brief		The device ID for the first DMA device
+				with 12 channels.
+*/
+#define IOH_DMA_12CH0						(0xC0)
+
+/******/
+
+/*** DMA Controller Register Offsets. ***/
+
+/*!	@ingroup	HALLayer
+	@def		DMA_CTL0_OFFSET
+	@brief		DMA Control register 0 offset.
+*/
+#define DMA_CTL0_OFFSET					(0x00UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_CTL1_OFFSET
+	@brief		DMA Control register 1 offset.
+*/
+#define DMA_CTL1_OFFSET						(0x04UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_CTL2_OFFSET
+	@brief		DMA Control register 2 offset.
+*/
+#define DMA_CTL2_OFFSET						(0x08UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_CTL3_OFFSET
+	@brief		DMA Control register 3 offset.
+*/
+#define DMA_CTL3_OFFSET						(0x0CUL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_STS0_OFFSET
+	@brief		DMA Status register 0 offset.
+*/
+#define DMA_STS0_OFFSET						(0x10UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_STS1_OFFSET
+	@brief		DMA Status register 1 offset.
+*/
+#define DMA_STS1_OFFSET						(0x14UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_STS2_OFFSET
+	@brief		DMA Status register 2 offset.
+*/
+#define DMA_STS2_OFFSET						(0x18UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_IN_AD_OFFSET
+	@brief		DMA IN Address register offset.
+*/
+#define DMA_IN_AD_OFFSET					(0x20UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_OUT_AD_OFFSET
+	@brief		DMA Out Address register offset.
+*/
+#define DMA_OUT_AD_OFFSET					(0x24UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_SZ_OFFSET
+	@brief		DMA Size register offset.
+*/
+#define DMA_SZ_OFFSET						(0x28UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_NX_AD_OFFSET
+	@brief		DMA Next Address register offset.
+*/
+#define DMA_NX_AD_OFFSET					(0x2CUL)
+
+/**********/
+
+/*** Individual register bits. ***/
+
+/*!	@ingroup	HALLayer
+	@def		DMA_SIZE_TYPE_BITS
+	@brief		The DMA size bits.
+*/
+#define DMA_SIZE_TYPE_BITS					(0x00003000UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_SET_OR_CLEAR_DIR_BIT
+	@brief		Mask for direction bit.
+*/
+#define DMA_SET_OR_CLEAR_DIR_BIT			(0x00000004UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_MASK_MODE_BITS
+	@brief		Mask for mode bits.
+*/
+#define DMA_MASK_MODE_BITS					(0x00000003UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_SHIFT_MODE_BITS
+	@brief		DMA shift mode bits.
+*/
+#define DMA_SHIFT_MODE_BITS					(4)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_MASK_PRIORITY_BITS
+	@brief		Mask for priority bits.
+*/
+#define DMA_MASK_PRIORITY_BITS				(0x3UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_SHIFT_PRIORITY_BITS
+	@brief		Shift value for DMA priority bits.
+*/
+#define DMA_SHIFT_PRIORITY_BITS				(4)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_SHIFT_SIZE_TYPE_BITS
+	@brief		Shift value for the DMA size bit.
+*/
+#define DMA_SHIFT_SIZE_TYPE_BITS			(12)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_DIR_START
+	@brief		Direct Start Bit Setting values.
+*/
+#define DMA_DIR_START						(0x00000100UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_INTERRUPT_BIT
+	@brief		Interrupt Enable Bit setting values.
+*/
+#define DMA_INTERRUPT_BIT					(0x00000001UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_ABORT_OCCUR
+	@brief		Abort notify Bit Setting Values
+*/
+#define DMA_ABORT_OCCUR						(0x00000100UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_INTERRUPT_OCCUR
+	@brief		Interrupt notify Bit Setting Values
+*/
+#define DMA_INTERRUPT_OCCUR					(0x00000001UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_MASK_STATUS_BITS
+	@brief		Mask for status bits.
+*/
+#define DMA_MASK_STATUS_BITS				(0x3UL)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_SIZE_STATUS_BITS
+	@brief		The DMA size status bits.
+*/
+#define DMA_SIZE_STATUS_BITS				(2)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_SHIFT_STATUS_BITS
+	@brief		The shift value for DMA status bits.
+*/
+#define DMA_SHIFT_STATUS_BITS				(16)
+
+/*********/
+
+/*** Status denoting macros. ***/
+
+/*!	@ingroup	HALLayer
+	@def		DMA_STATUS_IDLE
+	@brief		Constant used to denote the transfer status as IDLE.
+	@note		This constant is used by DMA modules to make the
+				other module aware of the DMA status.
+*/
+#define DMA_STATUS_IDLE						(0)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_STATUS_DESC_READ
+	@brief		Constant used to denote the transfer status as
+				DESCRIPTOR_READ.
+	@note		This constant is used by DMA modules to make the
+				other module aware of the DMA status.
+*/
+#define DMA_STATUS_DESC_READ				(1)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_STATUS_WAIT
+	@brief		Constant used to denote the transfer status as WAIT.
+	@note		This constant is used by DMA modules to make the
+				other module aware of the DMA status.
+*/
+#define DMA_STATUS_WAIT						(2)
+
+/*!	@ingroup	HALLayer
+	@def		DMA_STATUS_ACCESS
+	@brief		Constant used to denote the transfer status as ACCESS
+	@note		This constant is used by DMA modules to make the
+				other module aware of the DMA status.
+*/
+#define DMA_STATUS_ACCESS					(3)
+
+/*!	@ingroup	HALLayer
+	@def		IOH_DMA_INTERRUPT_DISABLE
+	@brief		Constant used to denote disable interrupt.
+*/
+#define IOH_DMA_INTERRUPT_DISABLE			(0)
+
+/*!	@ingroup	HALLayer
+	@def		IOH_DMA_INTERRUPT_ENABLE
+	@brief		Constant used to denote enable interrupt.
+*/
+#define IOH_DMA_INTERRUPT_ENABLE			(1)
+
+/************/
+
+/*** Other Macros. ***/
+
+/*!	@ingroup	HALLayer
+	@def		COUNTER_LIMIT
+	@brief		The counter limit.
+*/
+#define COUNTER_LIMIT						(0xFFFF)
+
+/*!	@ingroup	HALLayer
+	@def		MSK_ALL_THREE
+	@brief		Value used for masking the 3 LSB bits.
+*/
+#define MSK_ALL_THREE						(0x7)
+
+/*******/
+/*** Data Structures for stroing device specific information. ***/
+
+/*!	@ingroup	HALLayerFacilitators
+	@struct		__ioh_dma_devices
+	@brief		Format for maintaining the device information.
+	@note		This structure is used by the DMA module to retain
+				the information about the device.
+
+	@see
+		- ioh_dma_devices
+*/
+
+struct ioh_dma_devices {
+	u32 base_addr;		/**< The remapped base address.	*/
+	u32 dev_typ;		/**< The device type indicating number of DMA
+				channels */
+	void *dev;		/**< The void pointer for storing any references
+				if required */
+};
+
+/*!	@ingroup	HALLayerFacilitators
+		@struct		__ioh_dma_controller_info_t
+		@brief		Format for storing the details of the
+					DMA channels.
+*/
+
+struct ioh_dma_controller_info {
+	u16 DMATransferMode;		/**< DMA Transfer Mode 	*/
+	u16 bChEnabled;			/**< To know if channel is enabled or
+					not */
+	struct ioh_dma_desc *pHeadOfList;	/**< Pointer to start
+						descriptor */
+	struct ioh_dma_desc *pTailOfList;	/**< Pointer to last
+						descriptor */
+	void (*call_back_func_ptr) (int, unsigned long);/**< Address of the call
+					back function that is to be called when
+					an interrupt occurs */
+	u32 callback_data;		/**< The data to passed to the callback
+					function during invocation */
+	u16 DMAAccessSize;		/**< To store the access size (8bit,
+					16bit or 32bit) */
+	u16 DMATransferSize;		/**< To store the value of Transfer
+					Size */
+	u16 DMATransferDirection;	/**< To store the Direction of Transfer
+					(IN to OUT or OUT to IN) */
+	u32 in_addr;			/**< The in_address */
+	u32 out_addr;			/**< The out_address */
+};
+
+/*!	@ingroup	HALLayerFacilitators
+		@struct		ioh_dma_channel_alloc_table
+		@brief		Format for storing the details of the
+					allocation details of the DMA channels.
+*/
+
+struct ioh_dma_channel_alloc_table {
+	u32 dma_dev_id;	/**< The DMA device ID. */
+	enum ioh_channel_request_id request_signal;	/**< The request type.*/
+	u32 req_device_id;	/**< The device ID of the requested device */
+	u16 channel;		/**< The channel number. */
+	u16 ch_found:1;		/**< The flag variable for channel in use */
+	u16 ch_alloced:1;	/**< The flag variable for channel allocate. */
+	u32 base;		/**< The base address of the DMA device. */
+};
+
+									/*****/
+
+extern struct ioh_dma_channel_alloc_table
+ ioh_dma_channel_table[IOH_DMA_CHANNELS_MAX];
+extern struct ioh_dma_controller_info
+ ioh_dma_channel_info[IOH_DMA_CHANNELS_MAX];
+
+void dma_init(u32 base, u32 dev_type);
+int dma_free_ch(int channel);
+int dma_request_ch(u32 req_dev_id, int dreq);
+int dma_set_mode(int channel, struct ioh_dma_mode_param stModeParam);
+int dma_set_addr(int channel, u32 iaddr, u32 oaddr);
+int dma_enable_ch(int channel);
+int dma_disable_ch(int channel);
+int dma_set_count(int channel, u32 count);
+int dma_add_desc(int channel, struct ioh_dma_desc *start,
+		 struct ioh_dma_desc *end);
+int dma_set_desc(int channel, struct ioh_dma_desc *start,
+		 struct ioh_dma_desc *end);
+void dma_set_callback(int channel,
+		      void (*ioh_dma_cbr) (int value, unsigned long data1),
+		      unsigned long data);
+irqreturn_t dma_interrupt(int irq, void *dev_id);
+int dma_set_priority(int channel, int priority);
+int dma_direct_start(int channel);
+int dma_enable_disable_interrupt(int channel, int bEnable);
+void dma_get_abort_status(int channel, u16 *pAbortStatus);
+void dma_get_interrupt_status(int channel, u16 *pInterruptStatus);
+void get_dma_status(int channel, u16 *pDMAStatus);
+void get_free_ch(int index);
+void dma_exit(u32 dev_type);
+
+#endif
--- /dev/null
+++ b/drivers/dma/pch_dma/pch_dma_main.c
@@ -0,0 +1,1026 @@
+/**
+ * @file ioh_dma_main.c
+ *
+ * @brief
+ * This file defines the methods of IOH_DMA driver.
+ *
+ *
+ * @version 0.90
+ * @section
+ * 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; version 2 of the License.
+ *
+ * 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.
+ *
+ * <hr>
+ */
+
+/*
+ * History:
+ * Copyright (C) 2008 OKI SEMICONDUCTOR Co., LTD.
+ * All rights reserved.
+ *
+ * created:
+ *	WIPRO 03/07/2009
+ * modified:
+ *	WIPRO 08/14/2009
+ *
+ */
+
+#include <linux/spinlock.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+
+#include "pch_debug.h"
+#include "pch_dma_hal.h"
+#include "pch_dma_pci.h"
+
+
+/*!	@ingroup	InterfaceLayerAPI
+	@fn		int ioh_request_dma(struct pci_dev *pdev, int dreq)
+	@brief		Used to request a DMA channel.
+	@remarks	Requests to reserve a DMA channel that connects
+				to number 'dreq' (DMA request signal) of PCI
+				device 'pdev' to the appropriate DMA channel
+				allocated for it within the DMA Controller. This
+				function is called by functions from other
+				kernel modules. The tasks performed by this
+				function are:
+				- Verifies whether the obtained parameters are
+				valid,
+				if not suitable error status codes are returned
+				to the called function.
+				- If valid interacts with the HAL API and
+				returns the status code returned by the HAL API.
+
+	@note		This function is accessible by other kernel modules.
+
+	@param		dev	[@ref IN]	PCI device that requires the DMA
+									channel.
+	@param		dreq	[@ref IN]	DMA request signal number.
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+			- -EAGAIN	--> Device is in suspend mode.
+			- -EINVAL	--> pdev does not have a DMA request
+						type or number 'dreq' or 'pdev'
+						is NULL.
+*/
+int ioh_request_dma(struct pci_dev *pdev, int dreq)
+{
+	int retval;
+
+	/* Attaining the lock.  */
+	spin_lock(&ioh_device_lock);
+
+	/* If device suspended. */
+	if (1 == ioh_device_suspended) {
+		IOH_LOG(KERN_ERR,
+			"ioh_request_dma -> Device is in suspend mode.\n");
+		retval = -EAGAIN;
+	}
+	/* Invalid device structure. */
+	else if (NULL == pdev) {
+		IOH_LOG(KERN_ERR,
+			"ioh_request_dma -> Obtained device structure "
+			"is NULL.\n");
+		retval = -EINVAL;
+	}
+	/* Invalid request signal. */
+	else if ((dreq < IOH_DMA_TX_DATA_REQ0) ||
+		 (dreq > IOH_DMA_RX_DATA_REQ5)) {
+		IOH_LOG(KERN_ERR,
+			"ioh_request_dma -> Invalid request signal.\n");
+		retval = -EINVAL;
+	} else {
+		/* Requesting for reserving a DMA channel. */
+		retval = dma_request_ch((u32) (pdev->device), dreq);
+		IOH_DEBUG("ioh_request_dma -> Function dma_request_ch returned "
+			  "%d.\n", retval);
+	}
+
+	/* Releasing the lock. */
+	spin_unlock(&ioh_device_lock);
+
+	IOH_DEBUG("Function ioh_request_dma returns %d.\n", retval);
+	return retval;
+}
+EXPORT_SYMBOL(ioh_request_dma);
+
+/*!	@ingroup	InterfaceLayerAPI
+	@fn			int ioh_free_dma(int channel)
+	@brief		Used to free a DMA channel.
+	@remarks	Frees the allocated DMA channel that is provided
+				as the argument to the function. This function
+				is called by the functions from other kernel
+				modules. The main tasks performed by this
+				function are:
+				- Verifies whether the obtained parameters are
+				valid, if not suitable error status codes are
+				returned to the called function.
+				- If valid interacts with the HAL API for
+				freeing the channel and returns the status code
+				returned by the HAL API.
+	@note		This function is accessible by other kernel
+				modules.
+
+	@param		channel	[@ref IN]	DMA channel number
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+			- -EAGAIN		--> Device is in suspend mode.
+			- -ENODEV		--> Specified DMA channel does
+							not exist.
+*/
+int ioh_free_dma(int channel)
+{
+	int retval;
+
+	if (1 == ioh_device_suspended) {
+		IOH_LOG(KERN_ERR,
+			"ioh_free_dma -> Device is in suspend mode.\n");
+		retval = -EAGAIN;
+	} else if ((channel >= IOH_DMA_CHANNELS_MAX) || (channel < 0)) {
+		IOH_LOG(KERN_ERR, "ioh_free_dma -> Invalid Channel number: "
+			"%d.\n", channel);
+		retval = -ENODEV;
+	} else {
+		retval = dma_free_ch(channel);
+		IOH_DEBUG("ioh_free_dma -> Function dma_free_ch "
+			  "returned %d.\n", retval);
+	}
+
+	IOH_DEBUG("Function ioh_free_dma returns %d.\n", retval);
+	return retval;
+}
+EXPORT_SYMBOL(ioh_free_dma);
+
+/*! @ingroup	InterfaceLayerAPI
+	@fn		int ioh_set_dma_mode(int channel,struct
+				ioh_dma_mode_param stModeParam)
+	@brief		Used to set the mode of the DMA.
+	@remarks	Sets the mode of DMA transfer - One shot mode
+				or Scatter/gather mode. In addition to this,
+				the function also sets the direction of DMA
+				transfer and DMA Size type. This function is
+				called by functions from other kernel modules.
+				The main tasks performed by this function are:
+				- Verifies whether the obtained parameters are
+				valid, if not suitable error status codes are
+				returned to the called function.
+				- If valid interacts with the HAL API to set the
+				required settings and returns the status code
+				returned by the HAL API.
+
+	@note		This function is accessible by other kernel modules.
+
+	@param		channel		[@ref IN]	DMA channel number
+	@param		stModeParam	[@ref IN]	Contains info about
+						direction of DMA transfer, mode
+						and Size type
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+			- -EAGAIN		--> The device is in suspend
+							mode.
+			- -ENODEV		--> Specified DMA channel does
+							not exist.
+			- -EINVAL		--> Parameter passed is invalid.
+			- -EBUSY		--> DMA channel is already
+							enabled.
+*/
+int ioh_set_dma_mode(int channel, struct ioh_dma_mode_param stModeParam)
+{
+	int retval;
+
+	/* Checking if device suspended.                                */
+	if (1 == ioh_device_suspended) {
+		IOH_LOG(KERN_ERR,
+			"ioh_set_dma_mode -> Device is in suspend mode.\n");
+		retval = -EAGAIN;
+	}
+	/* Checking for validity of channel number.     */
+	else if ((channel >= IOH_DMA_CHANNELS_MAX) || (channel < 0)) {
+		IOH_LOG(KERN_ERR,
+			"ioh_set_dma_mode -> Invalid Channel number : " "%d.\n",
+			channel);
+		retval = -ENODEV;
+	}
+	/* Checking whether channel not allocated.              */
+	else if (ioh_dma_channel_table[channel].ch_alloced == (u16) 0) {
+		IOH_LOG(KERN_ERR,
+			"ioh_set_dma_mode -> Channel not allocated.\n");
+		retval = -EINVAL;
+	}
+	/* Checking if channel already enabled.                 */
+	else if (ioh_dma_channel_info[channel].bChEnabled == 1) {
+		IOH_LOG(KERN_ERR,
+			"ioh_set_dma_mode -> Channel already enabled.\n");
+		retval = -EBUSY;
+	}
+	/* Checking for validity of DMA Transfer MODE.  */
+	else if ((stModeParam.DMATransferMode != (u16) DMA_ONE_SHOT_MODE) &&
+		 (stModeParam.DMATransferMode !=
+		  (u16) DMA_SCATTER_GATHER_MODE)) {
+		IOH_LOG(KERN_ERR,
+			"ioh_set_dma_mode -> Invalid DMA Transfer mode.\n");
+		retval = -EINVAL;
+	}
+	/* Checking for validity of Transfer Direction. */
+	else if ((stModeParam.TransferDirection != (u16) IOH_DMA_DIR_OUT_TO_IN)
+		 && (stModeParam.TransferDirection !=
+		     (u16) IOH_DMA_DIR_IN_TO_OUT)) {
+		IOH_LOG(KERN_ERR,
+			"ioh_set_dma_mode -> Invalid DMA Transfer Direction." \
+			"\n");
+		retval = -EINVAL;
+	}
+	/* Checking for validity of Transfer Size Type. */
+	else if ((stModeParam.DMASizeType != (u16) IOH_DMA_SIZE_TYPE_8BIT) &&
+		 (stModeParam.DMASizeType != (u16) IOH_DMA_SIZE_TYPE_16BIT) &&
+		 (stModeParam.DMASizeType != (u16) IOH_DMA_SIZE_TYPE_32BIT)) {
+		IOH_LOG(KERN_ERR,
+			"ioh_set_dma_mode -> Invalid DMA Size Type.\n");
+		retval = -EINVAL;
+	} else {
+		/* Setting the required DMA mode. */
+		retval = dma_set_mode(channel, stModeParam);
+		IOH_DEBUG("ioh_set_dma_mode -> Function dma_set_mode "
+			  "returned %d.\n", retval);
+	}
+
+	IOH_DEBUG("Function ioh_set_dma_mode returns %d.\n", retval);
+	return retval;
+}
+EXPORT_SYMBOL(ioh_set_dma_mode);
+
+/*! @ingroup	InterfaceLayerAPI
+	@fn		int ioh_set_dma_addr(int channel, unsigned int iaddr,
+				unsigned int oaddr)
+	@brief		Used to set the in and out address of the DMA channel.
+	@remarks	Sets the address of the inside bridge and the outside
+				bridge for the 'One Shot Mode' of DMA Transfer.
+				This function is invoked by functions from other
+				modules. The main tasks performed by this
+				function are:
+				- Verifies whether the obtained parameters are
+				valid, if not suitable error status codes are
+				returned to the called function.
+				- If valid interacts with the HAL API to set the
+				inside and outside address and returns the
+				status code returned by the HAL API.
+	@note		This function is accessible by other kernel modules. The
+				following points has to be noted while passing
+				the in-address and out-address paramter.
+				- The address passed should be valid physical
+				address within the memory space.
+				- It should not be a configuration space or IO
+				space address.
+				- If the transfer is for large data, the address
+				should point to contagious alligned memory space
+				.
+
+	@param	channel		[@ref IN]	DMA channel number .
+	@param	iaddr		[@ref IN]	Address of inside bridge.
+	@param	oaddr		[@ref IN]	Address of outside bridge.
+
+	@return int
+		- @ref IOH_DMA_SUCCESS	--> On success.
+		- -EAGAIN	--> The device is in suspend mode.
+		- -ENODEV	--> Specified DMA channel does not exist.
+		- -EINVAL	--> Parameter passed is invalid.
+		- -EBUSY	--> DMA transfer in progress or channel is
+					already enabled.
+
+*/
+int ioh_set_dma_addr(int channel, unsigned int iaddr, unsigned int oaddr)
+{
+	int retval;
+
+	/* If the device is in suspend mode. */
+	if (1 == ioh_device_suspended) {
+		IOH_LOG(KERN_ERR,
+			"ioh_set_dma_addr -> Device is in suspend mode.\n");
+		retval = -EAGAIN;
+	}
+	/* Checking for validity of channel number  */
+	else if ((channel >= IOH_DMA_CHANNELS_MAX) || (channel < 0)) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_addr -> Invalid Channel "
+			"number: %d.\n", channel);
+		retval = -ENODEV;
+	}
+	/* Checking whether channel is not allocated. */
+	else if (ioh_dma_channel_table[channel].ch_alloced == (u16) 0) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_addr -> Channel not "
+			"allocated.\n");
+		retval = -EINVAL;
+	}
+	/* Checking whether the channel is already enabled. */
+	else if (ioh_dma_channel_info[channel].bChEnabled == 1) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_addr -> Channel already "
+			"enabled.\n");
+		retval = -EBUSY;
+	}
+	/*Checking if addresses specified are NULL or not */
+	else if ((iaddr == 0) || (oaddr == 0)) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_addr -> Invalid address.\n");
+		retval = -EINVAL;
+	}
+	/* Checking if the mode of transfer is  other than ONE_SHOT. */
+	else if (ioh_dma_channel_info[channel].DMATransferMode !=
+		 (u16) DMA_ONE_SHOT_MODE) {
+		IOH_LOG(KERN_ERR,
+			"ioh_set_dma_addr -> Current Mode is "
+			"not DMA_ONE_SHOT_MODE.\n");
+		retval = -EINVAL;
+	} else {
+		/* setting the in and out address. */
+		retval = dma_set_addr(channel, iaddr, oaddr);
+		IOH_DEBUG("ioh_set_dma_addr -> Function dma_set_addr invoked "
+			  "successfully returned %d.\n", retval);
+	}
+
+	IOH_DEBUG("Function ioh_set_dma_addr returns %d.\n", retval);
+	return retval;
+}
+EXPORT_SYMBOL(ioh_set_dma_addr);
+
+/*!	@ingroup	InterfaceLayerAPI
+	@fn		int ioh_set_dma_count(int channel, unsigned int count)
+	@brief		Used to set the DMA transfer count for a DMA channel.
+	@remarks	Sets the value of DMA transfer count. This function
+				sets the count value only for the 'One Shot
+				Mode' of DMA Transfer. This function is invoked
+				by functions from other modules. The main tasks
+				performed by this function are:
+				- Verifies whether the obtained parameters are
+				valid, if not suitable error status codes are
+				returned to the called function.
+				- If valid interacts with the HAL API to set the
+				access count settings and returns the status
+				code returned by the HAL API.
+	@note		This function is accessible by other kernel modules.
+
+	@param		channel	[@ref IN]	DMA channel number.
+	@param		count	[@ref IN]	The number of bytes to transfer.
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+			- -EAGAIN	--> The device is in suspend mode.
+			- -ENODEV	--> Specified DMA channel does not
+						exist.
+			- -EBUSY	--> DMA transfer in progress or channel
+						is already enabled.
+			- -EINVAL	--> Parameter passed is invalid.
+
+ */
+int ioh_set_dma_count(int channel, unsigned int count)
+{
+	int retval = IOH_DMA_SUCCESS;
+
+	/* Checking if the device is in suspend mode. */
+	if (1 == ioh_device_suspended) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_count -> The device is in "
+			"suspend mode.");
+		retval = -EAGAIN;
+	}
+	/* Checking for validity of channel number.  */
+	else if ((channel >= IOH_DMA_CHANNELS_MAX) || (channel < 0)) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_count -> Invalid Channel "
+			"number : %d.\n", channel);
+		retval = -ENODEV;
+	}
+	/* Checking whether channel is not allocated. */
+	else if (ioh_dma_channel_table[channel].ch_alloced == (u16) 0) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_count -> Channel is not "
+			"allocated.\n");
+		retval = -EINVAL;
+	}
+	/* Checking whether the channel is enabled. */
+	else if (ioh_dma_channel_info[channel].bChEnabled == 1) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_count -> Channel already "
+			"enabled.\n");
+		retval = -EBUSY;
+	}
+	/* Checking if the mode of transfer is other than ONE_SHOT. */
+	else if (ioh_dma_channel_info[channel].DMATransferMode !=
+		 (u16) DMA_ONE_SHOT_MODE) {
+		IOH_LOG(KERN_ERR,
+			"ioh_set_dma_count -> Current Mode is "
+			"not DMA_ONE_SHOT_MODE.\n");
+		retval = -EINVAL;
+	}
+	/* Checking the limits of count value. */
+	else {
+		unsigned int max_count;
+
+		switch (ioh_dma_channel_info[channel].DMAAccessSize) {
+		case IOH_DMA_SIZE_TYPE_8BIT:
+			max_count = IOH_DMA_8BIT_COUNT_MAX;
+			break;
+
+		case IOH_DMA_SIZE_TYPE_16BIT:
+			max_count = IOH_DMA_16BIT_COUNT_MAX;
+			break;
+
+		case IOH_DMA_SIZE_TYPE_32BIT:
+			max_count = IOH_DMA_32BIT_COUNT_MAX;
+			break;
+
+		default:
+			IOH_LOG(KERN_ERR, "ioh_set_dma_count -> Invalid Access "
+				"Size.\n");
+			max_count = 0;
+			retval = -EINVAL;
+			break;
+		}
+
+		if ((retval == IOH_DMA_SUCCESS) && (count > max_count)) {
+			IOH_LOG(KERN_ERR,
+				"ioh_set_dma_count -> Count (%d) exceeds "
+				"limit the maximum expected count (%d).\n",
+				count, max_count);
+			retval = -EINVAL;
+		}
+	}
+
+	if (IOH_DMA_SUCCESS == retval) {
+		/* Setting the count. */
+		retval = dma_set_count(channel, count);
+		IOH_DEBUG
+		    ("ioh_set_dma_count -> Function dma_set_count returned "
+		     "%d.\n", retval);
+	}
+
+	IOH_DEBUG("Function ioh_set_dma_count returns %d.\n", retval);
+	return retval;
+}
+EXPORT_SYMBOL(ioh_set_dma_count);
+
+/*! @ingroup	InterfaceLayerAPI
+	@fn	int ioh_set_dma_desc(int channel, struct ioh_dma_desc *start,
+			struct ioh_dma_desc *end)
+	@brief		Used to set the DMA channel descriptors.
+	@remarks	Sets the DMA descriptor for the 'Scatter/Gather mode'
+				of DMA transfer. This function is invoked by
+				functions from other kernel modules. The main
+				tasks performed by this function are:
+				- Verifies whether the obtained parameters are
+				valid, if not suitable error status codes are
+				returned to the called function.
+				- If valid interacts with the HAL API to set the
+				descriptor settings and returns the status code
+				returned by the HAL API.
+	@note		This function is accessible by other kernel modules. The
+				following points have to be noted while passing
+				the "start" and "end" pointer of the descriptor.
+				- The address pointed by them should be physical
+				address with valid virtual address.
+				- The space should be alligned and accessible by
+				the DMA hardware.
+				- An easy way to perform this is to allocate the
+				descriptor memory using kmalloc.
+				- The last two bits of the physical address
+				should be suitably set so as to perform suitable
+				action after completion of each descriptor
+				action.
+				- The in-address and out-address within each
+				descriptor should be a valid memory space
+				physical address.
+
+	@param	channel	[@ref IN]	DMA channel number
+	@param	start	[@ref IN]	A pointer to the first descriptor.
+	@param	end	[@ref IN]	A pointer to the last descriptor.
+
+	@return	int
+		- @ref IOH_DMA_SUCCESS	--> On success.
+		- -EAGAIN		--> The device is in suspend.
+		- -EINVAL		--> For invalid parameters.
+		- -ENODEV		--> Specified DMA channel is not exist.
+		- -EBUSY		--> If DMA transfer is in progress or
+					channel is already enabled.
+*/
+int ioh_set_dma_desc(int channel, struct ioh_dma_desc *start,
+		     struct ioh_dma_desc *end)
+{
+	int retval;
+
+	/* Checking if the device is in suspend mode. */
+	if (1 == ioh_device_suspended) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_desc -> The device is in "
+			"suspend mode.\n");
+		retval = -EAGAIN;
+	}
+	/* Checking for validity of channel number  */
+	else if ((channel >= IOH_DMA_CHANNELS_MAX) || (channel < 0)) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_desc -> Invalid Channel number "
+			": %d.\n", channel);
+		retval = -ENODEV;
+	}
+	/* Checking whether channel is not allocated. */
+	else if (ioh_dma_channel_table[channel].ch_alloced == (u16) 0) {
+		IOH_LOG(KERN_ERR,
+			"ioh_set_dma_desc -> Channel not allocated.\n");
+		retval = -EINVAL;
+	}
+	/* Checking whether the channel is enabled. */
+	else if (ioh_dma_channel_info[channel].bChEnabled == 1) {
+		IOH_LOG(KERN_ERR,
+			"ioh_set_dma_desc -> Channel already enabled.\n");
+		retval = -EBUSY;
+	}
+	/* Checking if the mode is other than SCATTER_GATHER. */
+	else if (ioh_dma_channel_info[channel].DMATransferMode !=
+		 (u16) DMA_SCATTER_GATHER_MODE) {
+		IOH_LOG(KERN_ERR,
+			"ioh_set_dma_desc -> Current mode id is not "
+			"SCATTER GATHER.\n");
+		retval = -EINVAL;
+	}
+	/* Checking whether start and end pointers are NULL or not */
+	else if ((start == NULL) || (end == NULL)) {
+		IOH_LOG(KERN_ERR,
+			"ioh_set_dma_desc -> NULL pointer parameter.\n");
+		retval = -EINVAL;
+	} else {
+		/* Setting the descriptors. */
+		retval = dma_set_desc(channel, start, end);
+		IOH_DEBUG("ioh_set_dma_desc -> Function dma_set_desc "
+			  "returned %d.\n", retval);
+	}
+
+	IOH_DEBUG("Function ioh_set_dma_desc returns %d.\n", retval);
+	return retval;
+}
+EXPORT_SYMBOL(ioh_set_dma_desc);
+
+/*! @ingroup	InterfaceLayerAPI
+	@fn	int ioh_add_dma_desc(int channel, struct ioh_dma_desc *start,
+			struct ioh_dma_desc *end)
+	@brief		Used to append the DMA descriptors for a channel.
+	@remarks	Used when a new chain of descriptors is to be appended
+				to the existing chain of descriptors. This
+				function is invoked by functions from other
+				modules. The main tasks performed by this
+				function are:
+				- Verifies whether the obtained parameters are
+				valid, if not suitable error status codes are
+				returned to the called function.
+				- If valid interacts with the HAL API to append
+				the descriptor settings and returns the status
+				code returned by the HAL API.
+	@note		This function is accessible by other kernel modules.
+				The following points have to be noted while
+				passing the "start" and "end" pointer of the
+				descriptor.
+				- The address pointer by them should be physical
+				address with valid virtual address.
+				- The space should be alligned and accessible by
+				the DMA hardware.
+				- An easy way to perform this is to allocate the
+				descriptor memory using kmalloc.
+				- The last two bits of the physical address
+				should be suitably set so as to perform suitable
+				action after completion of each descriptor
+				action.
+				- The in-address and out-address within each
+				descriptor should be a valid memory space
+				physical address.
+
+	@param	channel	[@ref IN]	DMA channel number
+	@param	start	[@ref IN]	A pointer to the first descriptor.
+	@param	end	[@ref IN]	A pointer to the last descriptor.
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+			- -EAGAIN	--> The device is in suspend mode.
+			- -ENODEV	--> Specified DMA channel does not
+						exist.
+			- -EINVAL	--> Invalid parameters passed.
+			- -EBUSY	--> If DMA Transfer in progress or
+						channel is already enabled.
+ */
+int ioh_add_dma_desc(int channel, struct ioh_dma_desc *start,
+		     struct ioh_dma_desc *end)
+{
+	int retval;
+
+	/* Checking whether the device is in suspend mode. */
+	if (1 == ioh_device_suspended) {
+		IOH_LOG(KERN_ERR,
+			"ioh_add_dma_desc -> The device is in suspend "
+			"mode.\n");
+		retval = -EAGAIN;
+	}
+	/* Checking for validity of channel number  */
+	else if ((channel >= IOH_DMA_CHANNELS_MAX) || (channel < 0)) {
+		IOH_LOG(KERN_ERR, "ioh_add_dma_desc -> Invalid Channel "
+			"number : %d", channel);
+		retval = -ENODEV;
+	}
+	/* Checking whether channel is not allocated. */
+	else if (ioh_dma_channel_table[channel].ch_alloced == (u16) 0) {
+		IOH_LOG(KERN_ERR,
+			"ioh_add_dma_desc -> Channel not alloctaed.\n");
+		retval = -EINVAL;
+	}
+	/* Checking whether the channel is enabled. */
+	else if (ioh_dma_channel_info[channel].bChEnabled == 1) {
+		IOH_LOG(KERN_ERR,
+			"ioh_add_dma_desc -> Channel already enabled.\n");
+		retval = -EBUSY;
+	}
+	/* Checking whether the mode is other than SCATTER_GATHER. */
+	else if (ioh_dma_channel_info[channel].DMATransferMode !=
+		 (u16) DMA_SCATTER_GATHER_MODE) {
+		IOH_LOG(KERN_ERR,
+			"ioh_add_dma_desc -> Current mode id is not "
+			"SCATTER_GATHER.\n");
+		retval = -EINVAL;
+	}
+	/* Checking if descriptor field of the channel is set earlier. */
+	else if ((ioh_dma_channel_info[channel].pHeadOfList == NULL) ||
+		 (ioh_dma_channel_info[channel].pTailOfList == NULL)) {
+		IOH_LOG(KERN_ERR, "ioh_add_dma_desc -> Descriptor list not "
+			"set earlier.\n");
+		retval = -EINVAL;
+	}
+	/* Checking whether start and end pointers are NULL or not */
+	else if ((start == NULL) || (end == NULL)) {
+		IOH_LOG(KERN_ERR,
+			"ioh_add_dma_desc -> NULL pointer parameter.\n");
+		retval = -EINVAL;
+	} else {
+		/* Appending the descriptors to the available list. */
+		retval = dma_add_desc(channel, start, end);
+		IOH_DEBUG
+		    ("ioh_add_dma_desc -> Function dma_add_desc returned %d.\n",
+		     retval);
+	}
+
+	IOH_DEBUG("Function ioh_add_dma_desc returns %d.\n", retval);
+	return retval;
+}
+EXPORT_SYMBOL(ioh_add_dma_desc);
+
+/*! @ingroup	InterfaceLayerAPI
+	@fn			int ioh_enable_dma(int channel)
+	@brief		Used to enable a DMA channel.
+	@remarks	Used when a DMA channel has to be enabled. This
+				function is invoked by functions from other
+				kernel modules. The main tasks performed by this
+				function are:
+				- Verifies whether the obtained parameters are
+				valid, if not suitable error status codes are
+				returned to the called function.
+				- If valid interacts with the HAL API to enable
+				the channel and returns the status code returned
+				by the HAL API.
+	@note		This function is accessible by other kernel modules.
+
+	@param		channel		[@ref IN]	DMA channel number .
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+			- -EAGAIN		--> Device is in suspend mode.
+			- -ENODEV		--> Specified DMA channel does
+							not exist.
+			- -EINVAL		--> Specified channel is not
+							allocated.
+			- -EBUSY		--> DMA Transfer already in
+							progress or channel is
+							already enabled.
+ */
+int ioh_enable_dma(int channel)
+{
+	int retval;
+
+	/* Checking whether the device is in suspend mode. */
+	if (ioh_device_suspended == 1) {
+		IOH_LOG(KERN_ERR, "ioh_enable_dma -> Device is in suspend "
+			"mode.\n");
+		retval = -EAGAIN;
+	}
+	/* Checking for validity of channel number  */
+	else if ((channel >= IOH_DMA_CHANNELS_MAX) || (channel < 0)) {
+		IOH_LOG(KERN_ERR, "ioh_enable_dma ->Invalid Channel number "
+			": %d.\n", channel);
+		retval = -ENODEV;
+	}
+	/* Checking whether channel is allocated. */
+	else if (ioh_dma_channel_table[channel].ch_alloced == (u16) 0) {
+		IOH_LOG(KERN_ERR, "ioh_enable_dma -> Channel not allocated.\n");
+		retval = -EINVAL;
+	}
+	/* Checking whether the channel is already enabled. */
+	else if (ioh_dma_channel_info[channel].bChEnabled == 1) {
+		IOH_LOG(KERN_ERR,
+			"ioh_enable_dma -> Channel already enabled.\n");
+		retval = -EBUSY;
+	} else {
+		/* Enabling the channel. */
+		retval = dma_enable_ch(channel);
+		IOH_DEBUG("ioh_enable_dma -> Function dma_enable_ch returned "
+			  "%d.\n", retval);
+	}
+
+	IOH_DEBUG("Function ioh_enable_dma returns %d.\n", retval);
+	return retval;
+}
+EXPORT_SYMBOL(ioh_enable_dma);
+
+/*! @ingroup	InterfaceLayerAPI
+	@fn			int ioh_disable_dma(int channel)
+	@brief		Used to disable a DMA channel.
+	@remarks	Used when a DMA channel has to be disabled. This
+				function is invoked by functions from other
+				kernel modules. The main tasks performed by this
+				function are:
+				- Verifies whether the obtained parameters are
+				valid, if not suitable error status codes are
+				returned to the called function.
+				- If valid interacts with the HAL API to disable
+				the channel and returns the status code returned
+				by the HAL API.
+	@note		This function is accessible by other kernel modules.
+
+	@param		channel	[@ref IN]	DMA channel number .
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+			- -ENODEV	--> Specified DMA channel does not
+						exist.
+			- -EINVAL	--> Specified channel is not allocated.
+
+ */
+int ioh_disable_dma(int channel)
+{
+	int retval;
+	u16 statusInfo;
+
+	/* Checking whether the device is in suspend mode. */
+	if (ioh_device_suspended == 1) {
+		IOH_LOG(KERN_ERR, "ioh_disable_dma -> Device is in "
+			"suspend mode.\n");
+		retval = -EAGAIN;
+	}
+	/* Checking for validity of channel number.  */
+	else if ((channel >= IOH_DMA_CHANNELS_MAX) || (channel < 0)) {
+		IOH_LOG(KERN_ERR, "ioh_disable_dma -> Invalid Channel "
+			"number : %d", channel);
+		retval = -ENODEV;
+	}
+	/* Checking whether channel is allocated. */
+	else if (ioh_dma_channel_table[channel].ch_alloced == (u16) 0) {
+		IOH_LOG(KERN_ERR, "ioh_disable_dma -> Channel not "
+			"allocated.\n");
+		retval = -EINVAL;
+	}
+	/* Check whether channel is already disabled. */
+	else if (ioh_dma_channel_info[channel].bChEnabled == (u16) 0) {
+		retval = IOH_DMA_SUCCESS;
+	} else {
+		u32 counter = COUNTER_LIMIT;
+
+		/* Wait for any DMA for certain interval transfer to end
+		   before disabling the channel */
+		do {
+			get_dma_status(channel, &statusInfo);
+		} while ((counter--) && (statusInfo != (u16) DMA_STATUS_IDLE));
+
+		/* Disabling the channel. */
+		retval = dma_disable_ch(channel);
+		IOH_DEBUG("ioh_disable_dma -> Function dma_disable_ch "
+			  "returned %d.\n", retval);
+
+	}
+
+	IOH_DEBUG("Function ioh_disable_dma returns " "%d.\n", retval);
+	return retval;
+}
+EXPORT_SYMBOL(ioh_disable_dma);
+
+/*! @ingroup	InterfaceLayerAPI
+	@fn	int ioh_dma_set_callback(int channel,
+			void (*ioh_dma_cbr)( int value,unsigned long data1),
+			unsigned long data)
+	@brief	Used to set the callback function for particular DMA channel.
+	@remarks	Sets the callback function to be called when an
+				interrupt occurs. This function is invoked by
+				functions from other kernel modules. The main
+				tasks performed by this function are:
+				- Verifies whether the obtained parameters are
+				valid, if not suitable error status codes are
+				returned to the called function.
+				- If valid interacts with the HAL API to set the
+				callback function settings and returns the
+				status code returned by the HAL API.
+	@note		This function is accessible by other kernel modules.
+
+	@param		channel		[@ref IN]	DMA channel number .
+	@param	ioh_dma_cbr	[@ref IN]	Pointer to the call-back
+							function.
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+			- -EAGAIN		--> Device is in suspend mode.
+			- -EINVAL		--> Parameter passed is invalid.
+			- -ENODEV		--> Specified DMA channel does
+							not exist.
+			- -EBUSY		--> If the channel is already
+							enabled.
+ */
+int ioh_dma_set_callback(int channel,
+			 void (*ioh_dma_cbr) (int value, unsigned long data1),
+			 unsigned long data)
+{
+	int retval;
+
+	/* Checking whether the device is in suspend mode. */
+	if (ioh_device_suspended == 1) {
+		IOH_LOG(KERN_ERR, "ioh_dma_set_callback -> The device is "
+			"in suspend mode.\n");
+		retval = -EAGAIN;
+	}
+	/* Checking for validity of channel number  */
+	else if ((channel >= IOH_DMA_CHANNELS_MAX) || (channel < 0)) {
+		IOH_LOG(KERN_ERR, "ioh_dma_set_callback -> Invalid Channel "
+			"number : %d.\n", channel);
+		retval = -ENODEV;
+	}
+	/* Checking whether channel is not allocated. */
+	else if (ioh_dma_channel_table[channel].ch_alloced == (u16) 0) {
+		IOH_LOG(KERN_ERR,
+			"ioh_dma_set_callback -> Channel not allocated.\n");
+		retval = -EINVAL;
+	}
+	/* Checking whether the channel is already enabled. */
+	else if (ioh_dma_channel_info[channel].bChEnabled == 1) {
+		IOH_LOG(KERN_ERR,
+			"ioh_dma_set_callback -> Channel already enabled.\n");
+		retval = -EBUSY;
+	}
+	/* Checking whether function pointer is NULL or not */
+	else if (ioh_dma_cbr == NULL) {
+		IOH_LOG(KERN_ERR,
+			"ioh_dma_set_callback -> NULL pointer parameter.\n");
+		retval = -EINVAL;
+	} else {
+		/* Setting the callback. */
+		dma_set_callback(channel, ioh_dma_cbr, data);
+		IOH_DEBUG
+		    ("ioh_dma_set_callback -> Function dma_set_callback invoked"
+		     " successfully.\n");
+
+		retval = IOH_DMA_SUCCESS;
+	}
+
+	IOH_DEBUG("Function ioh_dma_set_callback " "returns %d.\n", retval);
+	return retval;
+}
+EXPORT_SYMBOL(ioh_dma_set_callback);
+
+/*! @ingroup	InterfaceLayer
+	@fn		int ioh_set_dma_priority (int channel, int priority)
+	@brief		Sets the priority of the DMA channel.
+	@remarks	Sets the priority that has to be assigned for a
+				particular channel. This function is invoked by
+				functions from other kernel modules. The main
+				tasks performed by this function are:
+				- Verifies whether the obtained parameters are
+				valid, if not, suitable error status codes are
+				returned to the called function.
+				- If valid, interacts with the HAL API to set
+				the DMA channel priority settings and returns
+				the status code returned by the HAL API.
+	@note		This function is accessible by other kernel modules.
+
+	@param	channel		[@ref IN]	DMA channel number.
+	@param	priority	[@ref IN]	Priority to be set for the
+							DMA channel.
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+			- -EAGAIN	--> Device is in suspend mode.
+			- -EINVAL	--> Parameter passed is invalid.
+			- -EBUSY	--> If channel is in use.
+			- -ENODEV	--> Specified DMA channel does not
+						exist.
+
+ */
+int ioh_set_dma_priority(int channel, int priority)
+{
+	int retval;
+
+	/* Checking whether the device is in suspend mode. */
+	if (ioh_device_suspended == 1) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_priority -> The device is "
+			"in suspend mode.\n");
+		retval = -EAGAIN;
+	}
+	/* Checking for validity of channel number  */
+	else if ((channel >= IOH_DMA_CHANNELS_MAX) || (channel < 0)) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_priority -> Invalid Channel "
+			"number : %d", channel);
+		retval = -ENODEV;
+	}
+	/* Checking whether channel is not allocated. */
+	else if (ioh_dma_channel_table[channel].ch_alloced == (u16) 0) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_priority -> Channel not "
+			"allocated.\n");
+		retval = -EINVAL;
+	}
+	/* Checking whether the device is enabled. */
+	else if (ioh_dma_channel_info[channel].bChEnabled == 1) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_priority -> Channel already "
+			"enabled.\n");
+		retval = -EBUSY;
+	}
+	/* Check for validity of priority value */
+	else if ((priority > 3) || (priority < 0)) {
+		IOH_LOG(KERN_ERR, "ioh_set_dma_priority -> Invalid value "
+			"priority (%d)", priority);
+		retval = -EINVAL;
+	} else {
+		retval = dma_set_priority(channel, priority);
+		IOH_DEBUG("ioh_set_dma_priority -> Function dma_set_priority "
+			  "returns %d.\n", retval);
+	}
+
+	IOH_DEBUG("Function ioh_set_dma_priority returns " "%d.\n", retval);
+	return retval;
+}
+EXPORT_SYMBOL(ioh_set_dma_priority);
+
+/*! @ingroup	InterfaceLayerAPI
+	@fn			int ioh_dma_direct_start (int channel)
+	@brief		Used to initiate a DMA transfer.
+	@remarks	Generates the DMA request to begin DMA transfer
+				on a particular channel. This function is
+				invoked by functions from other kernel modules.
+				The main tasks performed by this function are:
+				- Verifies whether the obtained parameters are
+				valid, if not suitable error status codes are
+				returned to the called function.
+				- If valid interacts with the HAL API to
+				initiate the DMA process and returns the status
+				code returned by the HAL API.
+	@note		This function is accessible by other kernel modules.
+
+	@param		channel  DMA channel number.
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+			- -EAGAIN	--> Device is in suspend mode.
+			- -EBUSY	--> Specified DMA channel is not idle.
+			- -ENODEV	--> Specified DMA channel does not
+						exist.
+			- -EINVAL	--> Specified channel is not allocated.
+
+ */
+int ioh_dma_direct_start(int channel)
+{
+	int retval = 0;
+
+	/* Checking whether the device is in suspend mode. */
+	if (ioh_device_suspended == 1) {
+		IOH_LOG(KERN_ERR, "ioh_dma_direct_start -> The device is in "
+			"suspend mode.\n");
+		retval = -EAGAIN;
+	}
+	/* Checking for validity of channel number  */
+	else if ((channel >= IOH_DMA_CHANNELS_MAX) || (channel < 0)) {
+		IOH_LOG(KERN_ERR, "ioh_dma_direct_start -> Invalid Channel "
+			"number : %d.\n", channel);
+		retval = -ENODEV;
+	}
+	/* Checking whether channel is reserved or not */
+	else if (ioh_dma_channel_table[channel].ch_alloced == (u16) 0) {
+		IOH_LOG(KERN_ERR, "ioh_dma_direct_start -> Channel not "
+			"allocated.\n");
+		retval = -EINVAL;
+	}
+	/* Checking whether the device is not enabled. */
+	else if (ioh_dma_channel_info[channel].bChEnabled == 0) {
+		IOH_LOG(KERN_ERR, "ioh_dma_direct_start -> Channel not "
+			"enabled.\n");
+		retval = -EBUSY;
+	} else {
+		/* Initiating the DMA transfer */
+		retval = dma_direct_start(channel);
+		IOH_DEBUG("ioh_dma_direct_start -> Function dma_direct_start "
+			  "returned %d.\n", retval);
+	}
+
+	IOH_DEBUG("Function ioh_dma_direct_start returns " "%d.\n", retval);
+	return retval;
+}
+EXPORT_SYMBOL(ioh_dma_direct_start);
--- /dev/null
+++ b/drivers/dma/pch_dma/pch_dma_main.h
@@ -0,0 +1,264 @@
+/**
+ * @file ioh_dma_main.h
+ *
+ * @brief
+ *		This file declares the structures & data types used by the
+ *		IOH_DMA driver.
+ *
+ * @version 0.90
+ * @section
+ * 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; version 2 of the License.
+ *
+ * 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.
+ *
+ * <hr>
+ */
+
+/*
+ * History:
+ * Copyright (C) 2008 OKI SEMICONDUCTOR Co., LTD.
+ * All rights reserved.
+ *
+ * created:
+ *	WIPRO 03/07/2009
+ * modified:
+ *	WIPRO 08/14/2009
+ *
+ */
+
+#ifndef __IOH_DMA_H__
+#define __IOH_DMA_H__
+
+/*!	@ingroup	InterfaceLayer
+	@def		DMA_ONE_SHOT_MODE
+	@brief		Constant used to denote the mode as ONE_SHOT.
+	@note		This constant is used by other modules to make the
+				DMA module aware of the mode it requires.
+*/
+#define DMA_ONE_SHOT_MODE			(0x2U)
+
+/*!	@ingroup	InterfaceLayer
+	@def		DMA_SCATTER_GATHER_MODE
+	@brief		Constant used to denote the mode as SCATTER_GATHER.
+	@note		This constant is used by other modules to make the
+				DMA module aware of the mode it requires.
+*/
+#define DMA_SCATTER_GATHER_MODE		(0x1U)
+
+/*!	@ingroup	InterfaceLayer
+	@def		IOH_DMA_SIZE_TYPE_8BIT
+	@brief		Constant used to denote the access size as 8BIT.
+	@note		This constant is used by other modules to make the
+				DMA module aware of the access size it requires.
+*/
+#define IOH_DMA_SIZE_TYPE_8BIT			((0x3U << 12))
+
+/*!	@ingroup	InterfaceLayer
+	@def		IOH_DMA_SIZE_TYPE_16BIT
+	@brief		Constant used to denote the access size as 16BIT.
+	@note		This constant is used by other modules to make the
+				DMA module aware of the access size it requires.
+*/
+#define IOH_DMA_SIZE_TYPE_16BIT			((0x2U << 12))
+
+/*!	@ingroup	InterfaceLayer
+	@def		IOH_DMA_SIZE_TYPE_32BIT
+	@brief		Constant used to denote the access size as 32BIT.
+	@note		This constant is used by other modules to make the
+				DMA module aware of the access size it requires.
+*/
+#define IOH_DMA_SIZE_TYPE_32BIT			(0x0U)
+
+/*!	@ingroup	InterfaceLayer
+	@def		IOH_DMA_DIR_OUT_TO_IN
+	@brief		Constant used to denote the transfer direction as
+				OUT_TO_IN.
+	@note		This constant is used by other modules to make the
+				DMA module aware of the transfer direction it
+				requires.
+*/
+#define IOH_DMA_DIR_OUT_TO_IN				(0x4)
+
+/*!	@ingroup	InterfaceLayer
+	@def		IOH_DMA_DIR_IN_TO_OUT
+	@brief		Constant used to denote the transfer direction as
+				IN_TO_OUT.
+	@note		This constant is used by other modules to make the
+				DMA module aware of the transfer direction it
+				requires.
+*/
+#define IOH_DMA_DIR_IN_TO_OUT				(0x0)
+
+/*!	@ingroup	InterfaceLayer
+	@def		IOH_DMA_END
+	@brief		Constant used to denote the transfer status as ACCESS
+	@note		This constant is used by DMA modules to make the
+				other module aware that the DMA operation ended
+				normally.
+*/
+#define IOH_DMA_END							(0)
+
+/*!	@ingroup	InterfaceLayer
+	@def		IOH_DMA_ABORT
+	@brief		Constant used to denote the transfer status as ACCESS
+	@note		This constant is used by DMA modules to make the
+				other module aware that the DMA abort has
+				occurred.
+*/
+#define IOH_DMA_ABORT						(-1)
+
+/* Bits to be sit as LSB2 bits of descriptor address. */
+/*!	@ingroup	InterfaceLayer
+	@def		DMA_DESC_END_WITH_INTERRUPT
+	@brief		Mask value for modifying the next descriptor
+				address, so that the descriptor end with
+				interrupt.
+*/
+#define DMA_DESC_END_WITH_INTERRUPT	(0x00000001UL)
+
+/*!	@ingroup	InterfaceLayer
+	@def		DMA_DESC_FOLLOW_WITH_INTERRUPT
+	@brief		Mask value for modifying the next descriptor
+				address, so that the descriptor follow with
+				interrupt.
+
+*/
+#define DMA_DESC_FOLLOW_WITH_INTERRUPT	(0x00000003UL)
+
+/*!	@ingroup	InterfaceLayer
+	@def		DMA_DESC_END_WITHOUT_INTERRUPT
+	@brief		Mask value for modifying the next descriptor
+				address, so that the descriptor end without
+				interrupt.
+*/
+#define DMA_DESC_END_WITHOUT_INTERRUPT	(0x00000000UL)
+
+/*!	@ingroup	InterfaceLayer
+	@def		DMA_DESC_FOLLOW_WITHOUT_INTERRUPT
+	@brief		Mask value for modifying the next descriptor
+				address, so that the descriptor follow without
+				interrupt.
+
+*/
+#define DMA_DESC_FOLLOW_WITHOUT_INTERRUPT	(0x00000002UL)
+
+/*!	@ingroup	InterfaceLayer
+	@def		IOH_DMA_8BIT_COUNT_MAX
+	@brief		The maximun transfer count that can be set for
+				a 8Bit Access.
+
+*/
+#define IOH_DMA_8BIT_COUNT_MAX	(0x3FF)
+
+/*!	@ingroup	InterfaceLayer
+	@def		IOH_DMA_16BIT_COUNT_MAX
+	@brief		The maximun transfer count that can be set for
+				a 16Bit Access.
+
+*/
+#define IOH_DMA_16BIT_COUNT_MAX	(0x3FF)
+
+/*!	@ingroup	InterfaceLayer
+	@def		IOH_DMA_32BIT_COUNT_MAX
+	@brief		The maximun transfer count that can be set for
+				a 32Bit Access.
+
+*/
+#define IOH_DMA_32BIT_COUNT_MAX	(0x7FF)
+
+/*!	@ingroup	DMA
+	@def		IOH_DMA_SUCCESS
+	@brief		The value indicating a success.
+*/
+#define IOH_DMA_SUCCESS				(0)
+
+/*!	@ingroup	DMA
+	@def		IOH_DMA_FAILURE
+	@brief		The value indicating a failure.
+*/
+#define IOH_DMA_FAILURE				(-1)
+
+/*!	@ingroup	InterfaceLayerFacilitators
+	@enum		ioh_channel_request_id
+	@brief		Constant used to denote the channel request type.
+	@note		These constants are used by other modules to make the
+				DMA module aware of the channel type it
+				requires.
+*/
+enum ioh_channel_request_id {
+	IOH_DMA_TX_DATA_REQ0 = 1,	/**< Transmission channel 0. */
+	IOH_DMA_RX_DATA_REQ0,		/**< Reception channel 0. */
+	IOH_DMA_TX_DATA_REQ1,		/**< Transmission channel 1. */
+	IOH_DMA_RX_DATA_REQ1,		/**< Reception channel 1. */
+	IOH_DMA_TX_DATA_REQ2,		/**< Transmission channel 2. */
+	IOH_DMA_RX_DATA_REQ2,		/**< Reception channel 2. */
+	IOH_DMA_TX_DATA_REQ3,		/**< Transmission channel 3. */
+	IOH_DMA_RX_DATA_REQ3,		/**< Reception channel 3. */
+	IOH_DMA_TX_DATA_REQ4,		/**< Transmission channel 4. */
+	IOH_DMA_RX_DATA_REQ4,		/**< Reception channel 4. */
+	IOH_DMA_TX_DATA_REQ5,		/**< Transmission channel 5. */
+	IOH_DMA_RX_DATA_REQ5		/**< Reception channel 5. */
+};
+
+/*!	@ingroup	InterfaceLayerFacilitators
+	@struct		__ioh_dma_mode_param
+	@brief		Format for specifying the mode characteristics of
+				a channel.
+	@note		This structure is used by other modules to make the
+				DMA module aware of the channel mode
+				characteristics.
+*/
+
+struct ioh_dma_mode_param {
+	u16 TransferDirection;	/**< Direction of Transfer(IN to OUT or OUT to
+				IN). */
+	u16 DMASizeType;	/**< Type of DMA Transfer size (8bit, 16bit or
+				32bit). */
+	u16 DMATransferMode;	/**< Mode of Transfer (ONE_SHOT_MODE or
+				SCATTER_GATHER_MODE). */
+};
+
+/*!	@ingroup	InterfaceLayerFacilitators
+	@struct		__ioh_dma_desc
+	@brief		Format for specifying the descriptors.
+	@note		This structure is used by other modules to make the
+				DMA module aware of the channel descriptors in
+				SCATTER_GATHER_MODE.
+*/
+
+struct ioh_dma_desc {
+	u32 insideAddress;     /**< Inside address.		*/
+	u32 outsideAddress;    /**< Outside address.		*/
+	u32 size;	       /**< Size.			*/
+	u32 nextDesc;	       /**< Next Descriptor address.*/
+};
+
+extern int ioh_request_dma(struct pci_dev *dev, int dreq);
+extern int ioh_free_dma(int channel);
+extern int ioh_set_dma_mode(int channel, struct ioh_dma_mode_param stModeParam);
+extern int ioh_set_dma_addr(int channel, unsigned int iaddr,
+			    unsigned int oaddr);
+extern int ioh_set_dma_count(int channel, unsigned int count);
+extern int ioh_set_dma_desc(int channel, struct ioh_dma_desc *start,
+			    struct ioh_dma_desc *end);
+extern int ioh_add_dma_desc(int channel, struct ioh_dma_desc *start,
+			    struct ioh_dma_desc *end);
+extern int ioh_enable_dma(int channel);
+extern int ioh_disable_dma(int channel);
+extern int ioh_dma_set_callback(int channel,
+				void (*ioh_dma_cbr) (int value,
+						     unsigned long data1),
+				unsigned long data);
+extern int ioh_set_dma_priority(int channel, int priority);
+extern int ioh_dma_direct_start(int channel);
+
+#endif
--- /dev/null
+++ b/drivers/dma/pch_dma/pch_dma_pci.c
@@ -0,0 +1,694 @@
+/**
+ * @file ioh_dma_pci.c
+ *
+ * @brief
+ *		This file defines the methods of IOH_DMA_CONTROLLER driver.
+ *
+ * @version 0.90
+ * @section
+ * 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; version 2 of the License.
+ *
+ * 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.
+ *
+ * <hr>
+ */
+
+/*
+ * History:
+ * Copyright (C) 2008 OKI SEMICONDUCTOR Co., LTD.
+ * All rights reserved.
+ *
+ * created:
+ *	WIPRO 03/07/2009
+ * modified:
+ *	WIPRO 08/14/2009
+ *
+ */
+
+/* inclusion of system specific header files. */
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/kernel.h>
+#include <linux/spinlock.h>
+
+/* inclusion of module specific header files. */
+#include "pch_debug.h"
+#include "pch_dma_pci.h"
+#include "pch_dma_hal.h"
+
+MODULE_LICENSE("GPL");
+
+/* Global variables */
+
+/*!	@ingroup	Global
+	@var		MODULE_NAME
+	@brief		The module name variable.
+	@remarks	This variable is used as the module name.
+*/
+#define MODULE_NAME "pch_dma"
+/*!	@ingroup	Global
+	@var		ioh_device_suspended
+	@brief		Device suspend flag.
+	@remarks	This variable is used as a flag variable
+				for denoting the device suspend state.
+	@see
+		- ioh_dma_suspend
+		- ioh_dma_resume
+*/
+unsigned char ioh_device_suspended;
+
+/*!	@ingroup	Global
+	@var		ioh_device_lock
+	@brief		Device lock variable.
+	@remarks	This variable is used as a lock variable
+				for accessing the DMA channel.
+	@see
+		- ioh_request_dma
+*/
+spinlock_t ioh_device_lock;
+
+/*!	@ingroup	Global
+	@var		ioh_dma_devices
+	@brief		Stores the details of the DMA devices.
+	@remarks	This variable is the instance of the structure
+				struct ioh_dma_devices, which includes fields
+				for storing the details of the detected DMA
+				devices. This variable facilitates easy transfer
+				of information among the different functions of
+				the DMA module.
+*/
+struct ioh_dma_devices ioh_dma_devices[IOH_DMA_MAX_DEVS];
+
+/*!	@ingroup	PCILayerFacilitators
+	@struct		ioh_dma_pcidev_id
+	@brief		The structure for specifying the supported
+				device IDs to the PCI Kernel subsystem.
+	@remarks	This structure is the instance of the
+				kernel provided structure pci_device_id,
+				which is used to store the PCI devices
+				Vendor and Device ID. This structure is
+				used during the registration of the DMA module
+				as PCI Driver. This structure makes the Kernel
+				aware of the PCI devices supported by this
+				module.
+
+	@see
+		- ioh_dma_controller_driver
+*/
+
+static const struct pci_device_id ioh_dma_pcidev_id[] __devinitdata = {
+	/* 4 Channel DMA device IDs */
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOH1_DMA4_0)},
+
+	/* 8 Channel DMA device IDs */
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOH1_DMA8_0)},
+
+	/* 12 Channel DMA device IDs */
+	{}
+};
+
+/* Function prototypes */
+static int __devinit ioh_dma_probe(struct pci_dev *pdev,
+				   const struct pci_device_id *id);
+static void __devexit ioh_dma_remove(struct pci_dev *pdev);
+static int ioh_dma_suspend(struct pci_dev *pdev, pm_message_t state);
+static int ioh_dma_resume(struct pci_dev *pdev);
+static __init int ioh_dma_pci_init(void);
+static __exit void ioh_dma_pci_exit(void);
+static inline u32 get_dev_type(u32 devid);
+
+/*!	@ingroup	PCILayer
+	@def		IOH_INVALID_DEVICE
+	@brief		The return value of @ref get_dev_type for invalid
+				device type.
+
+	@see
+		-	get_dev_type
+*/
+#define IOH_INVALID_DEVICE			(0xFFFF)
+
+/*!	@ingroup	InternalFunction
+	@fn			static inline u32 get_dev_type (u32 devid)
+	@brief		Returns the IOH device type for given PCI device id.
+	@remarks	This function returns the type of the detected DMA
+				device. The type specifies the number of DMA
+				channels contained within the detected device.
+				The tasks performed by this function include:
+				- Matches the PCI device ID passed to it with a
+				set of known device IDs.
+				- If a match is found it returns a constant
+				which indicates the device type (number of DMA
+				channels) within the device.
+				- If no match is found it returns @ref
+				IOH_INVALID_DEVICE.
+
+	@param		devid	[@ref IN]	The device ID to be verified.
+
+	@return		u32
+			-	Values other than @ref IOH_INVALID_DEVICE
+					-->	Detected device is valid and
+					supported.
+			-	@ref IOH_INVALID_DEVICE	--> Invalid device
+					detected.
+
+	@see
+			- ioh_dma_probe
+
+*/
+static inline u32 get_dev_type(u32 devid)
+{
+	u32 dev_type;
+
+	switch (devid) {
+	case PCI_DEVICE_ID_INTEL_IOH1_DMA4_0:
+		dev_type = IOH_DMA_4CH0;
+		break;
+
+	case PCI_DEVICE_ID_INTEL_IOH1_DMA8_0:
+		dev_type = IOH_DMA_8CH0;
+		break;
+
+	default:
+		IOH_LOG(KERN_ERR, "get_dev_type -> Unknown PCI "
+			"device 0x%x\n", devid);
+		dev_type = IOH_INVALID_DEVICE;
+		break;
+
+	}
+
+	IOH_DEBUG("Function get_dev_type returns %x.\n", dev_type);
+	return dev_type;
+}
+
+/*!	@ingroup	PCILayerAPI
+	@fn		static int __devinit ioh_dma_probe(struct pci_dev* pdev,
+				const struct pci_device_id* id)
+	@brief		Implements the probe function for the PCI driver.
+	@remarks	This function acts as the probe function for
+				the PCI driver. The PCI core will be invoking
+				this function once it determines that this
+				driver is suitable for handling a particular
+				hardware. The main tasks performed by this
+				function are:
+				- Confirms whether the detected device is
+				supported by the driver.
+				- Enables the PCi device.
+				- Attains the device specific resources and
+				store it for further use.
+				- Enables the device and registers the handler
+				for handling the device interrupts.
+				- Initializes the device specific data
+				structures.
+
+	@param		pdev	[@ref INOUT]	Reference to the pci_device
+				structure.
+	@param		id	[@ref IN]	Reference to the pci_device_id
+				for which this device matches.
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+			- -EIO		--> pci_enable_device error status code.
+			- -EBUSY:	--> pci_request_regions/request_irq
+				error status code.
+			- -EINVAL	--> pci_enable_device/request_irq error
+				status code/invalid device ID.
+			- -ENOMEM	--> request_irq/pci_iomap error status
+				code.
+			- -ENOSYS	--> request_irq error status code.
+
+	@see
+			- ioh_dma_controller_driver
+  */
+static int __devinit ioh_dma_probe(struct pci_dev *pdev,
+				   const struct pci_device_id *id)
+{
+	static unsigned int ioh_dma_dcount;
+	int retval;
+	u32 dev_type;
+	u32 base_addr = 0;
+	u8 device_enabled = 0;
+	u8 regions_requested = 0;
+	u8 irq_registered = 0;
+
+	do {
+		/* Getting the internally used device ID of the detected
+		device. */
+		dev_type = get_dev_type(id->device);
+		/* If invalid device. */
+		if ((IOH_INVALID_DEVICE == dev_type)) {
+			IOH_LOG(KERN_ERR, "ioh_dma_probe -> Invalid device ID "
+				"%x.\n", id->device);
+			retval = -EINVAL;
+			break;
+		}
+		IOH_DEBUG("ioh_dma_probe -> Valid device ID detected %x.\n",
+			  id->device);
+
+		/* Enabling the detected device */
+		retval = pci_enable_device(pdev);
+		if (0 != retval) {
+			IOH_LOG(KERN_ERR,
+				"ioh_dma_probe -> Function pci_enable_device "
+				"failed, returned %d.\n", retval);
+			break;
+		}
+		device_enabled = 1;
+		IOH_DEBUG
+		    ("ioh_dma_probe -> Function pci_enable_device invoked "
+		    "successfully returned %d.\n", retval);
+
+		pci_set_master(pdev);
+		IOH_DEBUG("ioh_dma_probe -> Function pci_set_master invoked "
+			  "successfully.\n");
+
+		/* Requesting the PCI device regions. */
+		retval = pci_request_regions(pdev, MODULE_NAME);
+		if (0 != retval) {
+			IOH_LOG(KERN_ERR,
+				"ioh_dma_probe -> Function pci_request_regions "
+				"failed, returned %d.\n", retval);
+			break;
+		}
+		regions_requested = 1;
+		IOH_DEBUG
+		    ("ioh_dma_probe -> Function pci_request_regions invoked "
+		    "successfully returned %d.\n", retval);
+
+		/* Remapping the device space to kernel space. */
+		/* Wipro 1/13/2010 Use Mem BAR */
+		base_addr = (u32) pci_iomap(pdev, 1, 0);
+		if (0 == base_addr) {
+			IOH_LOG(KERN_ERR,
+				"ioh_dma_probe -> Function pci_iomap failed "
+				"returned %x.\n", base_addr);
+			retval = -ENOMEM;
+			break;
+		}
+		IOH_DEBUG
+		    ("ioh_dma_probe -> Function pci_iomap invoked successfully."
+		     "\n");
+
+		/* Filling in the details within the device structure. */
+		ioh_dma_devices[ioh_dma_dcount].dev_typ = dev_type;
+		ioh_dma_devices[ioh_dma_dcount].base_addr = base_addr;
+		ioh_dma_devices[ioh_dma_dcount].dev = (void *)pdev;
+
+		/* Registering the interrupt handler. */
+		retval =
+		    request_irq(pdev->irq, dma_interrupt, IRQF_SHARED,
+				MODULE_NAME, &ioh_dma_devices[ioh_dma_dcount]);
+		if (0 != retval) {
+			IOH_LOG(KERN_ERR,
+				"ioh_dma_probe -> Function request_irq failed, "
+				"returned %d.\n", retval);
+
+			break;
+		}
+		irq_registered = 1;
+		IOH_DEBUG
+		    ("ioh_dma_probe -> Function request_irq invoked "
+		     "successfully returned %d.\n", retval);
+
+		/* Initializing the DMA device. */
+		dma_init(base_addr, dev_type);
+		IOH_DEBUG
+		    ("ioh_dma_probe -> Function dma_init invoked successfully."
+		     "\n");
+
+		/* Stroing the device structure reference for further use. */
+		pci_set_drvdata(pdev, &ioh_dma_devices[ioh_dma_dcount]);
+
+		/* Initializing the suspend flag and lock variable. */
+		if (0 == ioh_dma_dcount) {	/* Initialize only once. */
+			ioh_device_suspended = 0;
+			spin_lock_init(&ioh_device_lock);
+		}
+
+		/* Incrementing the device structure index. */
+		ioh_dma_dcount++;
+
+		/* Probe successful. */
+		retval = IOH_DMA_SUCCESS;
+		IOH_DEBUG("ioh_dma_probe -> Probe successful.\n");
+
+	} while (0);
+
+	if (IOH_DMA_SUCCESS != retval) {
+		/* Un-registering the interrupt handler. */
+		if (1 == irq_registered) {
+			free_irq(pdev->irq, &ioh_dma_devices[ioh_dma_dcount]);
+			IOH_DEBUG("ioh_dma_probe -> Function free_irq invoked "
+				  "successfully.\n");
+		}
+		/* Unmapping the remapped region. */
+		if (0 != base_addr) {
+			pci_iounmap(pdev, (void *)base_addr);
+			IOH_DEBUG
+			    ("ioh_dma_probe -> Function pci_iounmap invoked "
+			     "successfully.\n");
+		}
+		/* Releasing the requested regions. */
+		if (1 == regions_requested) {
+			pci_release_regions(pdev);
+			IOH_DEBUG
+			    ("ioh_dma_probe -> Function pci_release_regions "
+			    "invoked successfully.\n");
+		}
+		/* Disabling the device. */
+		if (1 == device_enabled) {
+			pci_disable_device(pdev);
+			IOH_DEBUG
+			    ("ioh_dma_probe -> Function pci_disable_device "
+			    "invoked successfully.\n");
+		}
+
+		IOH_DEBUG("ioh_dma_probe -> Probe failed.\n");
+	}
+
+	IOH_DEBUG("Function ioh_dma_probe returns %d.\n", retval);
+	return retval;
+}
+
+/*!	@ingroup	PCILayerAPI
+	@fn	static void __devexit ioh_dma_remove(struct pci_dev* pdev)
+	@brief		Implements the remove function for the PCi driver.
+	@remarks	This function is invoked by the PCI subsystem of the
+				Kernel when the DMA device is removed or the
+				module is unloaded.
+				It de-initializes and releases all the resources
+				attained during device detection. The main tasks
+				performed by this function are:
+				- De-initializes the DMA device.
+				- De-initializes the device specific data
+				structures.
+				- Releases all the resources attained during the
+				device detection phase.
+
+	@param	pdev	[@ref INOUT]	Reference to the pci_device structure.
+
+	@return		None.
+
+	@see
+			- ioh_dma_controller_driver
+  */
+static void __devexit ioh_dma_remove(struct pci_dev *pdev)
+{
+	struct ioh_dma_devices *dev;
+
+	/* Getting the driver data. */
+	dev = pci_get_drvdata(pdev);
+	/* Re-setting the driver data. */
+	pci_set_drvdata(pdev, NULL);
+
+	/* De-initializing the device. */
+	dma_exit(dev->dev_typ);
+	IOH_DEBUG("ioh_dma_remove -> Function dma_exit invoked "
+		  "successfully.\n");
+
+	/* Un-registering the interrupt handler. */
+	free_irq(pdev->irq, dev);
+	IOH_DEBUG("ioh_dma_remove -> Function free_irq invoked "
+		  "successfully.\n");
+
+	/* Un-mapping the remapped memory address. */
+	pci_iounmap(pdev, (void *)dev->base_addr);
+	dev->base_addr = 0;
+	IOH_DEBUG("ioh_dma_remove -> Function pci_iounmap invoked "
+		  "successfully.\n");
+
+	/* Releasing the requested regions. */
+	pci_release_regions(pdev);
+	IOH_DEBUG("ioh_dma_remove -> Function pci_release_regions "
+		  "invoked successfully.\n");
+
+	/* Disabling the device. */
+	pci_disable_device(pdev);
+	IOH_DEBUG("ioh_dma_remove -> Function pci_disable_device "
+		  "invoked successfully.\n");
+
+	IOH_DEBUG("Function ioh_dma_remove invoked  "
+		  "successfully for device %x.\n", pdev->device);
+}
+
+#ifdef CONFIG_PM
+/*!	@ingroup	PCILayerAPI
+	@fn		static int ioh_dma_suspend(struct pci_dev* pdev,
+				pm_message_t state)
+	@brief		Implements the suspend function for the pci_driver.
+	@remarks	This function is used as the suspend function of the PCI
+				Driver.
+				The PCI core will be invoking this function once
+				it receives a suspend event from the PM layer.
+				The main tasks performed by this functions are:
+				- Prepares the device so that it can enter the
+				suspend state by saving the current state.
+				- Disables all the DMA channels and the
+				associated interrupts.
+				- Changes the power state of the device to low
+				power state.
+
+	@param	pdev	[@ref INOUT]	Reference to the pci_device structure.
+	@param	state	[@ref IN]	The state of the device.
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+			- -ENOMEM	--> pci_save_state error status code.
+
+	@see
+			- ioh_dma_controller_driver
+  */
+static int ioh_dma_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+	int retval;
+	struct ioh_dma_devices *dev;
+
+	/* Setting flag for denoting Suspension. */
+	ioh_device_suspended = 1;
+
+	/* Getting the driver data. */
+	dev = pci_get_drvdata(pdev);
+
+	/* Saving the current state of the device. */
+	retval = pci_save_state(pdev);
+	if (retval == 0) {
+		IOH_DEBUG("ioh_dma_suspend -> Function pci_save_state invoked "
+			  "successfully (returned %d).\n", retval);
+
+		/* De-initializing the device for suspension. */
+		dma_exit(dev->dev_typ);
+		IOH_DEBUG("ioh_dma_suspend -> Function dma_exit invoked "
+			  "successfully.\n");
+
+		/* Disabling the wake-up feature. */
+		pci_enable_wake(pdev, PCI_D3hot, 0);
+		IOH_DEBUG("ioh_dma_suspend -> Function pci_enable_wake "
+			  "invoked successfully.\n");
+
+		/* Setting the device to new state. */
+		pci_set_power_state(pdev, pci_choose_state(pdev, state));
+		IOH_DEBUG("ioh_dma_suspend -> Function pci_set_power_state "
+			  "invoked successfully.\n");
+
+		/* Disabling the device. */
+		pci_disable_device(pdev);
+		IOH_DEBUG("ioh_dma_suspend -> Function pci_disable_device "
+			  "invoked successfully.\n");
+
+		retval = IOH_DMA_SUCCESS;
+		IOH_DEBUG("ioh_dma_suspend -> Suspension successful for "
+			  "the device %x.\n", pdev->device);
+	} else {
+		IOH_LOG(KERN_ERR,
+			"ioh_dma_suspend -> Function pci_save_state failed"
+			"returned %d.\n", retval);
+
+		/* De-setting the flag on Suspend failure. */
+		ioh_device_suspended = 0;
+
+		IOH_DEBUG("ioh_dma_suspend -> Suspension un-successful for "
+			  "the device %x.\n", pdev->device);
+	}
+
+	IOH_DEBUG("Function ioh_dma_suspend returns %d.\n", retval);
+	return retval;
+}
+
+/*!	@ingroup	PCILayerAPI
+	@fn			static int ioh_dma_resume(struct pci_dev* pdev)
+	@brief		Implements the resume function for the pci_driver.
+	@remarks	This function is used as the resume function of the
+				PCI driver. The PCI core will be invoking this
+				function once it receives a resume event from
+				the PM layer. The main tasks performed by this
+				function are:
+				- Restores the power state of the device to
+				normal state.
+				- Enables the device so that it returns to its
+				normal state.
+
+	@param		pdev	[@ref INOUT]	Pointer to the pci_device
+				structure.
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+			- -EIO		--> pci_enable_device error status code.
+			- -EINVAL	--> pci_enable_device .
+
+	@see
+			- ioh_dma_controller_driver
+
+  */
+static int ioh_dma_resume(struct pci_dev *pdev)
+{
+	int retval;
+
+	/* Setting the device to normal power state. */
+	(void)pci_set_power_state(pdev, PCI_D0);
+	IOH_DEBUG("ioh_dma_resume -> Function pci_set_power_state invoked "
+		  "successfully.\n");
+
+	/* Restoring the device state. */
+	(void)pci_restore_state(pdev);
+	IOH_DEBUG("ioh_dma_resume -> Function pci_restore_state invoked "
+		  "successfully.\n");
+
+	/* Enabling the device. */
+	retval = pci_enable_device(pdev);
+
+	if (0 == retval) {
+		IOH_DEBUG("ioh_dma_resume -> Function pci_enable_device "
+			  "invoked successfully returned %d.\n", retval);
+
+		pci_set_master(pdev);
+		IOH_DEBUG("ioh_dma_resume -> Function pci_set_master invoked "
+			  "successfully.\n");
+
+		(void)pci_enable_wake(pdev, PCI_D3hot, 0);
+		IOH_DEBUG("ioh_dma_resume -> Function pci_enable_wake invoked "
+			  "successfully.\n");
+
+		retval = IOH_DMA_SUCCESS;
+
+		/* De-setting the suspend flag to denote resumption
+		successful. */
+		ioh_device_suspended = 0;
+
+		IOH_DEBUG("ioh_dma_resume -> Resume successful for the "
+			  "device %x.\n", pdev->device);
+	} else {
+		IOH_LOG(KERN_ERR,
+			"ioh_dma_resume -> Function pci_enable_device failed "
+			"returned %d.\n", retval);
+
+		IOH_DEBUG("ioh_dma_resume -> Resume failed for the device "
+			  "%x.\n", pdev->device);
+	}
+
+	IOH_DEBUG("Function ioh_dma_resume returns %d.\n", retval);
+	return retval;
+}
+#endif
+
+/*!	@ingroup	PCILayerFacilitators
+	@struct		ioh_dma_controller_driver
+	@brief		Used for registering the PCI driver functionalities.
+	@remarks	This is an instance of the structure pci_driver which
+				stores references to the PCI Driver
+				functionalities.
+				It is used during PCI driver registration for
+				interfacing the DMA module functionalities with
+				that of the Kernel subsystem.
+
+	@see
+			- ioh_dma_pci_init
+			- ioh_dma_pci_exit
+*/
+
+static struct pci_driver ioh_dma_controller_driver = {
+	.name = "ioh_dma",		/**< Name of the module. */
+	.id_table = ioh_dma_pcidev_id,	/**< The list of supported devices. */
+	.probe = ioh_dma_probe,		/**< The probe function. */
+	.remove = __devexit_p(ioh_dma_remove),	/**< The remove function. */
+#ifdef CONFIG_PM
+	.suspend = ioh_dma_suspend,	/**< The suspend function. */
+	.resume = ioh_dma_resume	/**< The resume function. */
+#endif
+};
+
+/*!	@ingroup	PCILayerAPI
+	@fn			static __init int ioh_dma_pci_init(void)
+	@brief		Module initialization routine.
+	@remarks	This function is invoked when the module is
+				loaded. The main tasks performed by this
+				function are:
+				- Initializes the module.
+				- Initializes the local structures
+				and registers the module as PCI Driver
+				with the kernel subsystem.
+
+	@return	int
+			- @ref IOH_DMA_SUCCESS	--> On success.
+			- -EEXIST	--> pci_register_driver error status
+						code.
+			- -EINVAL	--> pci_register_driver error status
+						code.
+			- -ENOMEM	--> pci_register_driver error status
+						code.
+
+  */
+static __init int ioh_dma_pci_init(void)
+{
+	int retval;
+
+	/* Registering the module as PCI Driver. */
+	retval = pci_register_driver(&ioh_dma_controller_driver);
+
+	if (0 == retval) {
+		IOH_DEBUG
+		    ("ioh_dma_pci_init -> Function pci_register_driver invoked "
+		     "successfully returned %d.\n", retval);
+
+		retval = IOH_DMA_SUCCESS;
+	} else {
+		IOH_LOG(KERN_ERR,
+			"ioh_dma_pci_init -> Function pci_register_driver "
+			"failed returned %d.\n", retval);
+	}
+
+	IOH_DEBUG("Function ioh_dma_pci_init returns %d.\n", retval);
+	return retval;
+}
+
+/*!	@ingroup	PCILayerAPI
+	@fn			static __exit void ioh_dma_pci_exit(void)
+	@brief		Module exit handler.
+	@remarks	Kernel subsystem will be invoking this routine
+				once the module gets unloaded. The main tasks
+				performed by this function are:
+				- Un-registers the PCI driver.
+				- Unloads the module.
+
+	@return		None.
+  */
+static __exit void ioh_dma_pci_exit(void)
+{
+	/* Un-registering the module as PCI Driver. */
+	pci_unregister_driver(&ioh_dma_controller_driver);
+	IOH_DEBUG("ioh_dma_pci_exit -> Function pci_unregister_driver "
+		  "invoked successfully.\n");
+
+	IOH_DEBUG("Function ioh_dma_pci_exit invoked successfully.\n");
+}
+
+MODULE_DEVICE_TABLE(pci, ioh_dma_pcidev_id);
+module_init(ioh_dma_pci_init);
+module_exit(ioh_dma_pci_exit);
--- /dev/null
+++ b/drivers/dma/pch_dma/pch_dma_pci.h
@@ -0,0 +1,74 @@
+/**
+ * @file ioh_dma_pci.h
+ *
+ * @brief
+ * This file declares the constants & functions used by the
+ *  IOH_DMA_CONTROLLER driver.
+ *
+ * @version 0.90
+ * @section
+ * 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; version 2 of the License.
+ *
+ * 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.
+ *
+ * <hr>
+ */
+
+/*
+ * History:
+ * Copyright (C) 2008 OKI SEMICONDUCTOR Co., LTD.
+ * All rights reserved.
+ *
+ * created:
+ *	WIPRO 03/07/2009
+ * modified:
+ *	WIPRO 08/14/2009
+ *
+ */
+
+#ifndef __IOH_DMA_PCI_H__
+#define __IOH_DMA_PCI_H__
+
+/*!	@ingroup	PCILayer
+	@def		PCI_DEVICE_ID_INTEL_IOH1_DMA4_0
+	@brief		The Device ID of one of the DMA device
+				with 4 channels used for the GE devices.
+	@note		This is used for registering the DMA module
+				with the PCI subsystem of the Kernel, so that
+				the module is loaded when the required device
+				is detected.
+
+	@see
+		- ioh_dma_pcidev_id
+		- get_dev_type
+*/
+#define PCI_DEVICE_ID_INTEL_IOH1_DMA4_0		(0x8815UL)
+
+/*!	@ingroup	PCILayer
+	@def		PCI_DEVICE_ID_DMA8_0_CONTROLLER
+	@brief		The Device ID of one of the DMA device
+				with 8 channels used for the GE devcies.
+	@note		This is used for registering the DMA module
+				with the PCI subsystem of the Kernel, so that
+				the module is loaded when the required device
+				is detected.
+
+	@see
+		- ioh_dma_pcidev_id
+		- get_dev_type
+*/
+#define PCI_DEVICE_ID_INTEL_IOH1_DMA8_0		(0x8810UL)
+
+extern unsigned char ioh_device_suspended;	/* The device suspend flag.  */
+extern spinlock_t ioh_device_lock;	/* The device lock variable. */
+
+#endif