summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/linux-netbook-2.6.33.2/linux-2.6.34-pch-i2c.patch
blob: e6f6f675d5d3d50f42719c1a69d1b2a4d8a63aa7 (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
From: Masayuki Ohtake <masa-korg@dsn.okisemi.com>
Subject: OKI Semiconductor PCH I2C driver

This driver implements I2C controls for PCH.

Signed-off-by: Masayuki Ohtake <masa-korg@dsn.okisemi.com>
Acked-by: Wang Qi <qi.wang@intel.com>

---
 drivers/i2c/busses/Kconfig        |  7 +
 drivers/i2c/busses/Makefile       |  3
 drivers/i2c/busses/pch_common.h   |  146
 drivers/i2c/busses/pch_debug.h    |  60
 drivers/i2c/busses/pch_i2c_hal.c  |  1930
 drivers/i2c/busses/pch_i2c_hal.h  |  337
 drivers/i2c/busses/pch_i2c_main.c |  247
 drivers/i2c/busses/pch_i2c_pci.c  |  583
 drivers/i2c/i2c-dev.c             |  28
+++++++++++++++++++++++++++++++ 9 files changed, yy insertions(+)
diff -urN linux-2.6.33.1/drivers/i2c/busses/Kconfig topcliff-2.6.33.1/drivers/i2c/busses/Kconfig
--- linux-2.6.33.1/drivers/i2c/busses/Kconfig	2010-03-16 01:09:39.000000000 +0900
+++ topcliff-2.6.33.1/drivers/i2c/busses/Kconfig	2010-03-23 10:40:18.000000000 +0900
@@ -7,6 +7,13 @@
 comment "PC SMBus host controller drivers"
 	depends on PCI
 
+config PCH_I2C
+	tristate "PCH I2C"
+	depends on PCI
+	help
+	  If you say yes to this option, support will be included for the SMB
+	  PCH I2C Host controller.
+
 config I2C_ALI1535
 	tristate "ALI 1535"
 	depends on PCI
diff -urN linux-2.6.33.1/drivers/i2c/busses/Makefile topcliff-2.6.33.1/drivers/i2c/busses/Makefile
--- linux-2.6.33.1/drivers/i2c/busses/Makefile	2010-03-16 01:09:39.000000000 +0900
+++ topcliff-2.6.33.1/drivers/i2c/busses/Makefile	2010-03-23 10:40:18.000000000 +0900
@@ -75,3 +75,6 @@
 ifeq ($(CONFIG_I2C_DEBUG_BUS),y)
 EXTRA_CFLAGS += -DDEBUG
 endif
+
+obj-$(CONFIG_PCH_I2C) += pch_i2c.o
+pch_i2c-objs := pch_i2c_main.o pch_i2c_pci.o pch_i2c_hal.o
diff -urN linux-2.6.33.1/drivers/i2c/busses/pch_common.h topcliff-2.6.33.1/drivers/i2c/busses/pch_common.h
--- linux-2.6.33.1/drivers/i2c/busses/pch_common.h	1970-01-01 09:00:00.000000000 +0900
+++ topcliff-2.6.33.1/drivers/i2c/busses/pch_common.h	2010-03-23 10:40:18.000000000 +0900
@@ -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
diff -urN linux-2.6.33.1/drivers/i2c/busses/pch_debug.h topcliff-2.6.33.1/drivers/i2c/busses/pch_debug.h
--- linux-2.6.33.1/drivers/i2c/busses/pch_debug.h	1970-01-01 09:00:00.000000000 +0900
+++ topcliff-2.6.33.1/drivers/i2c/busses/pch_debug.h	2010-03-23 10:40:18.000000000 +0900
@@ -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
diff -urN linux-2.6.33.1/drivers/i2c/busses/pch_i2c_hal.c topcliff-2.6.33.1/drivers/i2c/busses/pch_i2c_hal.c
--- linux-2.6.33.1/drivers/i2c/busses/pch_i2c_hal.c	1970-01-01 09:00:00.000000000 +0900
+++ topcliff-2.6.33.1/drivers/i2c/busses/pch_i2c_hal.c	2010-03-23 10:40:18.000000000 +0900
@@ -0,0 +1,1930 @@
+/*!
+* @file		ioh_i2c_hal.c
+* @brief 	This file contains definitions of HAL Layer APIs and
+*		Internal functions
+* @version 0.95
+* @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 02/20/2009
+* modified:
+*	WIPRO 05/21/2009
+*
+*/
+
+/*includes*/
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/i2c.h>
+#include <linux/fs.h>
+#include <linux/io.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/jiffies.h>
+
+#include "pch_i2c_hal.h"
+#include "pch_common.h"
+#include "pch_debug.h"
+
+/**
+ *macro definition
+ */
+
+/*! @ingroup	I2C_HALLayer
+@def 		IOH_I2CSADR
+@brief 		I2CSADR register offset
+*/
+#define IOH_I2CSADR	(0x00)	/* I2C slave address register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CCTL
+@brief 		I2CCTL register offset
+*/
+#define IOH_I2CCTL	(0x04)	/* I2C control register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CSR
+@brief 		I2CSR register offset
+*/
+#define IOH_I2CSR	(0x08)	/* I2C status register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CDR
+@brief 		I2CDR register offset
+*/
+#define IOH_I2CDR	(0x0C)	/* I2C data register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CMON
+@brief 		I2CMON register offset
+*/
+#define IOH_I2CMON	(0x10)	/* I2C bus monitor register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CBC
+@brief 		I2CBC register offset
+*/
+#define IOH_I2CBC	(0x14)	/* I2C bus transfer rate setup counter */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CMOD
+@brief 		I2CMOD register offset
+*/
+#define IOH_I2CMOD	(0x18)	/* I2C mode register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CBUFSLV
+@brief 		I2CBUFSLV register offset
+*/
+#define IOH_I2CBUFSLV	(0x1C)	/* I2C buffer mode slave address register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CBUFSUB
+@brief 		I2CBUFSUB register offset
+*/
+#define IOH_I2CBUFSUB	(0x20)	/* I2C buffer mode subaddress register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CBUFFOR
+@brief 		I2CBUFFOR register offset
+*/
+#define IOH_I2CBUFFOR	(0x24)	/* I2C buffer mode format register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CBUFCTL
+@brief 		I2CBUFCTL register offset
+*/
+#define IOH_I2CBUFCTL	(0x28)	/* I2C buffer mode control register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CBUFMSK
+@brief 		I2CBUFMSK register offset
+*/
+#define IOH_I2CBUFMSK	(0x2C)	/* I2C buffer mode interrupt mask register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CBUFSTA
+@brief 		I2CBUFSTA register offset
+*/
+#define IOH_I2CBUFSTA	(0x30)	/* I2C buffer mode status register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CBUFLEV
+@brief 		I2CBUFLEV register offset
+*/
+#define IOH_I2CBUFLEV	(0x34)	/* I2C buffer mode level register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CESRFOR
+@brief 		I2CESRFOR register offset
+*/
+#define IOH_I2CESRFOR	(0x38)	/* EEPROM software reset mode format register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CESRCTL
+@brief 		I2CESRCTL register offset
+*/
+#define IOH_I2CESRCTL	(0x3C) /* EEPROM software reset mode control register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CESRMSK
+@brief 		I2CESRMSK register offset
+*/
+#define IOH_I2CESRMSK	(0x40)	/* EEPROM software reset mode
+				 * interrupt mask register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CESRSTA
+@brief 		I2CESRSTA register offset
+*/
+#define IOH_I2CESRSTA	(0x44)	/* EEPROM software reset mode status register */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CTMR
+@brief 		I2CTMR register offset
+*/
+#define IOH_I2CTMR	(0x48)	/* I2C timer register  */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CSRST
+@brief 		I2CSRST register offset
+*/
+#define IOH_I2CSRST	(0xFC)	/* I2C reset register  */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CNF
+@brief 		I2CNF register offset
+*/
+#define IOH_I2CNF	(0xF8)	/* I2C noise filter register  */
+
+/*! @ingroup 	I2C_HALLayer
+@def 		BUS_IDLE_TIMEOUT
+@brief 		Time out value when waiting for Bus Idle
+*/
+#define BUS_IDLE_TIMEOUT	(20)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_I2CCTL_I2CMEN
+@brief 		Bitmask to enable I2CMEN bit
+*/
+#define IOH_I2CCTL_I2CMEN 	(0x0080)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		TEN_BIT_ADDR_DEFAULT
+@brief 		Default bits to be added for 10 bit addressing
+*/
+#define TEN_BIT_ADDR_DEFAULT 	(0xF000)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		TEN_BIT_ADDR_MASK
+@brief 		10 bit address mask
+*/
+#define TEN_BIT_ADDR_MASK	(0xF0)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_START
+@brief 		Set the start bit in Normal mode
+*/
+#define IOH_START		(0x0020)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_ESR_START
+@brief 		Bitmask to set Start bit in EEPROM Software Reset mode
+*/
+#define IOH_ESR_START 		(0x0001)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_BUFF_START
+@brief 		Bitmask to set Start bit in Buffer mode
+*/
+#define IOH_BUFF_START 		(0x1)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_REPSTART
+@brief 		Bitmask to set repeated start bit
+*/
+#define IOH_REPSTART		(0x0004)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_ACK
+@brief 		Ack bit position in I2CCTL register
+*/
+#define IOH_ACK			(0x0008)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_GETACK
+@brief 		Mask to extract the ack bit
+*/
+#define IOH_GETACK 		(0x0001)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		CLR_REG
+@brief 		Mask for register reset
+*/
+#define CLR_REG 		(0x0)
+/*! @ingroup 	I2C_HALLayer
+@def 		I2C_RD
+@brief 		Set read bit in I2CDR with slave address
+*/
+#define I2C_RD			(0x1)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CMCF_BIT
+@brief 		Mask for I2CMCF bit
+*/
+#define I2CMCF_BIT		(0x0080)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CMIF_BIT
+@brief 		Mask for  I2CMIF bit
+*/
+#define I2CMIF_BIT		(0x0002)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CMAL_BIT
+@brief 		Mask for I2CMAL bit
+*/
+#define I2CMAL_BIT		(0x0010)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CBMFI_BIT
+@brief 		Mask for I2CBMFI bit
+*/
+#define I2CBMFI_BIT		(0x0001)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CBMAL_BIT
+@brief 		Mask for I2CBMAL bit
+*/
+#define I2CBMAL_BIT		(0x0002)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CBMNA_BIT
+@brief 		Mask for I2CBMNA bit
+*/
+#define I2CBMNA_BIT 		(0x0004)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CBMTO_BIT
+@brief 		Mask for I2CBMTO bit
+*/
+#define I2CBMTO_BIT 		(0x0008)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CBMIS_BIT
+@brief 		Mask for I2CBMIS bit
+*/
+#define I2CBMIS_BIT 		(0x0010)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CESRFI_BIT
+@brief 		Mask for I2CESRFI bit
+*/
+#define I2CESRFI_BIT		(0X0001)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CESRTO_BIT
+@brief 		Mask for I2CESRTO bit
+*/
+#define I2CESRTO_BIT 		(0x0002)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CESRFIIE_BIT
+@brief 		Mask for I2CESRFIIE bit
+*/
+#define I2CESRFIIE_BIT 		(0x1)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CESRTOIE_BIT
+@brief 		Mask for I2CESRTOIE bit
+*/
+#define I2CESRTOIE_BIT  	(0x2)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CBMDZ_BIT
+@brief 		Mask for I2CBMDZ bit
+*/
+#define I2CBMDZ_BIT		(0x0040)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CBMAG_BIT
+@brief 		Mask for I2CBMAG bit
+*/
+#define I2CBMAG_BIT		(0x0020)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CMBB_BIT
+@brief 		Mask for I2CMBB bit
+*/
+#define I2CMBB_BIT		(0x0020)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		BUFFER_MODE_MASK
+@brief 		Status bit mask in buffer mode
+*/
+#define BUFFER_MODE_MASK	(I2CBMFI_BIT | I2CBMAL_BIT | I2CBMNA_BIT | \
+				I2CBMTO_BIT | I2CBMIS_BIT)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2C_ADDR_MSK
+@brief 		Mask to get the 8 LSB bits in 10 bit addressing
+*/
+#define I2C_ADDR_MSK		(0xFF)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2C_MSB_2B_MSK
+@brief 		Mask to get the 2 MSB bits in 10 bit addressing
+*/
+#define I2C_MSB_2B_MSK		(0x300)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		FAST_MODE_CLK
+@brief 		Fast mode clock in KHz
+*/
+#define FAST_MODE_CLK		(400)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		FAST_MODE_EN
+@brief 		Enable the fast mode
+*/
+#define FAST_MODE_EN		(0x0001)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		SUB_ADDR_LEN_MAX
+@brief 		Maximum sub address length
+*/
+#define SUB_ADDR_LEN_MAX	(4)
+
+/*! @ingroup	I2C_HALLayer
+@def 		BUF_LEN_MAX
+@brief 		Maximum buffer length in buffer mode
+*/
+#define BUF_LEN_MAX		(32)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_BUFFER_MODE
+@brief 		To enable the buffer mode
+*/
+#define IOH_BUFFER_MODE		(0x1)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		EEPROM_SW_RST_MODE
+@brief 		Mask to enable the EEPROM Software Reset mode
+*/
+#define EEPROM_SW_RST_MODE	(0x0002)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		NORMAL_INTR_ENBL
+@brief 		Mask to enable the I2C interrupts in normal mode
+*/
+#define NORMAL_INTR_ENBL	(0x0300)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		EEPROM_RST_INTR_ENBL
+@brief 		Mask to enable I2CESRFI, I2CESRTO interrupts
+		in EEPROM Software Reset mode
+*/
+#define EEPROM_RST_INTR_ENBL 	(I2CESRFIIE_BIT | I2CESRTOIE_BIT)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		EEPROM_RST_INTR_DISBL
+@brief 		Mask to disable interrupts in EEPROM Software Reset mode
+*/
+#define EEPROM_RST_INTR_DISBL 	(0x0)
+
+/*! @ingroup	I2C_HALLayer
+@def 		BUFFER_MODE_INTR_ENBL
+@brief 		Mask to enable I2CBMIS,I2CBMTO,I2CBMNA,I2CBMAL,I2CBMFI
+		interrupts in Buffer mode
+*/
+#define BUFFER_MODE_INTR_ENBL	(0x001F)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		BUFFER_MODE_INTR_DISBL
+@brief 		Mask to disable all interrupts in Buffer mode
+*/
+#define BUFFER_MODE_INTR_DISBL	(0x0)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		NORMAL_MODE
+@brief 		Specifies Normal mode
+*/
+#define NORMAL_MODE		(0x0)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		BUFFER_MODE
+@brief 		Specifies Buffer mode
+*/
+#define BUFFER_MODE		(0x1)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		EEPROM_SR_MODE
+@brief 		Specifies EEPROM software reset mode
+*/
+#define EEPROM_SR_MODE		(0x2)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2C_TX_MODE
+@brief 		Specifies Master transmission mode
+*/
+#define I2C_TX_MODE 		(0x0010)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_BUF_TX
+@brief 		Specifies Buffer transmission mode
+*/
+#define IOH_BUF_TX 		(0xFFF7)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		IOH_BUF_RD
+@brief 		Specifies Buffer reception mode
+*/
+#define IOH_BUF_RD		(0x0008)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2C_ERROR_MASK
+@brief 		Mask for errors in all modes
+*/
+#define I2C_ERROR_MASK	(I2CESRTO_EVENT | I2CBMIS_EVENT | I2CBMTO_EVENT | \
+			I2CBMNA_EVENT | I2CBMAL_EVENT | I2CMAL_EVENT)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CMAL_EVENT
+@brief 		MAL bit position in event flag
+*/
+#define I2CMAL_EVENT 		(0x0001)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CMCF_EVENT
+@brief 		MCF bit position in event flag
+*/
+#define I2CMCF_EVENT		(0x0002)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CBMFI_EVENT
+@brief 		I2CBMFI bit position in event flag
+*/
+#define I2CBMFI_EVENT 		(0x0004)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CBMAL_EVENT
+@brief 		I2CBMAL bit position in event flag
+*/
+#define I2CBMAL_EVENT 		(0x0008)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CBMNA_EVENT
+@brief 		I2CBMNA bit position in event flag
+*/
+#define I2CBMNA_EVENT		(0x0010)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CBMTO_EVENT
+@brief 		I2CBMTO bit position in event flag
+*/
+#define I2CBMTO_EVENT 		(0x0020)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CBMIS_EVENT
+@brief 		I2CBMIS bit position in event flag
+*/
+#define I2CBMIS_EVENT 		(0x0040)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CESRFI_EVENT
+@brief 		I2CESRFI bit position in event flag
+*/
+#define I2CESRFI_EVENT 		(0x0080)
+
+/*! @ingroup 	I2C_HALLayer
+@def 		I2CESRTO_EVENT
+@brief 		I2CESRTO bit position in event flag
+*/
+#define I2CESRTO_EVENT 		(0x0100)
+
+/*
+ * wait queue head
+ */
+
+/*! @ingroup 	I2C_UtilitiesAPI
+@var 		ioh_i2c_event
+@brief  	Wait queue head
+@remarks	This global variable is used to synchronize
+		data handling with interrupts
+@see		- ioh_i2c_init
+		- ioh_i2c_cb
+*/
+static wait_queue_head_t ioh_i2c_event;
+
+/* Function prototypes */
+
+/*! @ingroup 	I2C_UtilitiesAPI
+@fn 		ioh_i2c_start(struct i2c_algo_ioh_data * adap)
+@brief  	Function to generate start condition in normal mode
+*/
+static void ioh_i2c_start(struct i2c_algo_ioh_data *adap);
+
+/*! @ingroup 	I2C_UtilitiesAPI
+@fn 		ioh_i2c_buff_mode_start(struct i2c_algo_ioh_data * adap)
+@brief  	Function to generate start condition in buffer mode
+*/
+static void ioh_i2c_buff_mode_start(struct i2c_algo_ioh_data *adap);
+
+/*! @ingroup 	I2C_UtilitiesAPI
+@fn 		ioh_i2c_eeprom_swrst_start(struct i2c_algo_ioh_data * adap)
+@brief  	Function to generate start condition in EEPROM Software
+		Reset mode
+*/
+static void ioh_i2c_eeprom_swrst_start(struct i2c_algo_ioh_data *adap);
+
+/*! @ingroup 	I2C_UtilitiesAPI
+@fn 		ioh_i2c_stop(struct i2c_algo_ioh_data *adap)
+@brief  	Function to generate stop condition in normal mode
+*/
+static void ioh_i2c_stop(struct i2c_algo_ioh_data *adap);
+
+/*! @ingroup 	I2C_UtilitiesAPI
+@fn 		ioh_i2c_repstart(struct i2c_algo_ioh_data *adap)
+@brief  	Function to generate repeated start condition in normal mode
+*/
+static void ioh_i2c_repstart(struct i2c_algo_ioh_data *adap);
+
+/*! @ingroup 	I2C_UtilitiesAPI
+@fn 		ioh_i2c_getack(struct i2c_algo_ioh_data *adap)
+@brief  	Function to confirm ACK/NACK
+*/
+static s32 ioh_i2c_getack(struct i2c_algo_ioh_data *adap);
+
+/*! @ingroup 	I2C_UtilitiesAPI
+@fn 		ioh_i2c_sendack(struct i2c_algo_ioh_data *adap)
+@brief  	Function to send ACK
+*/
+static void ioh_i2c_sendack(struct i2c_algo_ioh_data *adap);
+
+/*! @ingroup 	I2C_UtilitiesAPI
+@fn 		ioh_i2c_sendnack(struct i2c_algo_ioh_data *adap)
+@brief  	Function to send NACK
+*/
+static void ioh_i2c_sendnack(struct i2c_algo_ioh_data *adap);
+
+/*! @ingroup 	I2C_UtilitiesAPI
+@fn 		ioh_i2c_wait_for_bus_idle
+		(struct i2c_algo_ioh_data *adap,s32 timeout)
+@brief  	Function to check the status of bus
+*/
+static s32 ioh_i2c_wait_for_bus_idle(struct i2c_algo_ioh_data *adap,
+				     s32 timeout);
+
+/*! @ingroup 	I2C_UtilitiesAPI
+@fn 		ioh_i2c_wait_for_xfer_complete(struct i2c_algo_ioh_data *adap)
+@brief  	Function to wait till transfer complete.
+*/
+static s32 ioh_i2c_wait_for_xfer_complete(struct i2c_algo_ioh_data *adap);
+
+/*! @ingroup 	I2C_HALLayerAPI
+  @fn		ioh_i2c_init(struct i2c_algo_ioh_data * adap)
+  @remarks	Implements the hardware initialization of I2C module.
+		The main tasks performed by this method are:
+		- Clear I2CCTL,I2CMOD,I2CBUFFOR,I2CBUFSLV,I2CBUFSUB,I2CBUFMSK,
+		  I2CESRFOR,I2CESRMSK registers.
+		- Set I2CMEN in I2CCTL to 1.
+		- Set bus speed based on module parameter.
+		- Enable required interrupts.
+		- Initialize wait queue head.
+  @note		This function always returns @ref IOH_I2C_SUCCESS
+  @param  	adap	[@ref IN] Contains reference to struct i2c_algo_ioh_data
+  @retval 	s32
+		- @ref	IOH_I2C_SUCCESS	Function returns successfully.
+  @see      	- ioh_i2c_probe
+		- ioh_i2c_resume
+ <hr>
+  */
+s32 ioh_i2c_init(struct i2c_algo_ioh_data *adap)
+{
+	u32 ioh_i2cbc;
+	u32 ioh_i2ctmr;
+	u32 reg_value = 0;
+
+#ifndef FPGA
+	/*reset I2C controller */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CSRST, 0x1);
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CSRST, 0x0);
+#endif
+	/* Initialize I2C registers */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CCTL, CLR_REG);
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CMOD, CLR_REG);
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFFOR, CLR_REG);
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFSLV, CLR_REG);
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFSUB, CLR_REG);
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFMSK, CLR_REG);
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CESRFOR, CLR_REG);
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CESRMSK, CLR_REG);
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CNF, 0x21);
+	IOH_DEBUG
+	    ("Cleared the registers IOH_I2CCTL,IOH_I2CMOD,IOH_I2CBUFFOR\n,"
+	     "IOH_I2CBUFSLV,IOH_I2CBUFSUB,IOH_I2CBUFMSK,"
+	     "\nIOH_I2CESRFOR,IOH_I2CESRMSK\n");
+
+	reg_value |= IOH_I2CCTL_I2CMEN;
+	adap->set_reg_bit((adap->ioh_i2c_base_address), IOH_I2CCTL,
+			  IOH_I2CCTL_I2CMEN);
+
+	ioh_i2c_speed = (ioh_i2c_speed == 400) ? 400 : 100;
+
+	if (ioh_i2c_speed == FAST_MODE_CLK) {
+		reg_value |= FAST_MODE_EN;
+		IOH_DEBUG("Fast mode enabled\n");
+	}
+
+	ioh_i2c_clk = (ioh_i2c_clk <= 0
+		       || ioh_i2c_clk > IOH_I2C_MAX_CLK) ? 62500 : ioh_i2c_clk;
+
+	ioh_i2cbc = ((ioh_i2c_clk) + (ioh_i2c_speed * 4)) / (ioh_i2c_speed * 8);
+	/* Set transfer speed in I2CBC */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBC, ioh_i2cbc);
+
+	ioh_i2ctmr = (ioh_i2c_clk) / 8;
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CTMR, ioh_i2ctmr);
+
+	reg_value |= NORMAL_INTR_ENBL;	/* Enable interrupts in normal mode */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CCTL, reg_value);
+
+	IOH_DEBUG("In ioh_i2c_init: I2CCTL =%x\n",
+		  (adap->readreg(adap->ioh_i2c_base_address, IOH_I2CCTL)));
+	IOH_DEBUG("In ioh_i2c_init: ioh_i2cbc =%x\n", ioh_i2cbc);
+	IOH_DEBUG("In ioh_i2c_init: ioh_i2ctmr =%x\n", ioh_i2ctmr);
+
+	IOH_DEBUG("Enable interrupts\n");
+	init_waitqueue_head(&ioh_i2c_event);
+	return IOH_I2C_SUCCESS;
+}
+
+/*! @ingroup 	I2C_HALLayerAPI
+  @fn  		ioh_i2c_writebytes(struct i2c_adapter *i2c_adap ,
+			struct i2c_msg *msgs, u32 last, u32 first)
+  @remarks  	Function to write data to I2C bus in normal mode.
+		The main tasks performed by this method are:
+		- Enable transmission mode.
+		- Send out the slave address.
+		- Wait for Bus idle and send out Start signal
+		- Perform data write operation.
+		- Send stop or repeat start as necessary, depending on whether
+		  the current message is the last message or not.
+		- Return with number of bytes transferred successfully or
+		  the error code
+  @param  	i2c_adap [@ref IN] contains reference to the struct i2c_adapter
+  @param 	msgs	 [@ref IN] contains reference to i2c_msg structure
+  @param 	last	 [@ref IN] specifies whether last message or not
+			   In the case of compound mode it will be
+			   1 for last message, otherwise 0.
+  @param 	first	 [@ref IN] specifies whether first message or not
+			   1 for first message otherwise 0.
+  @retval	s32
+		- Number of bytes transferred successfully
+		- @ref IOH_I2C_FAIL	@ref ioh_i2c_wait_for_bus_idle,
+					@ref ioh_i2c_wait_for_xfer_complete,
+					@ref ioh_i2c_getack fails
+		- -ERESTARTSYS
+		 @ref ioh_i2c_wait_for_xfer_complete was interrupted by a signal
+  @see		ioh_i2c_xfer
+ <hr>
+ */
+s32 ioh_i2c_writebytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
+				u32 last, u32 first)
+{
+
+	struct i2c_algo_ioh_data *adap = i2c_adap->algo_data;
+
+	u8 *buf;
+	u32 length;
+	u32 addr;
+	u32 addr_2_msb;
+	u32 addr_8_lsb;
+	s32 wrcount = IOH_I2C_FAIL;
+	length = msgs->len;
+	buf = msgs->buf;
+	addr = msgs->addr;
+	/* enable master tx */
+	adap->set_reg_bit((adap->ioh_i2c_base_address), IOH_I2CCTL,
+			  I2C_TX_MODE);
+
+	IOH_DEBUG("In ioh_i2c_writebytes : I2CCTL = %x\n",
+		  (adap->readreg(adap->ioh_i2c_base_address, IOH_I2CCTL)));
+	IOH_DEBUG("In ioh_i2c_writebytes : msgs->len = %d\n", length);
+
+	if (first) {
+		if (ioh_i2c_wait_for_bus_idle(adap, BUS_IDLE_TIMEOUT) ==
+		    IOH_I2C_FAIL) {
+			return IOH_I2C_FAIL;
+		}
+	}
+
+	if ((msgs->flags & I2C_M_TEN) != false) {
+		addr_2_msb = ((addr & I2C_MSB_2B_MSK) >> 7);
+		adap->writereg((adap->ioh_i2c_base_address), IOH_I2CDR,
+			       (addr_2_msb | TEN_BIT_ADDR_MASK));
+
+		if (first)
+			ioh_i2c_start(adap);
+		if ((ioh_i2c_wait_for_xfer_complete(adap) == IOH_I2C_SUCCESS) &&
+		    (ioh_i2c_getack(adap) == IOH_I2C_SUCCESS)) {
+			addr_8_lsb = (addr & I2C_ADDR_MSK);
+			adap->writereg((adap->ioh_i2c_base_address), IOH_I2CDR,
+				       (addr_8_lsb));
+
+		} else {
+			ioh_i2c_stop(adap);
+			return IOH_I2C_FAIL;
+		}
+	} else {
+		/* set 7 bit slave address and R/W bit as 0 */
+		adap->writereg((adap->ioh_i2c_base_address), IOH_I2CDR,
+			       ((addr) << 1));
+		if (first)
+			ioh_i2c_start(adap);
+	}
+
+	if ((ioh_i2c_wait_for_xfer_complete(adap) == IOH_I2C_SUCCESS) &&
+	    (ioh_i2c_getack(adap) == IOH_I2C_SUCCESS)) {
+		for (wrcount = 0; wrcount < length; ++wrcount) {
+			/* write buffer value to I2C data register */
+			adap->writereg((adap->ioh_i2c_base_address), IOH_I2CDR,
+				       buf[wrcount]);
+			IOH_DEBUG
+			  ("ioh_i2c_writebytes : writing %x to Data register\n",
+			   buf[wrcount]);
+
+			if (ioh_i2c_wait_for_xfer_complete(adap) !=
+			    IOH_I2C_SUCCESS) {
+				wrcount = IOH_I2C_FAIL;
+				break;
+			}
+
+			IOH_DEBUG("ioh_i2c_wait_for_xfer_complete return %d",
+				  IOH_I2C_SUCCESS);
+
+			if (ioh_i2c_getack(adap)) {
+				wrcount = IOH_I2C_FAIL;
+				break;
+			}
+		}
+
+		/* check if this is the last message */
+		if (last)
+			ioh_i2c_stop(adap);
+		else
+			ioh_i2c_repstart(adap);
+	} else {
+		ioh_i2c_stop(adap);
+	}
+
+	IOH_DEBUG(KERN_INFO, "ioh_i2c_writebytes return=%d\n", wrcount);
+
+	return wrcount;
+}
+
+/*! @ingroup 	I2C_HALLayerAPI
+  @fn  		ioh_i2c_readbytes(struct i2c_adapter *i2c_adap,
+			struct i2c_msg *msgs, u32 last, u32 first)
+  @remarks 	Function to read data  from I2C bus in normal mode.
+		The main tasks performed by this method are:
+		- Enable Reception mode.
+		- Send out the slave address.
+		- Wait for Bus idle and send out Start signal
+		- Perform data reads.
+		- Send stop or repeat start as necessary, depending on whether
+		  the current
+		  message read is the last message or not
+		- Return with number of bytes read (if successful) or
+		  the error code
+  @param  	i2c_adap [@ref IN] contains reference to the struct i2c_adapter
+  @param 	msgs	 [@ref INOUT] contains reference to i2c_msg structure
+  @param 	last	 [@ref IN] specifies whether last message or not
+  @param 	first	 [@ref IN] specifies whether first message or not
+  @retval 	s32	- Number of Bytes read successfully
+		- @ref IOH_I2C_FAIL    @ref ioh_i2c_wait_for_bus_idle,
+			@ref ioh_i2c_wait_for_xfer_complete,
+			@ref ioh_i2c_getack fails
+		- -ERESTARTSYS
+		 @ref ioh_i2c_wait_for_xfer_complete was interrupted by a signal
+  @see		ioh_i2c_xfer
+ <hr>
+ */
+s32 ioh_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
+			u32 last, u32 first)
+{
+
+	struct i2c_algo_ioh_data *adap = i2c_adap->algo_data;
+
+	u8 *buf;
+	u32 count = IOH_I2C_FAIL;
+	u32 length;
+	u32 addr;
+	u32 addr_2_msb;
+	length = msgs->len;
+	buf = msgs->buf;
+	addr = msgs->addr;
+
+	/* enable master reception */
+	adap->clr_reg_bit((adap->ioh_i2c_base_address), IOH_I2CCTL,
+			  I2C_TX_MODE);
+
+	if (first) {
+		if (ioh_i2c_wait_for_bus_idle(adap, BUS_IDLE_TIMEOUT) ==
+		    IOH_I2C_FAIL) {
+			return IOH_I2C_FAIL;
+		}
+	}
+
+	if ((msgs->flags & I2C_M_TEN) != false) {
+		addr_2_msb = (((addr & I2C_MSB_2B_MSK) >> 7) | (I2C_RD));
+		adap->writereg((adap->ioh_i2c_base_address), IOH_I2CDR,
+			       (addr_2_msb | TEN_BIT_ADDR_MASK));
+
+	} else {
+		/* 7 address bits + R/W bit */
+		addr = (((addr) << 1) | (I2C_RD));
+		adap->writereg((adap->ioh_i2c_base_address), IOH_I2CDR, addr);
+	}
+
+	/* check if it is the first message */
+	if (first == true)
+		ioh_i2c_start(adap);
+
+	if ((ioh_i2c_wait_for_xfer_complete(adap) == IOH_I2C_SUCCESS)
+	    && (ioh_i2c_getack(adap) == IOH_I2C_SUCCESS)) {
+		IOH_DEBUG("ioh_i2c_wait_for_xfer_complete return %d",
+			  IOH_I2C_SUCCESS);
+
+		if (length == 0) {
+
+			ioh_i2c_stop(adap);
+			(void)adap->readreg((adap->ioh_i2c_base_address),
+					    IOH_I2CDR);
+
+			count = length;
+		} else {
+			int read_index = 0;
+			int loop;
+			ioh_i2c_sendack(adap);
+
+			/* Dummy read */
+
+			for (loop = 1; loop < length; loop++) {
+				buf[read_index] =
+				    adap->readreg((adap->ioh_i2c_base_address),
+						  IOH_I2CDR);
+
+				if (loop != 1)
+					read_index++;
+
+				if (ioh_i2c_wait_for_xfer_complete(adap) !=
+				    IOH_I2C_SUCCESS) {
+					ioh_i2c_stop(adap);
+					return IOH_I2C_FAIL;
+				}
+
+			}	/* end for */
+
+			ioh_i2c_sendnack(adap);
+
+			buf[read_index] =
+			    adap->readreg((adap->ioh_i2c_base_address),
+					  IOH_I2CDR);
+
+			if (length != 1)
+				read_index++;
+
+			if (ioh_i2c_wait_for_xfer_complete(adap) ==
+			    IOH_I2C_SUCCESS) {
+				if (last)
+					ioh_i2c_stop(adap);
+				else
+					ioh_i2c_repstart(adap);
+
+				buf[read_index++] =
+				    adap->readreg((adap->ioh_i2c_base_address),
+						  IOH_I2CDR);
+				count = read_index;
+			}
+
+		}
+	} else {
+		ioh_i2c_stop(adap);
+	}
+
+	return count;
+}
+
+/*! @ingroup	I2C_HALLayerAPI
+  @fn  		ioh_i2c_entcb(s32(*ioh_i2c_ptr)(struct i2c_algo_ioh_data *adap))
+  @remarks   	Function to register call back function.
+		The main tasks performed by this method are:
+		- Validate ioh_i2c_ptr
+		- Update the reference of the callback function in the callback
+		  function pointer.
+  @param  	ioh_i2c_ptr [@ref IN] Contains reference to call back function
+  @retval 	None
+  @see       	ioh_i2c_probe
+ <hr>
+ */
+void ioh_i2c_entcb(s32(*ioh_i2c_ptr) (struct i2c_algo_ioh_data *adap))
+{
+	if (ioh_i2c_ptr != NULL) {
+		IOH_DEBUG("value in ioh_i2c_ptr = %p", ioh_i2c_ptr);
+		/* set the handler call back function */
+		ioh_i2c_cbr = ioh_i2c_ptr;
+		IOH_DEBUG("value updated in ioh_i2c_cbr = %p", ioh_i2c_cbr);
+		IOH_DEBUG("Invoked ioh_i2c_entcb successfully");
+
+	}
+}
+
+/*! @ingroup	I2C_HALLayerAPI
+  @fn  		 	ioh_i2c_handler(int irq,void * pData)
+  @remarks   	This function implements the interrupt handler for
+		the IOH I2C controller.
+		The main tasks performed by this method are:
+		- Invoke callback function.
+		- Based on return value of callback function,
+		  return IRQ_NONE or IRQ_HANDLED
+  @param  	irq 	[@ref IN] irq number
+  @param 	pData	[@ref IN] cookie passed back to the handler function
+  @retval 	irqreturn_t
+		- IRQ_NONE		Not our interrupt
+		- IRQ_HANDLED	Interrupt serviced
+  @see		 	ioh_i2c_probe
+ <hr>
+ */
+irqreturn_t ioh_i2c_handler(int irq, void *pData)
+{
+	s32 ret = 0;
+	u32 i;
+
+	struct adapter_info *adap_info = (struct adapter_info *)pData;
+	/* invoke the call back  */
+
+	if (ioh_i2c_cbr != NULL) {
+		for (i = 0; i < IOH_I2C_MAX_CHN; i++)
+			ret |= (ioh_i2c_cbr) (&adap_info->ioh_i2c_data[i]);
+	} else {
+		IOH_LOG(KERN_ERR, " Call back pointer null ...");
+	}
+
+	IOH_DEBUG("ioh_i2c_cb return = %d\n", ret);
+
+	if (ret == IOH_I2C_EVENT_SET)
+		IOH_DEBUG(" ioh_i2c_handler return IRQ_HANDLED");
+	else
+		IOH_DEBUG("ioh_i2c_handler return IRQ_NONE");
+
+	return (ret == IOH_I2C_EVENT_SET) ? (IRQ_HANDLED) : (IRQ_NONE);
+}
+
+/*! @ingroup	I2C_HALLayerAPI
+  @fn  		ioh_i2c_buffer_read
+			(struct i2c_adapter * i2c_adap,struct i2c_msg *msgs)
+  @remarks   	Function to read data  from I2C bus in buffer mode.
+		The main tasks performed by this method are:
+		- Enable Buffer Mode.
+		- Set timeout interval in I2CTMR register.
+		- Enable buffer mode interrupts.
+		- Set the I2C Slave Address in the I2CBUFSLV register.
+		- Set the number of bytes, transmission mode and
+		  sub-address length in I2CBUFFOR register.
+		- Perform the data read.
+		- Disable buffer mode interrupts.
+  @param  	i2c_adap [@ref IN]  contains reference to the struct i2c_adapter
+  @param 	msgs	 [@ref INOUT] contains reference to i2c_msg structure
+  @retval 	s32
+		- @ref IOH_I2C_SUCCESS	Function returns successfully
+		- @ref IOH_I2C_FAIL		@ref ioh_i2c_wait_for_bus_idle,
+		  @ref ioh_i2c_wait_for_xfer_complete,
+		  @ref ioh_i2c_getack fails
+		- -ERESTARTSYS
+		 @ref ioh_i2c_wait_for_xfer_complete was interrupted by a signal
+  @see		ioh_i2c_xfer
+ <hr>
+ */
+s32 ioh_i2c_buffer_read(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs)
+{
+
+	struct i2c_algo_ioh_data *adap = i2c_adap->algo_data;
+
+	u32 loop;
+	u32 rdcount = 0;
+	u32 length;
+	u32 i2cbufsub = 0;
+	u32 addr;
+	u32 i2cbufslv_7_lsb;
+	u32 i2cbufslv_10_9_bit;
+	u32 msglen;
+	/* initialize to invalid length, so that no sub address is tx-ed */
+	u32 subaddrlen = 5;
+	u32 i2cmod_prev;
+	s32 i;
+	u32 time_interval = i2c_adap->timeout;
+	u32 i2ctmr;
+	s32 retvalue = IOH_I2C_FAIL;
+	u8 *buf;
+
+	length = msgs->len;
+	buf = msgs->buf;
+	addr = msgs->addr;
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFMSK,
+		BUFFER_MODE_INTR_ENBL);
+
+	/* get the current value of I2C mod register */
+	i2cmod_prev = adap->readreg((adap->ioh_i2c_base_address), IOH_I2CMOD);
+
+	/* enable buffer mode */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CMOD,
+		IOH_BUFFER_MODE);
+
+	time_interval = (time_interval <= 10) ? (time_interval) : (10);
+
+	/* value of I2CT = (Timeout interval * PCLK frequency)/ 8 */
+	i2ctmr = (time_interval * (ioh_i2c_clk)) / 8;
+
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CTMR, i2ctmr);
+
+	/* if 10 bit addressing is selected */
+
+	if ((msgs->flags & I2C_M_TEN) != false) {
+		/* get the 8 LSBits */
+		i2cbufslv_7_lsb = (addr & I2C_ADDR_MSK);
+
+		/* get the 2 MSBits */
+		i2cbufslv_10_9_bit = ((addr & I2C_MSB_2B_MSK) << 1);
+
+		adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFSLV,
+				(TEN_BIT_ADDR_DEFAULT | i2cbufslv_7_lsb |
+				i2cbufslv_10_9_bit));
+	} else {
+		adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFSLV,
+				((addr & I2C_ADDR_MSK) << 1));
+	}
+
+	/* get sub address length, restrict to 4 bytes max */
+	subaddrlen =
+	    (buf[0] <= SUB_ADDR_LEN_MAX) ? (buf[0]) : (SUB_ADDR_LEN_MAX);
+
+	for (i = (subaddrlen - 1); i >= 0; i--) {
+		/* frame the sub address based on the length */
+		i2cbufsub |= (((u32) buf[2 - i]) << (8 * i));
+	}
+
+	msglen = length - (subaddrlen + 1);
+
+	loop = (subaddrlen + 1);
+
+	/* write the sub address to the reg */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFSUB, i2cbufsub);
+	/* clear buffers */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFLEV, CLR_REG);
+
+	rdcount = (msglen <= BUF_LEN_MAX) ? (msglen) : (BUF_LEN_MAX);
+
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFFOR,
+		((rdcount << 4) | (IOH_BUF_RD) | (subaddrlen)));
+
+	do {
+		if (ioh_i2c_wait_for_bus_idle(adap, BUS_IDLE_TIMEOUT) ==
+			IOH_I2C_FAIL) {
+			break;
+		}
+
+		ioh_i2c_buff_mode_start(adap);
+
+		IOH_DEBUG("buffer mode start");
+
+		if ((adap->readreg((adap->ioh_i2c_base_address),
+				   IOH_I2CBUFSTA) & I2CBMDZ_BIT) != 0) {
+			IOH_DEBUG("buffer read error 1");
+			break;
+		}
+
+		if (ioh_i2c_wait_for_xfer_complete(adap) == IOH_I2C_FAIL) {
+			IOH_DEBUG("buffer read error2");
+			break;
+		}
+
+		IOH_DEBUG("ioh_i2c_wait_for_xfer_complete return %d",
+				IOH_I2C_SUCCESS);
+
+		retvalue = rdcount;
+
+		for (; rdcount > 0; rdcount--, loop++) {
+			buf[loop] =
+			adap->readreg((adap->ioh_i2c_base_address),
+					IOH_I2CDR);
+
+		}
+	} while (0);
+
+	/* disable buffer mode interrupts */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFMSK,
+			BUFFER_MODE_INTR_DISBL);
+	/* restore the I2CMOD register */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CMOD, i2cmod_prev);
+
+	return retvalue;
+}
+
+/*! @ingroup 	I2C_HALLayerAPI
+  @fn  		ioh_i2c_buffer_write
+			(struct i2c_adapter * i2c_adap,struct i2c_msg * msgs)
+  @remarks 	Function to write data to I2C bus in buffer mode.
+		The main tasks performed by this method are:
+		- Enable Buffer Mode.
+		- Set timeout interval in I2CTMR register.
+		- Enable buffer mode interrupts.
+		- Set the I2C Slave Address in the I2CBUFSLV register.
+		- Set the number of bytes, transmission mode and
+		  subaddress length in I2CBUFFOR register.
+		- Perform data transfer.
+		- Disable the buffer mode interrupts.
+  @param  	i2c_adap [@ref IN] contains reference to the struct i2c_adapter
+  @param 	msgs	 [@ref INOUT] contains reference to i2c_msg structure
+  @retval    	s32
+		- @ref IOH_I2C_SUCCESS  Function returns successfully
+		- @ref IOH_I2C_FAIL    @ref ioh_i2c_wait_for_bus_idle,
+		  @ref ioh_i2c_wait_for_xfer_complete,
+		  @ref ioh_i2c_getack fails
+		- -ERESTARTSYS
+		 @ref ioh_i2c_wait_for_xfer_complete was interrupted by a signal
+  @see		ioh_i2c_xfer
+ <hr>
+ */
+s32 ioh_i2c_buffer_write(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs)
+{
+	struct i2c_algo_ioh_data *adap = i2c_adap->algo_data;
+
+	u32 loop = 0;
+	u32 wrcount = 0;
+	u32 msglen;
+	u32 i2cbufsub = 0;
+	u32 addr;
+	u32 i2cbufslv_7_lsb;
+	u32 i2cbufslv_10_9_bit;
+
+	/* initialize to invalid length, so that no sub address is tx-ed */
+	u32 subaddrlen = 5;
+	u32 i2cmod_prev;
+	s32 i;
+	u32 time_interval = i2c_adap->timeout;
+	u32 i2ctmr;
+	s32 retvalue = IOH_I2C_FAIL;
+	u8 *buf;
+
+	msglen = msgs->len;
+	buf = msgs->buf;
+	addr = msgs->addr;
+
+	/* get the current value of I2C mod register */
+	i2cmod_prev = adap->readreg((adap->ioh_i2c_base_address), IOH_I2CMOD);
+	/* enable buffer mode */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CMOD,
+			IOH_BUFFER_MODE);
+
+	time_interval = (time_interval <= 10) ? (time_interval) : (10);
+	/* value of I2CT = (Timeout interval * PCLK frequency)/ 8 */
+	i2ctmr = (time_interval * (ioh_i2c_clk)) / 8;
+
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CTMR, i2ctmr);
+
+	/* enable buffer mode interrupts */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFMSK,
+			BUFFER_MODE_INTR_ENBL);
+
+	/* if 10 bit addressing is selected */
+
+	if ((msgs->flags & I2C_M_TEN) != false) {
+		IOH_DEBUG("ioh_i2c_buffer_write...ten bit addressing");
+		/* get the 8 LSBits */
+		i2cbufslv_7_lsb = (addr & I2C_ADDR_MSK);
+
+		/* get the 2 MSBits */
+		i2cbufslv_10_9_bit = ((addr & I2C_MSB_2B_MSK) << 1);
+
+		adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFSLV,
+				(TEN_BIT_ADDR_DEFAULT | i2cbufslv_7_lsb |
+				i2cbufslv_10_9_bit));
+	} else {
+		adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFSLV,
+			((addr & I2C_ADDR_MSK) << 1));
+
+	}
+
+	/* get sub address length, restrict to 4 bytes max */
+	subaddrlen =
+		(buf[0] <= SUB_ADDR_LEN_MAX) ? (buf[0]) : (SUB_ADDR_LEN_MAX);
+
+	for (i = (subaddrlen - 1); i >= 0; i--) {
+		/* frame the sub address based on the length */
+		i2cbufsub |= (((u32) buf[2 - i]) << (8 * i));
+	}
+
+	/* subaddrlen bytes + the 1st field  */
+	loop = subaddrlen + 1;
+
+	msglen = msglen - loop;
+
+	/* write the sub address to the reg */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFSUB, i2cbufsub);
+
+	/* clear buffers */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFLEV, CLR_REG);
+
+	msglen = (msglen < BUF_LEN_MAX) ? (msglen) : (BUF_LEN_MAX);
+
+	for (wrcount = 0; wrcount < msglen; wrcount++) {
+		adap->writereg((adap->ioh_i2c_base_address), IOH_I2CDR,
+			buf[loop]);
+		IOH_DEBUG("Buffer mode %x", (buf[loop] & 0xff));
+		loop++;
+	}
+
+	/* set the number of bytes, transmission mode and sub address length */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFFOR,
+		((((wrcount << 4) & (IOH_BUF_TX)) | (subaddrlen))));
+
+	do {
+		if ((ioh_i2c_wait_for_bus_idle(adap, BUS_IDLE_TIMEOUT)) ==
+		    IOH_I2C_FAIL) {
+			break;
+		}
+
+		/* issue start bits */
+		ioh_i2c_buff_mode_start(adap);
+
+		if (((adap->readreg((adap->ioh_i2c_base_address),
+				IOH_I2CBUFSTA)) & (I2CBMDZ_BIT |
+						I2CBMAG_BIT)) != false) {
+			break;
+		}
+
+		if (ioh_i2c_wait_for_xfer_complete(adap) == IOH_I2C_FAIL)
+			break;
+
+		IOH_DEBUG("ioh_i2c_wait_for_xfer_complete return %d",
+			  IOH_I2C_SUCCESS);
+		retvalue = wrcount;
+	} while (0);
+
+	/* disable buffer mode interrupts */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFMSK,
+		       BUFFER_MODE_INTR_DISBL);
+	/* restore the I2CMOD register */
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CMOD, i2cmod_prev);
+
+	return retvalue;
+}
+
+/*! @ingroup	I2C_HALLayerAPI
+  @fn  		ioh_i2c_eeprom_sw_reset
+			(struct i2c_adapter * i2c_adap,struct i2c_msg *msgs)
+  @remarks 	Function for triggering EEPROM software reset.
+		The main tasks performed by this method are:
+		- Enable EEPROM software reset mode.
+		- Enable the required interrupts.
+		- Update timeout value in I2CTMR register.
+		- Invoke @ref ioh_i2c_eeprom_swrst_start to
+		  send software reset pattern.
+		- Disable interrupts.
+  @param  	i2c_adap [@ref IN] contains reference to the struct i2c_adapter
+  @param 	msgs	 [@ref IN] contains reference to i2c_msg structure
+  @retval 	s32
+		- @ref IOH_I2C_SUCCESS	Function returns successfully
+		- i@ref IOH_I2C_FAIL    @ref ioh_i2c_wait_for_bus_idle,
+					@ref ioh_i2c_wait_for_xfer_complete,
+		- -ERESTARTSYS
+		 @ref ioh_i2c_wait_for_xfer_complete was interrupted by a signal
+  @see      	ioh_i2c_xfer
+ <hr>
+ */
+s32 ioh_i2c_eeprom_sw_reset(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs)
+{
+
+	struct i2c_algo_ioh_data *adap = i2c_adap->algo_data;
+
+	u32 time_interval = i2c_adap->timeout;
+	u32 i2ctmr;
+	u32 i2cmod_prev;
+	u32 ioh_pattern;
+
+	s32 ret_val = IOH_I2C_FAIL;	/* init return value to error */
+
+	/* get the current value of I2C mod register */
+	i2cmod_prev = adap->readreg((adap->ioh_i2c_base_address), IOH_I2CMOD);
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CMOD, CLR_REG);
+	adap->set_reg_bit((adap->ioh_i2c_base_address), IOH_I2CMOD,
+			EEPROM_SW_RST_MODE);
+
+	IOH_DEBUG("ioh_i2c_eeprom_sw_reset : I2CMOD %x\n",
+		adap->readreg((adap->ioh_i2c_base_address), IOH_I2CMOD));
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CESRMSK,
+		EEPROM_RST_INTR_ENBL);
+
+	time_interval = (time_interval <= 10) ? (time_interval) : (10);
+
+	/* value of I2CT = (Timeout interval * PCLK frequency)/ 8 */
+	i2ctmr = (time_interval * (ioh_i2c_clk)) / 8;
+
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CTMR, i2ctmr);
+
+	/* get the EEPROM reset pattern */
+	ioh_pattern = (u32) (*(msgs->buf));
+
+	/* mode 1 & 2 are used for buffer mode selection */
+	ioh_pattern -= 2;
+
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CESRFOR,
+		ioh_pattern);
+
+	IOH_DEBUG("ioh_i2c_eeprom_sw_reset : I2CESRFOR %x\n",
+		adap->readreg((adap->ioh_i2c_base_address), IOH_I2CESRFOR));
+
+	if (ioh_i2c_wait_for_bus_idle(adap, BUS_IDLE_TIMEOUT) ==
+		IOH_I2C_SUCCESS) {
+
+		ioh_i2c_eeprom_swrst_start(adap);
+		ret_val = ioh_i2c_wait_for_xfer_complete(adap);
+
+		IOH_DEBUG("ioh_i2c_wait_for_xfer_complete return =%d\n",
+			ret_val);
+		adap->writereg((adap->ioh_i2c_base_address), IOH_I2CMOD,
+			i2cmod_prev);
+		adap->writereg((adap->ioh_i2c_base_address), IOH_I2CESRMSK,
+			EEPROM_RST_INTR_DISBL);
+	}
+
+	IOH_DEBUG("ioh_i2c_eeprom_sw_reset return=%d\n", ret_val);
+
+	return ret_val;
+}
+
+/*! @ingroup	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_cb(struct i2c_algo_ioh_data * adap)
+  @remarks   	Interrupt handler Call back function.
+		The main tasks performed by this method are:
+		- Get the current operation mode.
+		- For the current mode ,check if any of the required interrupt
+		  bits are set.
+		- Invoke wake_up_interruptible function to unblock the functions
+		  waiting for these events.
+  @param  	adap [@ref IN] Contains reference to struct i2c_algo_ioh_data
+  @retval 	s32
+		- @ref IOH_I2C_EVENT_SET Valid I2C event recognized and flagged
+		- @ref IOH_I2C_EVENT_NONE No valid I2C event
+  @see		ioh_i2c_probe
+ <hr>
+ */
+s32 ioh_i2c_cb(struct i2c_algo_ioh_data *adap)
+{
+	u32 reg_val;
+	u32 i2c_mode;
+	u32 i2c_interrupt = false;
+
+	reg_val = adap->readreg((adap->ioh_i2c_base_address), IOH_I2CMOD);
+	/* get the current mode of operation */
+	i2c_mode = reg_val & (BUFFER_MODE | EEPROM_SR_MODE);
+
+	switch (i2c_mode) {
+
+	case NORMAL_MODE:
+		{
+			reg_val =
+			    adap->readreg((adap->ioh_i2c_base_address),
+					  IOH_I2CSR);
+			reg_val &= (I2CMAL_BIT | I2CMCF_BIT | I2CMIF_BIT);
+
+			if (reg_val != 0) {
+
+				if (I2CMAL_BIT & reg_val) {
+					adap->ioh_i2c_event_flag |=
+					    I2CMAL_EVENT;
+				}
+
+				if (I2CMCF_BIT & reg_val) {
+					adap->ioh_i2c_event_flag |=
+					    I2CMCF_EVENT;
+				}
+
+				/* clear the applicable bits */
+				adap->clr_reg_bit((adap->ioh_i2c_base_address),
+						  IOH_I2CSR, reg_val);
+
+				IOH_DEBUG("ioh_i2c_cb : IOH_I2CSR = %x\n",
+					  (adap->
+					   readreg(adap->ioh_i2c_base_address,
+						   IOH_I2CSR)));
+
+				i2c_interrupt = true;
+			}
+
+			break;
+		}
+
+	case BUFFER_MODE:
+		{
+			reg_val =
+			    adap->readreg((adap->ioh_i2c_base_address),
+					  IOH_I2CBUFSTA);
+			reg_val &= BUFFER_MODE_MASK;
+			if (reg_val != 0) {
+				/* there is a co-relation between the buffer
+				 * mode interrupt flags' bit */
+				/* positions and the flag positions in event
+				 * flag. for e.g. I2CBMFI is at position */
+				/* 0 in the I2CBUFSTA register. its position
+				 * in the event flag is 2, hence left shifting
+				 */
+				adap->ioh_i2c_event_flag |= ((reg_val) << 2);
+
+				/* clear the applicable bits */
+				adap->clr_reg_bit((adap->ioh_i2c_base_address),
+						  IOH_I2CBUFSTA, reg_val);
+
+				IOH_DEBUG("ioh_i2c_cb : IOH_I2CBUFSTA = %x\n",
+					  (adap->
+					   readreg(adap->ioh_i2c_base_address,
+						   IOH_I2CBUFSTA)));
+
+				i2c_interrupt = true;
+			}
+
+			break;
+
+		}
+
+	case EEPROM_SR_MODE:
+		{
+			reg_val =
+			    adap->readreg((adap->ioh_i2c_base_address),
+					  IOH_I2CESRSTA);
+			reg_val &= (I2CESRFI_BIT | I2CESRTO_BIT);
+			if (reg_val != 0) {
+
+				adap->ioh_i2c_event_flag |= ((reg_val) << 7);
+
+				/* clear the applicable bits */
+				adap->clr_reg_bit((adap->ioh_i2c_base_address),
+						  IOH_I2CESRSTA, reg_val);
+
+				IOH_DEBUG("ioh_i2c_cb : IOH_I2CESRSTA = %x\n",
+					  (adap->
+					   readreg(adap->ioh_i2c_base_address,
+						   IOH_I2CESRSTA)));
+
+				i2c_interrupt = true;
+			}
+
+			break;
+		}
+
+	default:
+		{
+			break;
+		}
+	}			/* end switch */
+
+	if (i2c_interrupt == true)
+		wake_up_interruptible(&ioh_i2c_event);
+
+	return ((i2c_interrupt ==
+		true) ? (IOH_I2C_EVENT_SET) : (IOH_I2C_EVENT_NONE));
+}
+
+/*! @ingroup	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_start(struct i2c_algo_ioh_data * adap)
+  @remarks  	The main tasks performed by this method are:
+		- Generate I2C start condition in normal mode
+		  by setting I2CCTL.I2CMSTA to 1.
+  @param  	adap 	[@ref IN] Contains reference to struct i2c_algo_ioh_data
+  @retval 	None
+  @see		- ioh_i2c_readbytes
+		- ioh_i2c_writebytes
+ <hr>
+ */
+static void ioh_i2c_start(struct i2c_algo_ioh_data *adap)
+{
+	IOH_DEBUG("In ioh_i2c_start : I2CCTL = %x\n",
+		(adap->readreg(adap->ioh_i2c_base_address, IOH_I2CCTL)));
+	adap->set_reg_bit((adap->ioh_i2c_base_address), IOH_I2CCTL, IOH_START);
+	IOH_DEBUG(" Invoke ioh_i2c_start successfully \n");
+	IOH_DEBUG("In ioh_i2c_start : I2CCTL = %x\n",
+		(adap->readreg(adap->ioh_i2c_base_address, IOH_I2CCTL)));
+}
+
+/*! @ingroup	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_buff_mode_start(struct i2c_algo_ioh_data * adap)
+  @remarks  	The main tasks performed by this method are:
+		- Generate I2C start condition in buffer mode
+		  by setting I2CBUFCTL.I2CBMSTA to 1.
+  @param  	adap [@ref IN] Contains reference to struct i2c_algo_ioh_data
+  @retval 	None
+  @see	    	- ioh_i2c_buffer_read
+		- ioh_i2c_buffer_write
+ <hr>
+ */
+static void ioh_i2c_buff_mode_start(struct i2c_algo_ioh_data *adap)
+{
+	IOH_DEBUG("In ioh_i2c_buff_mode_start : I2CBUFCTL = %x\n",
+		(adap->readreg(adap->ioh_i2c_base_address, IOH_I2CBUFCTL)));
+	adap->set_reg_bit((adap->ioh_i2c_base_address), IOH_I2CBUFCTL,
+			IOH_BUFF_START);
+
+	IOH_DEBUG(" Invoke ioh_i2c_buff_mode_start successfully \n");
+	IOH_DEBUG("In ioh_i2c_buff_mode_start : I2CBUFCTL = %x\n",
+		(adap->readreg(adap->ioh_i2c_base_address, IOH_I2CBUFCTL)));
+}
+
+/*! @ingroup	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_eeprom_swrst_start(struct i2c_algo_ioh_data * adap)
+  @remarks  	The main tasks performed by this method are:
+		- Generate I2C start condition in EEPROM sw reset mode
+		  by setting I2CESRCTL.I2CSTA to 1.
+  @param  	adap [@ref IN] Contains reference to struct i2c_algo_ioh_data
+  @retval 	None
+  @see      	ioh_i2c_eeprom_sw_reset
+ <hr>
+ */
+static void ioh_i2c_eeprom_swrst_start(struct i2c_algo_ioh_data *adap)
+{
+	IOH_DEBUG("In ioh_i2c_eeprom_swrst_start : I2CESRCTL = %x\n",
+		(adap->readreg(adap->ioh_i2c_base_address, IOH_I2CESRCTL)));
+	adap->set_reg_bit((adap->ioh_i2c_base_address), IOH_I2CESRCTL,
+			IOH_ESR_START);
+
+	IOH_DEBUG(" Invoked ioh_i2c_eeprom_swrst_start successfully\n");
+	IOH_DEBUG("In ioh_i2c_eeprom_swrst_start : I2CESRCTL = %x\n",
+		(adap->readreg(adap->ioh_i2c_base_address, IOH_I2CESRCTL)));
+
+}
+
+/*! @ingroup	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_stop(struct i2c_algo_ioh_data *adap)
+  @remarks  	Function to generate stop condition in normal mode.
+		The main tasks performed by this method are:
+		- Generate I2C stop condition by setting I2CCTL.I2CMSTA to 0.
+  @param  	adap [@ref IN] Contains reference to struct i2c_algo_ioh_data
+  @retval 	None
+  @see		- ioh_i2c_readbytes
+		- ioh_i2c_writebytes
+ <hr>
+ */
+static void ioh_i2c_stop(struct i2c_algo_ioh_data *adap)
+{
+	IOH_DEBUG("In ioh_i2c_stop : I2CCTL = %x\n",
+		(adap->readreg(adap->ioh_i2c_base_address, IOH_I2CCTL)));
+	/* clear the start bit */
+	adap->clr_reg_bit((adap->ioh_i2c_base_address), IOH_I2CCTL, IOH_START);
+	IOH_DEBUG(" Invoke ioh_i2c_stop successfully \n");
+	IOH_DEBUG("In ioh_i2c_stop : I2CCTL = %x\n",
+		(adap->readreg(adap->ioh_i2c_base_address, IOH_I2CCTL)));
+
+}
+
+/*! @ingroup	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_repstart(struct i2c_algo_ioh_data *adap)
+  @remarks  	Function to generate repeated start condition in normal mode.
+		The main tasks performed by this method are:
+		- Generate repeated start condition by setting using
+		  I2CCTL.I2CRSTA to 1.
+  @param  	adap [@ref IN] Contains reference to struct i2c_algo_ioh_data
+  @retval 	None
+  @see	    	- ioh_i2c_readbytes
+		- ioh_i2c_writebytes
+ <hr>
+ */
+static void ioh_i2c_repstart(struct i2c_algo_ioh_data *adap)
+{
+	IOH_DEBUG("In ioh_i2c_repstart : I2CCTL = %x\n",
+		(adap->readreg(adap->ioh_i2c_base_address, IOH_I2CCTL)));
+	adap->set_reg_bit((adap->ioh_i2c_base_address), IOH_I2CCTL,
+			IOH_REPSTART);
+
+	IOH_DEBUG(" Invoke ioh_i2c_repstart successfully \n");
+	IOH_DEBUG("In ioh_i2c_repstart : I2CCTL = %x\n",
+		(adap->readreg(adap->ioh_i2c_base_address, IOH_I2CCTL)));
+
+}
+
+/*! @ingroup	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_getack(struct i2c_algo_ioh_data *adap)
+  @remarks  	Function to confirm ACK/NACK.
+		The main tasks performed by this method are:
+		- Get the ACK status from I2CSR.
+		- Return success if ACK received or failure otherwise.
+  @param  	adap [@ref IN] Contains reference to struct i2c_algo_ioh_data
+  @retval 	s32
+		- @ref IOH_I2C_SUCCESS Acknowledgement was received.
+		- @ref IOH_I2C_FAIL No acknowledgement received.
+  @see      	- ioh_i2c_readbytes
+		- ioh_i2c_writebytes
+ <hr>
+ */
+static s32 ioh_i2c_getack(struct i2c_algo_ioh_data *adap)
+{
+	u32 reg_val;
+	reg_val =
+		(adap->readreg((adap->ioh_i2c_base_address), IOH_I2CSR) &
+		IOH_GETACK);
+
+	if (reg_val == 0)
+		IOH_DEBUG("ioh_i2c_getack : return%d \n", IOH_I2C_SUCCESS);
+	else
+		IOH_DEBUG("ioh_i2c_getack : return%d \n", IOH_I2C_FAIL);
+
+	return (((reg_val) == 0) ? (IOH_I2C_SUCCESS) : (IOH_I2C_FAIL));
+
+}
+
+/*! @ingroup 	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_sendack(struct i2c_algo_ioh_data *adap)
+  @remarks  	Function to send ACK.
+		The main tasks performed by this method are:
+		- Clear the I2C TXAK bit in I2CCTL register .
+  @param  	adap [@ref IN] Contains reference to struct i2c_algo_ioh_data
+  @retval 	None
+  @see		ioh_i2c_readbytes
+ <hr>
+ */
+static void ioh_i2c_sendack(struct i2c_algo_ioh_data *adap)
+{
+	IOH_DEBUG("In ioh_i2c_sendack : I2CCTL = %x\n",
+		  (adap->readreg(adap->ioh_i2c_base_address, IOH_I2CCTL)));
+	adap->clr_reg_bit((adap->ioh_i2c_base_address), IOH_I2CCTL, IOH_ACK);
+
+	IOH_DEBUG("Invoke ioh_i2c_sendack successfully\n");
+	IOH_DEBUG("In ioh_i2c_sendack : I2CCTL = %x\n",
+		(adap->readreg(adap->ioh_i2c_base_address, IOH_I2CCTL)));
+
+}
+
+/*! @ingroup	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_sendnack(struct i2c_algo_ioh_data *adap)
+  @remarks  	Function to send NACK.
+		The main tasks performed by this method are:
+		- Set the I2C TXAK bit in I2CCTL register .
+  @param  	adap [@ref IN] Contains reference to struct i2c_algo_ioh_data
+  @retval 	None
+  @see      	ioh_i2c_readbytes
+ <hr>
+ */
+static void ioh_i2c_sendnack(struct i2c_algo_ioh_data *adap)
+{
+	IOH_DEBUG("In ioh_i2c_sendnack : I2CCTL = %x\n",
+		  (adap->readreg(adap->ioh_i2c_base_address, IOH_I2CCTL)));
+	adap->set_reg_bit((adap->ioh_i2c_base_address), IOH_I2CCTL, IOH_ACK);
+	IOH_DEBUG("Invoke ioh_i2c_sendnack successfully\n");
+	IOH_DEBUG("In ioh_i2c_sendnack : I2CCTL = %x\n",
+		  (adap->readreg(adap->ioh_i2c_base_address, IOH_I2CCTL)));
+
+}
+
+/*! @ingroup	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_wait_for_bus_idle
+			(struct i2c_algo_ioh_data *adap,s32 timeout)
+  @remarks 	Function to check the status of bus.
+		The main tasks performed by this method are:
+		- Get the status of Bus Busy.
+		- If bus is busy sleep for 1 msec and again check.
+		- Repeat until bus is free or timeout happens.
+  @param  	adap 	[@ref IN] Contains reference to struct i2c_algo_ioh_data
+  @param  	timeout 	[@ref IN] waiting time counter (us)
+  @retval   	s32
+		- @ref IOH_I2C_SUCCESS	The function returns successfully.
+		- @ref IOH_I2C_FAIL	The bus is still idle.
+  @see		- ioh_i2c_readbytes
+		- ioh_i2c_writebytes
+		- ioh_i2c_buffer_read
+		- ioh_i2c_buffer_write
+		- ioh_i2c_eeprom_sw_reset
+ <hr>
+  */
+static s32 ioh_i2c_wait_for_bus_idle(struct i2c_algo_ioh_data *adap,
+				     s32 timeout)
+{
+	u32 reg_value;
+
+	/* get the status of bus busy */
+	reg_value =
+	    (adap->readreg((adap->ioh_i2c_base_address), IOH_I2CSR) &
+	     (I2CMBB_BIT));
+
+	while ((timeout != 0) && (reg_value != 0)) {
+		msleep(1);	/* wait for 100 ms */
+		reg_value =
+		    (adap->readreg((adap->ioh_i2c_base_address),
+				   IOH_I2CSR) & (I2CMBB_BIT));
+		timeout--;
+	}
+
+	IOH_DEBUG("In ioh_i2c_wait_for_bus_idle : I2CSR = %x\n",
+		  adap->readreg((adap->ioh_i2c_base_address), IOH_I2CSR));
+
+	if (timeout == 0) {
+		IOH_LOG(KERN_ERR, "ioh_i2c_wait_for_bus_idle :return%d\n",
+			IOH_I2C_FAIL);
+	} else {
+		IOH_DEBUG("ioh_i2c_wait_for_bus_idle : return %d\n",
+			  IOH_I2C_SUCCESS);
+	}
+
+	return ((timeout <= 0) ? (IOH_I2C_FAIL) : (IOH_I2C_SUCCESS));
+}
+
+/*! @ingroup	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_wait_for_xfer_complete(struct i2c_algo_ioh_data * adap)
+  @remarks	This functions initiates a wait for the transfer complete event
+  @param  	adap 	[@ref IN] Contains reference to struct i2c_algo_ioh_data
+  @retval 	s32
+		- @ref IOH_I2C_SUCCESS	Function returns successfully.
+		- @ref IOH_I2C_FAIL	Any error occurs.
+		- -ERESTARTSYS		wait_event_interruptible_timeout
+					API was interrupted
+  @see		- ioh_i2c_readbytes
+		- ioh_i2c_writebytes
+		- ioh_i2c_buffer_read
+		- ioh_i2c_buffer_write
+		- ioh_i2c_eeprom_sw_reset
+ <hr>
+*/
+static s32 ioh_i2c_wait_for_xfer_complete(struct i2c_algo_ioh_data *adap)
+{
+
+	u32 temp_flag;
+	s32 ret = IOH_I2C_FAIL;
+	ret =
+	    wait_event_interruptible_timeout(ioh_i2c_event,
+					     (adap->ioh_i2c_event_flag != 0),
+					     msecs_to_jiffies(50));
+
+	IOH_DEBUG
+	    ("adap->ioh_i2c_event_flag in ioh_i2c_wait_for_xfer_complete=%x",
+	     adap->ioh_i2c_event_flag);
+	temp_flag = adap->ioh_i2c_event_flag;
+	adap->ioh_i2c_event_flag = 0;
+
+	if (ret == 0) {
+		IOH_LOG(KERN_ERR, "ioh_i2c_wait_for_xfer_complete : Timeout\n");
+	} else if (ret < 0) {
+		IOH_LOG(KERN_ERR,
+			"ioh_i2c_wait_for_xfer_complete  failed : "
+			"Interrupted by other signal\n");
+		ret = -ERESTARTSYS;
+	} else if ((temp_flag & I2C_ERROR_MASK) == 0) {
+		ret = IOH_I2C_SUCCESS;
+	} else {
+		IOH_LOG(KERN_ERR,
+			"ioh_i2c_wait_for_xfer_complete failed : "
+			"Error in transfer\n");
+	}
+
+	IOH_DEBUG(KERN_ERR, "ioh_i2c_wait_for_xfer_complete returns %d\n", ret);
+
+	return ret;
+}
+
+/*! @ingroup 	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_writereg(u32 addr,u32 offset,u32 val)
+  @remarks  	Function for writing data to register.
+		The main tasks performed by this method are:
+		- Compute the target address by adding the offset to
+		  the base address.
+		- Write the specified value to the target address.
+  @param  	addr 	[@ref IN] Base address for the I2C channel
+  @param  	offset 	[@ref IN] offset for the register
+  @param  	val	 	[@ref IN] Value to be written
+  @retval 	None
+  @see  	ioh_i2c_probe
+ <hr>
+ */
+void ioh_i2c_writereg(u32 addr, u32 offset, u32 val)
+{
+	IOH_WRITE_LONG(val, (addr + offset));
+}
+
+/*! @ingroup 	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_readreg(u32 addr,u32 offset)
+  @remarks  	Function for reading data from register.
+		The main tasks performed by this method are:
+		- Compute the target address by adding the offset to
+		  the base address.
+		- Read the register value and return the same.
+  @param  	addr 	[@ref IN] Base address for the I2C channel
+  @param  	offset 	[@ref IN] offset for the register
+  @retval	u32
+		The content of the register that is read.
+  @see		ioh_i2c_probe
+ <hr>
+ */
+u32 ioh_i2c_readreg(u32 addr, u32 offset)
+{
+	u32 ret;
+	ret = IOH_READ_LONG(addr + offset);
+	return ret;
+}
+
+/*! @ingroup 	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_setbit(u32 addr,u32 offset,u32 bitmask)
+  @remarks  	Function to set particular bit in register.
+		The main tasks performed by this method are:
+		- Compute the target address by adding the offset
+		  to the base address.
+		- Read the register value at the target address.
+		- Perform logical OR with bitmask and write back
+		  to the target address.
+  @param  	addr 	[@ref IN] Base address for the I2C channel
+  @param  	offset 	[@ref IN] offset for the register
+  @param  	bitmask [@ref IN] bit position
+  @retval	None
+  @see      	ioh_i2c_probe
+ <hr>
+ */
+void ioh_i2c_setbit(u32 addr, u32 offset, u32 bitmask)
+{
+	IOH_WRITE_LONG(((IOH_READ_LONG(addr + offset)) | (bitmask)),
+			(addr + offset));
+}
+
+/*! @ingroup	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_clrbit(u32 addr,u32 off,u32 bitmask)
+  @remarks   	Function to reset particular bit in register.
+		The main tasks performed by this method are:
+		- Compute the target address by adding the offset
+		  to the base address.
+		- Read the register value at the target address.
+		- Perform logical AND with bitmask and write back
+		  to the target address.
+  @param  	addr 	[@ref IN] Base address for the I2C channel
+  @param  	offset	[@ref IN] offset for the register
+  @param  	bitmask	[@ref IN] bit position
+  @retval	None
+  @see		ioh_i2c_probe
+ <hr>
+ */
+void ioh_i2c_clrbit(u32 addr, u32 offset, u32 bitmask)
+{
+	IOH_WRITE_LONG(((IOH_READ_LONG(addr + offset)) & (~(bitmask))),
+		       (addr + offset));
+}
+
+/*! @ingroup 	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_disbl_int(struct i2c_algo_ioh_data * adap)
+  @remarks 	Function to disable IOH I2C interrupts.
+		The main tasks performed by this method are:
+		- Disable the following interrupts:
+			MAL,MCF,I2CESRFI,I2CESRTO,I2CBMIS,I2CBMTO,I2CBMNA,
+			I2CBMAL and I2CBMFI.
+  @param  	adap  [@ref IN] Contains reference to struct i2c_algo_ioh_data
+  @retval	None
+  @see	    	- ioh_i2c_remove
+		- ioh_i2c_suspend
+ <hr>
+*/
+void ioh_i2c_disbl_int(struct i2c_algo_ioh_data *adap)
+{
+
+	adap->clr_reg_bit((adap->ioh_i2c_base_address), IOH_I2CCTL,
+			  NORMAL_INTR_ENBL);
+
+	IOH_DEBUG("ioh_i2c_disbl_int : I2CCTL = %x\n",
+		  (adap->readreg(adap->ioh_i2c_base_address, IOH_I2CCTL)));
+
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CESRMSK,
+		       EEPROM_RST_INTR_DISBL);
+
+	IOH_DEBUG("ioh_i2c_disbl_int : IOH_I2CESRMSK = %x\n",
+		  (adap->readreg(adap->ioh_i2c_base_address, IOH_I2CESRMSK)));
+
+	adap->writereg((adap->ioh_i2c_base_address), IOH_I2CBUFMSK,
+		       BUFFER_MODE_INTR_DISBL);
+
+	IOH_DEBUG("ioh_i2c_disbl_int : IOH_I2CBUFMSK = %x\n",
+		  (adap->readreg(adap->ioh_i2c_base_address, IOH_I2CBUFMSK)));
+
+}
diff -urN linux-2.6.33.1/drivers/i2c/busses/pch_i2c_hal.h topcliff-2.6.33.1/drivers/i2c/busses/pch_i2c_hal.h
--- linux-2.6.33.1/drivers/i2c/busses/pch_i2c_hal.h	1970-01-01 09:00:00.000000000 +0900
+++ topcliff-2.6.33.1/drivers/i2c/busses/pch_i2c_hal.h	2010-03-23 10:40:18.000000000 +0900
@@ -0,0 +1,337 @@
+#ifndef __IOH_I2C_HAL_H__
+#define __IOH_I2C_HAL_H__
+/*!
+* @file ioh_i2c_hal.h
+* @brief This file provides the function prototypes and macros to the I2C module.
+* @version 0.95
+* @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 02/20/2009
+* modified:
+*	WIPRO 05/21/2009
+*
+*/
+
+/*! @defgroup 	I2C*/
+
+/*! @defgroup	I2C_Global
+@ingroup	I2C
+@brief		This group describes the global entities within
+		the module.
+@remarks	This group includes all the global data structures
+		used within the modules. These are mainly used to
+		store the device related information which is used
+		through out the module.
+<hr>
+*/
+
+/*! @defgroup	I2C_PCILayer
+@ingroup	I2C
+@brief		This group describes the PCI layer interface
+		functionalities.
+@remarks	This group contains the functions and data structures
+		that are used to interface the module with PCI Layer
+		subsystem of the Kernel.
+<hr>
+*/
+
+/*! @defgroup	I2C_InterfaceLayer
+@ingroup	I2C
+@brief		This group describes the Driver interface functionalities.
+@remarks	This group contains the data structures and functions used
+		to interface the module driver with the kernel subsystem.
+<hr>
+*/
+
+/*! @defgroup	I2C_HALLayer
+@ingroup	I2C
+@brief		This group describes the hardware specific functionalities.
+@remarks	This group contains the functions and data structures used
+		by the module to communicate with the hardware. These
+		functions are device specific and designed according to the
+		device specifications.
+<hr>
+*/
+
+/*! @defgroup	I2C_Utilities
+@ingroup	I2C
+@brief		This group describes the utility functionalities.
+@remarks	This group contains the functions and data structures used
+		to assist the other functionalities in their operations.
+<hr>
+*/
+
+/*! @defgroup	I2C_PCILayerAPI
+@ingroup	I2C_PCILayer
+@brief		This group contains the API(functions) used as the PCI
+		interface between the Kernel subsystem and the module.
+<hr>
+*/
+
+/*! @defgroup	I2C_PCILayerFacilitators
+@ingroup	I2C_PCILayer
+@brief		This group contains the data structures used by the PCI
+		Layer APIs for their functionalities.
+<hr>
+*/
+
+/*! @defgroup	I2C_InterfaceLayerAPI
+@ingroup	I2C_InterfaceLayer
+@brief		This group contains the API(functions) used as the Driver
+		interface between the Kernel subsystem and the module.
+<hr>
+*/
+
+/*! @defgroup	I2C_InterfaceLayerFacilitators
+@ingroup	I2C_InterfaceLayer
+@brief		This group contains the data structures used by the Driver
+		interface APIs for their functionalities.
+<hr>
+*/
+
+/*! @defgroup	I2C_HALLayerAPI
+@ingroup	I2C_HALLayer
+@brief		This group contains the APIs(functions) used to interact with
+		the hardware. These APIs act as an interface between the
+		hardware and the other driver functions.
+<hr>
+*/
+
+/*! @defgroup	I2C_UtilitiesAPI
+@ingroup	I2C_Utilities
+@brief		This group contains the APIs(functions) used by other functions.
+<hr>
+*/
+
+/*includes*/
+#include <linux/irqreturn.h>
+
+/*! @ingroup I2C_Global
+@def 	IOH_I2C_SUCCESS
+@brief 	Success status code
+*/
+#define IOH_I2C_SUCCESS		(0)
+
+/*! @ingroup I2C_Global
+@def 	IOH_I2C_FAIL
+@brief 	Error status code
+*/
+#define IOH_I2C_FAIL		(-1)
+
+/*! @ingroup I2C_Global
+@def 	IOH_I2C_MAX_CHN
+@brief 	Maximum I2C channels available
+*/
+#define IOH_I2C_MAX_CHN 	(1)
+
+/*! @ingroup I2C_Global
+@def 	IOH_I2C_EVENT_SET
+@brief 	I2C Interrupt Event Set Status
+*/
+#define IOH_I2C_EVENT_SET 	(0)
+
+/*! @ingroup I2C_Global
+@def 	IOH_I2C_EVENT_NONE
+@brief 	I2C Interrupt Event Clear Status
+*/
+#define IOH_I2C_EVENT_NONE (1)
+
+/*! @ingroup I2C_Global
+@def 	IOH_I2C_MAX_CLK
+@brief 	Maximum peripheral Clock speed supported in MHz
+*/
+#define IOH_I2C_MAX_CLK	(100000)
+
+
+/* flag for Buffer mode enable */
+#define IOH_BUFFER_MODE_ENABLE		(0x0002)
+
+/* flag for EEPROM SW RST enable */
+#define IOH_EEPROM_SW_RST_MODE_ENABLE	(0x0008)
+
+/* for mode selection */
+#define I2C_MODE_SEL 	(0x711)
+
+/*structures*/
+/*! @ingroup	I2C_HALLayer
+@struct 	i2c_algo_ioh_data
+@brief 		This structure contains references to methods implementing
+		I2C driver functionalities.
+@note 		The concerned details should be provided during
+		the data transfer.
+@see  		- ioh_i2c_init
+		- ioh_i2c_entcb
+		- ioh_i2c_cb
+		- ioh_i2c_disbl_int
+*/
+
+struct i2c_algo_ioh_data {
+
+	struct adapter_info *p_adapter_info;
+	/**< stores the reference to adapter_info structure*/
+
+	struct i2c_adapter ioh_i2c_adapter;
+	/**< stores the reference to i2c_adapter structure*/
+
+	u32 ioh_i2c_base_address; /**< specifies the remapped base address*/
+	int ioh_i2c_buff_mode_en; /**< specifies if buffer mode is enabled*/
+	u32 ioh_i2c_event_flag; /**< specifies occurrence of interrupt events*/
+
+	bool ioh_i2c_xfer_in_progress;
+	/**< specifies whether the transfer is completed */
+
+	void (*writereg) (u32 addr, u32 off, u32 val);
+	/**< stores the reference to register write function*/
+
+	u32(*readreg) (u32 addr, u32 off);
+	/**< stores the reference to register read function*/
+
+	void (*set_reg_bit) (u32 addr, u32 off, u32 bitmsk);
+	/**< stores the reference to register bit setting function*/
+
+	void (*clr_reg_bit) (u32 addr, u32 off, u32 bitmsk);
+	/**< stores the reference to register bit clearing function*/
+};
+
+/*! @ingroup	I2C_HALLayer
+@struct 	adapter_info
+@brief 		This structure holds the adapter information
+		for the IOH i2c controller.
+@note 		This structure contains instances of struct i2c_algo_ioh_data
+		for the available I2C channels and also a variable for saving
+		the suspend status.
+@see  		- ioh_i2c_probe
+		- ioh_i2c_remove
+		- ioh_i2c_suspend
+		- ioh_i2c_resume
+*/
+
+struct adapter_info {
+
+	struct i2c_algo_ioh_data ioh_i2c_data[IOH_I2C_MAX_CHN];
+	/**< stores a list of i2c_algo_ioh_data;
+	 there will be as many elements as maximum I2C channels*/
+
+	bool ioh_i2c_suspended;
+	/**< specifies whether the system is suspended or not*/
+};
+
+/**global variables*/
+extern int ioh_i2c_speed;
+extern int ioh_i2c_clk;
+extern s32(*ioh_i2c_cbr) (struct i2c_algo_ioh_data *);
+
+extern struct i2c_algorithm ioh_i2c_algorithm;
+
+/* Function prototypes */
+/*! @ingroup I2C_HALLayerAPI
+@fn 		s32 ioh_i2c_init(struct i2c_algo_ioh_data *adap)
+@brief  	Function to initialize IOH I2C hardware
+*/
+s32 ioh_i2c_init(struct i2c_algo_ioh_data *adap);
+
+/*! @ingroup I2C_HALLayerAPI
+@fn 		s32 ioh_i2c_writebytes(struct i2c_adapter *i2c_adap ,
+		struct i2c_msg *msgs,u32 last, u32 first)
+@brief  	Function for data write in normal mode
+*/
+s32 ioh_i2c_writebytes(struct i2c_adapter *i2c_adap,
+		       struct i2c_msg *msgs, u32 last, u32 first);
+
+/*! @ingroup I2C_HALLayerAPI
+@fn 		s32 ioh_i2c_readbytes(struct i2c_adapter *i2c_adap ,
+		struct i2c_msg *msgs,u32 last, u32 first)
+@brief  	Function for data read in normal mode
+*/
+s32 ioh_i2c_readbytes(struct i2c_adapter *i2c_adap,
+		      struct i2c_msg *msgs, u32 last, u32 first);
+
+/*! @ingroup I2C_HALLayerAPI
+@fn 		s32 ioh_i2c_eeprom_sw_reset(struct i2c_adapter * i2c_adap,
+		struct i2c_msg *msgs)
+@brief  	Function for triggering EEPROM software reset mode
+*/
+s32 ioh_i2c_eeprom_sw_reset(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs);
+
+/*! @ingroup I2C_HALLayerAPI
+@fn 		s32 ioh_i2c_buffer_write
+		(struct i2c_adapter * i2c_adap,struct i2c_msg *msgs)
+@brief  	Function for data write in buffer mode
+*/
+s32 ioh_i2c_buffer_write(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs);
+
+/*! @ingroup I2C_HALLayerAPI
+@fn 		s32 ioh_i2c_buffer_read
+		(struct i2c_adapter * i2c_adap,struct i2c_msg *msgs)
+@brief  	Function for data read in buffer mode
+*/
+s32 ioh_i2c_buffer_read(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs);
+
+/*! @ingroup I2C_HALLayerAPI
+@fn 		irqreturn_t ioh_i2c_handler(int irq,void *pData)
+@brief  	Interrupt handler
+*/
+irqreturn_t ioh_i2c_handler(int irq, void *pData);
+
+/*! @ingroup I2C_HALLayerAPI
+@fn 		void ioh_i2c_entcb
+		(s32(*ioh_i2c_ptr)(struct i2c_algo_ioh_data *adap))
+@brief  	Function for registering the interrupt handler call back
+*/
+void ioh_i2c_entcb(s32(*ioh_i2c_ptr) (struct i2c_algo_ioh_data *adap));
+
+/*! @ingroup I2C_UtilitiesAPI
+@fn 		s32 ioh_i2c_cb(struct i2c_algo_ioh_data * adap)
+@brief  	Call back function invoked from interrupt handler
+*/
+s32 ioh_i2c_cb(struct i2c_algo_ioh_data *adap);
+
+/*! @ingroup I2C_UtilitiesAPI
+@fn 		void ioh_i2c_disbl_int(struct i2c_algo_ioh_data *adap)
+@brief  	Function for disabling the interrupt
+*/
+void ioh_i2c_disbl_int(struct i2c_algo_ioh_data *adap);
+
+/*! @ingroup I2C_UtilitiesAPI
+@fn 		void ioh_i2c_writereg(u32 addr,u32 off,u32 val)
+@brief  	Function for writing data to register
+*/
+void ioh_i2c_writereg(u32 addr, u32 off, u32 val);
+
+/*! @ingroup I2C_UtilitiesAPI
+@fn 		u32 ioh_i2c_readreg(u32 addr,u32 off)
+@brief  	Function for reading data from register
+*/
+u32 ioh_i2c_readreg(u32 addr, u32 off);
+
+/*! @ingroup I2C_UtilitiesAPI
+@fn 		void ioh_i2c_setbit(u32 addr,u32 off,u32 bitmsk)
+@brief  	Function to set a particular bit in a register
+*/
+void ioh_i2c_setbit(u32 addr, u32 off, u32 bitmsk);
+
+/*! @ingroup I2C_UtilitiesAPI
+@fn 		void ioh_i2c_clrbit(u32 addr,u32 off,u32 bitmsk)
+@brief  	Function to clear a particular bit in a register
+*/
+void ioh_i2c_clrbit(u32 addr, u32 off, u32 bitmsk);
+#endif
diff -urN linux-2.6.33.1/drivers/i2c/busses/pch_i2c_main.c topcliff-2.6.33.1/drivers/i2c/busses/pch_i2c_main.c
--- linux-2.6.33.1/drivers/i2c/busses/pch_i2c_main.c	1970-01-01 09:00:00.000000000 +0900
+++ topcliff-2.6.33.1/drivers/i2c/busses/pch_i2c_main.c	2010-03-23 10:40:18.000000000 +0900
@@ -0,0 +1,247 @@
+/*!
+ * @file	ioh_i2c_main.c
+ * @brief 	This file contains the definitions
+ * 		of Interface Layer APIs for IOH I2C driver.
+ * @version 0.95
+ * @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 02/20/2009
+ * modified:
+ *	WIPRO 05/21/2009
+ *
+ */
+
+/*includes*/
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/i2c.h>
+#include <linux/pci.h>
+#include <linux/types.h>
+#include <linux/stat.h>
+#include <linux/interrupt.h>
+
+#include "pch_i2c_hal.h"
+#include "pch_common.h"
+#include "pch_debug.h"
+
+/* Function prototypes */
+
+/*! @ingroup	I2C_UtilitiesAPI
+  @fn 		ioh_i2c_func(struct i2c_adapter *adap)
+  @brief  	This function returns the functionalities supported
+		by I2C driver.
+  */
+static u32 ioh_i2c_func(struct i2c_adapter *adap);
+
+/*! @ingroup	I2C_UtilitiesAPI
+  @fn 		ioh_i2c_xfer(struct i2c_adapter *i2c_adap,
+				struct i2c_msg *msgs,s32 num)
+  @brief  	This function handles data transfer through I2C bus
+  */
+static s32 ioh_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
+			s32 num);
+
+/*structures*/
+
+/*! @ingroup	I2C_Global
+  @struct 	ioh_i2c_algorithm
+  @brief 	This an instance of the kernel structure i2c_algorithm structure
+		and it stores the properties of the IOH I2C algorithm driver.
+  @note 	This structure stores the references of the @ref ioh_i2c_xfer
+		and @ref ioh_i2c_func functions.
+  @see 		ioh_i2c_probe
+  */
+
+struct i2c_algorithm ioh_i2c_algorithm = {
+	.master_xfer = ioh_i2c_xfer,
+	.functionality = ioh_i2c_func
+};
+
+/*! @ingroup 	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_func(struct i2c_adapter *adap)
+  @brief 	Function return the functionality of the I2C driver
+  @remarks 	Returns (I2C_FUNC_I2C) | (I2C_FUNC_SMBUS_EMUL) |
+			(I2C_FUNC_10BIT_ADDR)
+  @param  	adap 	[@ref IN] Contains reference to i2c_adapter structure
+  @retval 	u32
+		- Bitwise OR of the feature status codes supported
+		  by this algorithm driver.
+  @see       	ioh_i2c_algorithm
+  */
+static u32 ioh_i2c_func(struct i2c_adapter *adap)
+{
+	u32 ret;
+	ret = I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_10BIT_ADDR;
+	return ret;
+}
+
+/*! @ingroup	I2C_UtilitiesAPI
+  @fn  		ioh_i2c_xfer(struct i2c_adapter *i2c_adap,
+		struct i2c_msg *msgs,s32 num)
+  @brief  	Function to transfer data through I2C bus
+  @remarks  	Function to transfer data through I2C bus
+		The main tasks performed by this method are:
+		- Check if system is suspended.
+		- If EEPROM software reset command is received,
+		  then invoke function ioh_i2c_eeprom_sw_reset.
+		- If Buffer mode selection command is received,
+		  check the value of msgs[0]->buf[0]. If set,
+		  enable buffer mode, by setting the variable
+		  adap->ioh_i2c_buff_mode_en. Otherwise reset the flag.
+		- If no special command, perform the requested
+		  data transfer operation.
+  @note     	The master transfer function ioh_i2c_xfer
+		is invoked by the Linux I2C core, whenever
+		communication/data transfer with the IOH I2C
+		driver is necessary. The Linux I2C core
+		ensures that the function is called with
+		valid parameters only.
+  @param  	i2c_adap [@ref IN] contains reference to the struct i2c_adapter
+  @param 	msgs	 [@ref IN] contains reference to i2c_msg structure
+  @param 	num	 [@ref IN] number of messages
+  @retval 	s32
+		- @ref IOH_I2C_SUCCESS
+			Function returns successfully for EEPROM sw reset mode,
+			buffer mode selection commands.
+		- The number of bytes transferred for successful operation
+		  of read/write calls.
+		- @ref IOH_I2C_FAIL
+			Any error occurs during the execution of the function.
+  @see		ioh_i2c_algorithm
+  <hr>
+  */
+
+static s32 ioh_i2c_xfer(struct i2c_adapter *i2c_adap,
+			struct i2c_msg *msgs, s32 num)
+{
+
+	struct i2c_msg *pmsg;
+	u32 i = 0;
+	u32 status;
+	u32 msglen;
+	u32 subaddrlen;
+	s32 ret = IOH_I2C_FAIL;
+
+	struct i2c_algo_ioh_data *adap = i2c_adap->algo_data;
+
+	if (adap->p_adapter_info->ioh_i2c_suspended == false) {
+		IOH_DEBUG("ioh_i2c_xfer "
+			"adap->p_adapter_info->ioh_i2c_suspended is %d\n",
+			adap->p_adapter_info->ioh_i2c_suspended);
+		/* transfer not completed */
+		adap->ioh_i2c_xfer_in_progress = true;
+		IOH_DEBUG("	adap->ioh_i2c_xfer_in_progress is %d\n",
+				adap->ioh_i2c_xfer_in_progress);
+		pmsg = &msgs[0];
+		status = pmsg->flags;
+		/* special commands for IOH I2C driver */
+		if ((status &
+		    (IOH_EEPROM_SW_RST_MODE_ENABLE | IOH_BUFFER_MODE_ENABLE))
+		     != false) {
+			if ((status & IOH_EEPROM_SW_RST_MODE_ENABLE) != false) {
+				/* check whether EEPROM sw reset is enabled */
+				IOH_DEBUG("ioh_i2c_xfer invoking "
+					  "ioh_i2c_eeprom_sw_reset\n");
+				IOH_DEBUG("After invoking "
+					  "I2C_MODE_SEL :flag= 0x%x\n", status);
+				ret = ioh_i2c_eeprom_sw_reset(i2c_adap, pmsg);
+			} else {
+				adap->ioh_i2c_buff_mode_en =
+				    (pmsg->buf[0] == 1) ?
+				    (IOH_BUFFER_MODE_ENABLE) : (pmsg->buf[0]);
+				ret = IOH_I2C_SUCCESS;
+			}
+			/* transfer completed */
+			adap->ioh_i2c_xfer_in_progress = false;
+			IOH_DEBUG("adap->ioh_i2c_xfer_in_progress is %d\n",
+				  adap->ioh_i2c_xfer_in_progress);
+			IOH_DEBUG(KERN_INFO,
+				  "After mode selection "
+				  "ioh_i2c_xfer return = %d\n", ret);
+			return ret;
+		}
+		for (i = 0; i < num; i++) {
+			pmsg = &msgs[i];
+			pmsg->flags |= adap->ioh_i2c_buff_mode_en;
+			status = pmsg->flags;
+			IOH_DEBUG("After invoking I2C_MODE_SEL :flag= 0x%x\n",
+				  status);
+			/* calculate sub address length and message length */
+			/* these are applicable only for buffer mode */
+			subaddrlen = pmsg->buf[0];
+			/* calculate actual message length excluding
+			 * the sub address fields */
+			msglen = (pmsg->len) - (subaddrlen + 1);
+
+			if (((status & IOH_BUFFER_MODE_ENABLE) != false)
+			    && (msglen != 0)) {
+				/* Buffer mode cannot be used for transferring
+				 * 0 byte data. Hence when buffer mode is
+				 * enabled and 0 byte transfer is requested,
+				 * normal mode transfer will be used */
+				if ((status & (I2C_M_RD)) != false) {
+					IOH_DEBUG(KERN_INFO,
+						  "ioh_i2c_xfer invoking "
+						  "ioh_i2c_buffer_read\n");
+					ret =
+					    ioh_i2c_buffer_read(i2c_adap, pmsg);
+				} else {
+					IOH_DEBUG(KERN_INFO,
+						  "ioh_i2c_xfer invoking "
+						  "ioh_i2c_buffer_write\n");
+					ret =
+					   ioh_i2c_buffer_write(i2c_adap, pmsg);
+				}
+			} else {
+				if ((status & (I2C_M_RD)) != false) {
+					IOH_DEBUG(KERN_INFO,
+						  "ioh_i2c_xfer invoking "
+						  "ioh_i2c_readbytes\n");
+					ret =
+					    ioh_i2c_readbytes(i2c_adap, pmsg,
+							      (i + 1 == num),
+							      (i == 0));
+				} else {
+					IOH_DEBUG(KERN_INFO,
+						  "ioh_i2c_xfer invoking "
+						  "ioh_i2c_writebytes\n");
+					ret =
+					    ioh_i2c_writebytes(i2c_adap, pmsg,
+							       (i + 1 == num),
+							       (i == 0));
+				}
+			}
+
+		}
+
+		adap->ioh_i2c_xfer_in_progress = false;	/* transfer completed */
+
+		IOH_DEBUG("	adap->ioh_i2c_xfer_in_progress is %d\n",
+			  adap->ioh_i2c_xfer_in_progress);
+	}
+	IOH_DEBUG(KERN_INFO, "ioh_i2c_xfer return:%d\n\n\n\n", ret);
+
+	return ret;
+}
diff -urN linux-2.6.33.1/drivers/i2c/busses/pch_i2c_pci.c topcliff-2.6.33.1/drivers/i2c/busses/pch_i2c_pci.c
--- linux-2.6.33.1/drivers/i2c/busses/pch_i2c_pci.c	1970-01-01 09:00:00.000000000 +0900
+++ topcliff-2.6.33.1/drivers/i2c/busses/pch_i2c_pci.c	2010-03-23 10:40:18.000000000 +0900
@@ -0,0 +1,583 @@
+/*!
+* @file		ioh_i2c_pci.c
+* @brief 	This file contains the definitions of I2C_PCILayer APIs.
+* @version 0.95
+* @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 02/20/2009
+* modified:
+*	WIPRO 05/21/2009
+*
+*/
+
+/*includes*/
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/i2c.h>
+#include <linux/pci.h>
+#include <linux/types.h>
+#include <linux/stat.h>
+#include <linux/interrupt.h>
+
+#include "pch_i2c_hal.h"
+#include "pch_common.h"
+#include "pch_debug.h"
+
+/**
+ *macro definition
+ */
+
+/*! @ingroup 	I2C_PCILayer
+@def 		PCI_DEVICE_ID_IOH_I2C
+@brief 		Device ID of the device supported by IOH I2C
+		driver in GE configuration.
+*/
+#define PCI_DEVICE_ID_IOH_I2C	(0x8817)
+
+/*
+ * variable declaration
+ */
+/*! @ingroup 	I2C_Global
+@var		ioh_i2c_speed
+@brief		specifies I2C bus speed in Kbps
+@note		This parameter is provided as module parameter
+		while loading the driver. If no value is provided,
+		by default the speed is set to 100 kbps.
+@see		ioh_i2c_init
+<hr>
+*/
+int ioh_i2c_speed = 100;
+
+/*! @ingroup 	I2C_Global
+@var		ioh_i2c_clock
+@brief		specifies I2C clock speed in KHz
+@note		This parameter is provided as module parameter
+		while inserting the driver. If no value is provided,
+		by default the speed is set to 62500KHz.
+@see		ioh_i2c_init
+<hr>
+*/
+/* int ioh_i2c_clk = 62500; */
+int ioh_i2c_clk = 50000;
+
+/*! @ingroup 	I2C_Global
+@var 		ioh_i2c_cbr
+@brief  	I2C_Global function pointer to save reference to
+		callback function
+@see		ioh_i2c_entcb
+<hr>
+*/
+s32(*ioh_i2c_cbr) (struct i2c_algo_ioh_data *);
+
+/*! @ingroup 	I2C_Global
+@var		MODULE_NAME
+@brief		I2C_Global variable storing the name of this driver
+@see 		ioh_i2c_probe
+<hr>
+*/
+#define MODULE_NAME "pch_i2c"	/* name for the driver */
+
+/* Function prototypes */
+/*! @ingroup 	I2C_PCILayerAPI
+@fn 		ioh_i2c_probe(struct pci_dev *pdev,
+				const struct pci_device_id *id)
+@brief  	This function implements the probe routine
+		for IOH I2C driver module
+*/
+static int __devinit ioh_i2c_probe(struct pci_dev *pdev,
+				   const struct pci_device_id *id);
+
+/*! @ingroup 	I2C_PCILayerAPI
+@fn 		ioh_i2c_remove(struct pci_dev *pdev)
+@brief  	This function implements the remove routine
+		for IOH I2C driver module.
+*/
+static void __devexit ioh_i2c_remove(struct pci_dev *pdev);
+
+/*! @ingroup 	I2C_PCILayerAPI
+@fn 		ioh_i2c_suspend(struct pci_dev* pdev,pm_message_t state)
+@brief      	This function implements the suspend routine
+		for IOH I2C driver module
+*/
+static int ioh_i2c_suspend(struct pci_dev *pdev, pm_message_t state);
+
+/*! @ingroup 	I2C_PCILayerAPI
+@fn 		ioh_i2c_resume(struct pci_dev* pdev)
+@brief  	This function implements the resume routine
+		for IOH I2C driver module
+*/
+static int ioh_i2c_resume(struct pci_dev *pdev);
+
+/*structures*/
+/*! @ingroup	I2C_PCILayerFacilitators
+@struct 	ioh_i2c_pcidev_id
+@brief 		Store information of supported PCI devices
+@note 		This is an instance of pci_device_id structure and
+		holds information of the PCI devices that are supported
+		by this driver
+@see		ioh_i2c_pcidriver
+*/
+
+static struct pci_device_id __devinitdata ioh_i2c_pcidev_id[] = {
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_IOH_I2C)},
+	{0,}
+};
+
+/*! @ingroup	I2C_PCILayerFacilitators
+@struct 	ioh_i2c_pcidriver
+@brief 		Store the references of PCI driver interfaces to kernel
+@note 		This is an instance of pci_driver and this structure specifies
+		the driver details to be registered with the kernel
+@see		- ioh_i2c_pci_init
+		- ioh_i2c_pci_exit
+<hr>
+*/
+
+static struct pci_driver ioh_i2c_pcidriver = {
+	.name = "ioh_i2c",
+	.id_table = ioh_i2c_pcidev_id,
+	.probe = ioh_i2c_probe,
+	.remove = __devexit_p(ioh_i2c_remove),
+#ifdef CONFIG_PM
+	.suspend = ioh_i2c_suspend,
+	.resume = ioh_i2c_resume
+#endif
+};
+
+/*! @ingroup 	I2C_PCILayerAPI
+  @fn  		ioh_i2c_probe(struct pci_dev *pdev, const struct
+				pci_device_id *id)
+  @remarks  	The main tasks performed by this method are:
+		- Allocate memory for driver private data.
+		- Enable the PCI device.
+		- Reserve the PCI regions.
+		- Map the device address of the IO BAR.
+		- Register the interrupt handler.
+		- Initialize the members in adap_info->ioh_i2c_data.
+		- Register the ioh_i2c_adapter.
+		- Initialize the IOH I2C hardware.
+  @note		This function is invoked by the PCI core when a device is
+		found for this driver to control
+  @param  	pdev 	[@ref IN] contains reference to
+			PCI device descriptor for the peripheral
+  @param 	id	[@ref IN] contains reference to
+			the pci_device_id table of matching peripheral
+  @retval 	int
+		- @ref IOH_I2C_SUCCESS	Function returns successfully.
+		- -EIO 	  pci_enable_device fails
+		- -EINVAL pci_enable_device/request_irq fails
+		- -EBUSY  pci_request_regions/request_irq fails
+		- -ENOMEM i2c_add_adapter/request_irq/pci_iomap/kzalloc fails
+		- -EAGAIN i2c_add_adapter fails
+		- -ENOSYS request_irq fails
+ @see		ioh_i2c_pcidriver
+ <hr>
+ */
+static int __devinit ioh_i2c_probe(struct pci_dev *pdev,
+				const struct pci_device_id *id)
+{
+
+	int i;
+	u32 base_addr;
+	s32 ret = IOH_I2C_SUCCESS;
+
+	IOH_DEBUG("Enterred in i2c_probe\n");
+
+	do {
+		struct adapter_info *adap_info =
+		    kzalloc((sizeof(struct adapter_info)), GFP_KERNEL);
+		if (adap_info == NULL) {
+			IOH_LOG(KERN_ERR, "Memory allocation failed FAILED");
+			ret = -ENOMEM;
+			break;
+		}
+
+		IOH_DEBUG
+		    ("Function kzalloc invoked successfully "
+		    "and adap_info valu = %p\n",
+		     adap_info);
+
+		ret = pci_enable_device(pdev);
+
+		if (ret) {
+			IOH_LOG(KERN_ERR, "pci_enable_device FAILED");
+			kfree(adap_info);
+			break;
+		}
+
+		IOH_DEBUG("pci_enable_device returns %d\n", ret);
+
+		ret = pci_request_regions(pdev, MODULE_NAME);
+		if (ret) {
+			IOH_LOG(KERN_ERR, "pci_request_regions FAILED");
+			pci_disable_device(pdev);
+			kfree(adap_info);
+			break;
+		}
+
+		IOH_DEBUG("pci_request_regions returns %d\n", ret);
+
+		/* Wipro 1/13/2010 Use Mem BAR */
+		base_addr = (unsigned long)pci_iomap(pdev, 1, 0);
+
+		if (base_addr == 0) {
+			IOH_LOG(KERN_ERR, "pci_iomap FAILED");
+			pci_release_regions(pdev);
+			pci_disable_device(pdev);
+			kfree(adap_info);
+			ret = -ENOMEM;
+			break;
+		}
+
+		IOH_DEBUG("pci_iomap invoked successfully\n");
+
+		ioh_i2c_entcb(ioh_i2c_cb);
+		IOH_DEBUG("ioh_i2c_entcb invoked successfully\n");
+
+		for (i = 0; i < IOH_I2C_MAX_CHN; i++) {
+			adap_info->ioh_i2c_data[i].p_adapter_info = adap_info;
+			adap_info->ioh_i2c_data[i].writereg = ioh_i2c_writereg;
+			adap_info->ioh_i2c_data[i].readreg = ioh_i2c_readreg;
+			adap_info->ioh_i2c_data[i].set_reg_bit = ioh_i2c_setbit;
+			adap_info->ioh_i2c_data[i].clr_reg_bit = ioh_i2c_clrbit;
+
+			adap_info->ioh_i2c_data[i].ioh_i2c_adapter.owner =
+			    THIS_MODULE;
+			adap_info->ioh_i2c_data[i].ioh_i2c_adapter.class =
+			    I2C_CLASS_HWMON;
+			strcpy(adap_info->ioh_i2c_data[i].ioh_i2c_adapter.name,
+			       "ioh_i2c");
+			adap_info->ioh_i2c_data[i].ioh_i2c_adapter.algo =
+			    &ioh_i2c_algorithm;
+			adap_info->ioh_i2c_data[i].ioh_i2c_adapter.algo_data =
+			    &adap_info->ioh_i2c_data[i];
+
+			/* (i * 0x80) + base_addr; */
+			adap_info->ioh_i2c_data[i].ioh_i2c_base_address =
+			    base_addr;
+
+			adap_info->ioh_i2c_data[i].ioh_i2c_adapter.dev.parent =
+			    &pdev->dev;
+
+			ret =
+			    i2c_add_adapter(&
+					    (adap_info->ioh_i2c_data[i].
+					     ioh_i2c_adapter));
+
+			if (ret) {
+				IOH_LOG(KERN_ERR, "i2c_add_adapter FAILED");
+
+				pci_iounmap(pdev, (void *)base_addr);
+				pci_release_regions(pdev);
+				pci_disable_device(pdev);
+				kfree(adap_info);
+				break;
+			}
+
+			IOH_DEBUG("i2c_add_adapter returns %d for channel-%d\n",
+				  ret, i);
+			(void)ioh_i2c_init(&adap_info->ioh_i2c_data[i]);
+			IOH_DEBUG("ioh_i2c_init invoked successfully \n");
+
+		}
+
+		if (ret)
+			break;
+
+		ret = request_irq(pdev->irq, &ioh_i2c_handler, IRQF_SHARED,
+				  MODULE_NAME, (void *)adap_info);
+
+		if (ret) {
+			IOH_DEBUG("request_irq Failed\n");
+
+			for (i = 0; i < IOH_I2C_MAX_CHN; i++) {
+				i2c_del_adapter(&
+						(adap_info->
+						 ioh_i2c_data
+						 [i].ioh_i2c_adapter));
+			}
+
+			pci_iounmap(pdev, (void *)base_addr);
+
+			pci_release_regions(pdev);
+			pci_disable_device(pdev);
+			kfree(adap_info);
+			break;
+		}
+
+		IOH_DEBUG("request_irq returns %d\n", ret);
+
+		IOH_DEBUG("ioh_i2c_probe returns %d\n", IOH_I2C_SUCCESS);
+		pci_set_drvdata(pdev, (void *)adap_info);
+		return IOH_I2C_SUCCESS;
+	} while (0);
+
+	return ret;
+}
+
+/*! @ingroup	I2C_PCILayerAPI
+  @fn  		ioh_i2c_remove(struct pci_dev *pdev)
+  @remarks  	The main tasks performed by this method are:
+		- Disable interrupts.
+		- Unregister interrupt handler.
+		- Unregister i2c_adapter.
+		- Release IO memory.
+		- Release PCI regions.
+		- Disable PCI device.
+  @note		This function is invoked when the IOH I2C driver module is
+		unloaded from the system using rmmod command or when the
+		IOH I2C device is removed from the system.
+  @param  	pdev 	[@ref INOUT] contains reference to
+			PCI device descriptor for the peripheral
+  @retval 	None
+  @see		ioh_i2c_pcidriver
+  <hr>
+  */
+
+static void __devexit ioh_i2c_remove(struct pci_dev *pdev)
+{
+	int i;
+
+	struct adapter_info *adap_info = pci_get_drvdata(pdev);
+
+	IOH_DEBUG(" invoked function pci_get_drvdata successfully\n");
+
+	for (i = 0; i < IOH_I2C_MAX_CHN; i++) {
+		ioh_i2c_disbl_int(&adap_info->ioh_i2c_data[i]);
+
+		if (i == (IOH_I2C_MAX_CHN - 1)) {
+			free_irq(pdev->irq, (void *)adap_info);
+			IOH_DEBUG("  free_irq invoked successfully\n");
+		}
+
+		i2c_del_adapter(&(adap_info->ioh_i2c_data[i].ioh_i2c_adapter));
+
+		IOH_DEBUG(" invoked i2c_del_adapter successfully\n");
+
+	}
+
+	if (adap_info->ioh_i2c_data[0].ioh_i2c_base_address) {
+		pci_iounmap(pdev,
+			    (void *)adap_info->ioh_i2c_data[0].
+			    ioh_i2c_base_address);
+		IOH_DEBUG(" pci_iounmap invoked successfully\n");
+		adap_info->ioh_i2c_data[0].ioh_i2c_base_address = 0;
+	}
+
+	pci_set_drvdata(pdev, NULL);
+
+	pci_release_regions(pdev);
+	IOH_DEBUG("  pci_release_regions invoked successfully\n");
+
+	pci_disable_device(pdev);
+	kfree(adap_info);
+	IOH_DEBUG("  pci_disable_device invoked successfully\n");
+	IOH_DEBUG("  ioh_i2c_remove invoked successfully\n");
+}
+
+#ifdef CONFIG_PM
+
+/*! @ingroup	I2C_PCILayerAPI
+  @fn  		ioh_i2c_suspend(struct pci_dev* pdev,pm_message_t state)
+  @remarks  	The main tasks performed by this method are:
+		- Wait for any transfer in progress to complete.
+		- Disable interrupts.
+		- Save PCI device state.
+		- Disable PM notifications.
+		- Disable the PCI device.
+		- Move the device to D3Hot power state.
+  @note		This function is invoked by the kernel when the system is
+		transitioning to low power state.
+  @param  	pdev 	[@ref INOUT]
+		contains reference to PCI device descriptor for the peripheral
+  @param 	state	[@ref IN]
+		Represents the low power state the system is transitioning to.
+  @retval 	int
+		- @ref IOH_I2C_SUCCESS	Function returns successfully.
+		- -ENOMEM	pci_save_state fails.
+  @see		ioh_i2c_pcidriver
+ */
+static int ioh_i2c_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+
+	int i;
+	int ret;
+
+	struct adapter_info *adap_info = pci_get_drvdata(pdev);
+
+	IOH_DEBUG(" invoked function pci_get_drvdata successfully\n");
+
+	adap_info->ioh_i2c_suspended = true;
+
+	for (i = 0; i < IOH_I2C_MAX_CHN; i++) {
+		while ((adap_info->ioh_i2c_data[i].ioh_i2c_xfer_in_progress ==
+			true)) {
+			/* It is assumed that any pending transfer will
+			 * be completed after the delay
+			 */
+			msleep(1);
+		}
+		/* Disable the i2c interrupts */
+		ioh_i2c_disbl_int(&adap_info->ioh_i2c_data[i]);
+	}
+
+	IOH_DEBUG("I2CSR = %x\n",
+		  ioh_i2c_readreg(adap_info->
+				  ioh_i2c_data[0].ioh_i2c_base_address, 0x08));
+	IOH_DEBUG("I2CBUFSTA = %x\n",
+		  ioh_i2c_readreg(adap_info->
+				  ioh_i2c_data[0].ioh_i2c_base_address, 0x30));
+	IOH_DEBUG("I2CESRSTA = %x\n",
+		  ioh_i2c_readreg(adap_info->
+				  ioh_i2c_data[0].ioh_i2c_base_address, 0x44));
+
+	IOH_DEBUG(" invoked function ioh_i2c_disbl_int successfully\n");
+
+	ret = pci_save_state(pdev);
+
+	if (ret) {
+		IOH_LOG(KERN_ERR, "pci_save_state failed\n");
+		return ret;
+	}
+
+	IOH_DEBUG("Invoked pci_save_state successfully\n");
+
+	pci_enable_wake(pdev, PCI_D3hot, 0);
+	IOH_DEBUG("Invoked pci_enable_wake successfully\n");
+
+	pci_disable_device(pdev);
+	IOH_DEBUG("Invoked pci_disable_device successfully\n");
+
+	pci_set_power_state(pdev, pci_choose_state(pdev, state));
+	IOH_DEBUG("Invoked pci_set_power_state successfully\n");
+	IOH_DEBUG("ioh_i2c_suspend returns %d\n", IOH_I2C_SUCCESS);
+
+	return IOH_I2C_SUCCESS;
+
+}
+
+/*! @ingroup	I2C_PCILayerAPI
+  @fn  		ioh_i2c_resume(struct pci_dev* pdev)
+  @remarks  	The main tasks performed by this method are:
+		- Move device to D0 power state.
+		- Restore PCI device state.
+		- Enable the PCI device state.
+		- Disable PM notifications.
+		- Initialize IOH I2C device.
+  @note		This function is invoked by the kernel when the system is
+		transitioning to normal power state from a lower power state.
+  @param  	pdev 	[@ref INOUT]
+		contains reference to PCI device descriptor for the peripheral
+  @retval	int
+		- @ref IOH_I2C_SUCCESS	Function returns successfully.
+		- -EIO 		pci_enable_device fails.
+		- -EINVAL 	pci_enable_device fails.
+  @see		ioh_i2c_pcidriver
+  <hr>
+ */
+static int ioh_i2c_resume(struct pci_dev *pdev)
+{
+
+	struct adapter_info *adap_info = pci_get_drvdata(pdev);
+	int i;
+
+	IOH_DEBUG(" invoked function pci_get_drvdata successfully\n");
+
+	pci_set_power_state(pdev, PCI_D0);
+	IOH_DEBUG("Invoked pci_set_power_state successfully\n");
+
+	pci_restore_state(pdev);
+	IOH_DEBUG("Invoked pci_restore_state successfully\n");
+
+	if (pci_enable_device(pdev) < 0) {
+		IOH_LOG(KERN_ERR,
+			"pci_enable_device failed in ioh_i2c_resume\n");
+		return -EIO;
+	}
+
+	pci_enable_wake(pdev, PCI_D3hot, 0);
+
+	IOH_DEBUG("Invoked pci_enable_wake successfully\n");
+
+	for (i = 0; i < IOH_I2C_MAX_CHN; i++)
+		(void)ioh_i2c_init(&adap_info->ioh_i2c_data[i]);
+
+	IOH_DEBUG("Invoked ioh_i2c_init successfully\n");
+
+	adap_info->ioh_i2c_suspended = false;
+
+	IOH_DEBUG("ioh_i2c_resume return %d\n", IOH_I2C_SUCCESS);
+	return IOH_I2C_SUCCESS;
+}
+
+#endif
+
+/*! @ingroup	I2C_InterfaceLayerAPI
+  @fn  		ioh_i2c_pci_init(void)
+  @brief	This function implements the module entry point.
+  @remarks  	This function invoked at module insertion
+		The main task performed by this method:
+		- Register the PCI driver with PCI core
+		using pci_register_driver API.
+  @param  		None
+  @retval   		int
+			-  0 		Function returns successfully.
+			- -EEXIST	pci_register_driver fails
+			- -EINVAL	pci_register_driver fails
+			- -ENOMEM	pci_register_driver fails
+ <hr>
+ */
+static int __init ioh_i2c_pci_init(void)
+{
+
+	IOH_DEBUG
+	    ("ioh_i2c_pci_init : Invoked pci_register_driver successfully\n");
+	return pci_register_driver(&ioh_i2c_pcidriver);
+}
+
+/*! @ingroup	I2C_InterfaceLayerAPI
+  @fn  		ioh_i2c_pci_exit(void)
+  @brief 	This function implements the module exit point.
+  @remarks	This function is invoked when IOH I2C driver module is being
+		removed from the system. The main task performed by this method:
+		- Unregister the PCI driver with PCI core using
+		the pci_unregister_driver API
+  @param  		None
+  @retval 		None
+ */
+static void __exit ioh_i2c_pci_exit(void)
+{
+	IOH_DEBUG
+	("ioh_i2c_pci_exit : Invoked pci_unregister_driver successfully \n ");
+	pci_unregister_driver(&ioh_i2c_pcidriver);
+
+}
+
+MODULE_DESCRIPTION("IOH I2C PCI Driver");
+MODULE_LICENSE("GPL");
+module_init(ioh_i2c_pci_init);
+module_exit(ioh_i2c_pci_exit);
+module_param(ioh_i2c_speed, int, (S_IRUSR | S_IWUSR));
+module_param(ioh_i2c_clk, int, (S_IRUSR | S_IWUSR));
diff -urN linux-2.6.33.1/drivers/i2c/i2c-dev.c topcliff-2.6.33.1/drivers/i2c/i2c-dev.c
--- linux-2.6.33.1/drivers/i2c/i2c-dev.c	2010-03-16 01:09:39.000000000 +0900
+++ topcliff-2.6.33.1/drivers/i2c/i2c-dev.c	2010-03-24 11:21:29.000000000 +0900
@@ -36,7 +36,7 @@
 #include <linux/i2c-dev.h>
 #include <linux/jiffies.h>
 #include <asm/uaccess.h>
-
+#include "busses/pch_i2c_hal.h"
 static struct i2c_driver i2cdev_driver;
 
 /*
@@ -147,6 +147,11 @@
 	if (tmp==NULL)
 		return -ENOMEM;
 
+	if (copy_from_user(tmp, buf, count)) {
+		kfree(tmp);
+		return -EFAULT;
+	}
+
 	pr_debug("i2c-dev: i2c-%d reading %zu bytes.\n",
 		iminor(file->f_path.dentry->d_inode), count);
 
@@ -372,6 +377,12 @@
 	struct i2c_client *client = (struct i2c_client *)file->private_data;
 	unsigned long funcs;
 
+	unsigned long ioh_mode;
+	int ret;
+
+	struct i2c_msg msg;
+	unsigned char msgbuf[1];
+
 	dev_dbg(&client->adapter->dev, "ioctl, cmd=0x%02x, arg=0x%02lx\n",
 		cmd, arg);
 
@@ -427,6 +438,22 @@
 		 */
 		client->adapter->timeout = msecs_to_jiffies(arg * 10);
 		break;
+	case I2C_MODE_SEL:
+		ioh_mode = arg;
+
+		if (ioh_mode <= 4) {
+			msgbuf[0] = ioh_mode;
+			msg.buf = msgbuf;
+			msg.len = 1;
+			msg.flags = (ioh_mode <=1) ? \
+					(IOH_BUFFER_MODE_ENABLE) : \
+					(IOH_EEPROM_SW_RST_MODE_ENABLE);
+			ret = i2c_transfer(client->adapter, &msg, 1);
+		} else {
+			printk(KERN_ERR "I2C mode sel:Invalid mode \n");
+			ret = -EINVAL;
+		}
+		return ret;
 	default:
 		/* NOTE:  returning a fault code here could cause trouble
 		 * in buggy userspace code.  Some old kernel bugs returned