summaryrefslogtreecommitdiff
path: root/target/linux/ppc40x/patches-3.18/121-usb-isp116x-hcd-ppc405-register-access.patch
blob: 4fb47181bc714ace78408724c09c3fc30a719019 (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
--- a/drivers/usb/host/isp116x.h
+++ b/drivers/usb/host/isp116x.h
@@ -354,21 +354,63 @@ struct isp116x_ep {
 #define isp116x_check_platform_delay(h)	0
 #endif
 
+#ifdef CONFIG_PPC
+static inline void isp116x_writew(u16 val, void __iomem *addr)
+{
+	writew(cpu_to_le16(val), addr);
+}
+
+static inline u16 isp116x_readw(void __iomem *addr)
+{
+	return le16_to_cpu(readw(addr));
+}
+
+static inline void isp116x_raw_writew(u16 val, void __iomem *addr)
+{
+	writew(cpu_to_le16(val), addr);
+}
+
+static inline u16 isp116x_raw_readw(void __iomem *addr)
+{
+	return le16_to_cpu(readw(addr));
+}
+#else
+static inline void isp116x_writew(u16 val, void __iomem *addr)
+{
+	writew(val, addr);
+}
+
+static inline u16 isp116x_readw(void __iomem *addr)
+{
+	return readw(addr);
+}
+
+static inline void isp116x_raw_writew(u16 val, void __iomem *addr)
+{
+	__raw_writew(val, addr);
+}
+
+static inline u16 isp116x_raw_readw(void __iomem *addr)
+{
+	return __raw_readw(addr);
+}
+#endif
+
 static inline void isp116x_write_addr(struct isp116x *isp116x, unsigned reg)
 {
-	writew(reg & 0xff, isp116x->addr_reg);
+	isp116x_writew(reg & 0xff, isp116x->addr_reg);
 	isp116x_delay(isp116x, 300);
 }
 
 static inline void isp116x_write_data16(struct isp116x *isp116x, u16 val)
 {
-	writew(val, isp116x->data_reg);
+	isp116x_writew(val, isp116x->data_reg);
 	isp116x_delay(isp116x, 150);
 }
 
 static inline void isp116x_raw_write_data16(struct isp116x *isp116x, u16 val)
 {
-	__raw_writew(val, isp116x->data_reg);
+	isp116x_raw_writew(val, isp116x->data_reg);
 	isp116x_delay(isp116x, 150);
 }
 
@@ -376,7 +418,7 @@ static inline u16 isp116x_read_data16(st
 {
 	u16 val;
 
-	val = readw(isp116x->data_reg);
+	val = isp116x_readw(isp116x->data_reg);
 	isp116x_delay(isp116x, 150);
 	return val;
 }
@@ -385,16 +427,16 @@ static inline u16 isp116x_raw_read_data1
 {
 	u16 val;
 
-	val = __raw_readw(isp116x->data_reg);
+	val = isp116x_raw_readw(isp116x->data_reg);
 	isp116x_delay(isp116x, 150);
 	return val;
 }
 
 static inline void isp116x_write_data32(struct isp116x *isp116x, u32 val)
 {
-	writew(val & 0xffff, isp116x->data_reg);
+	isp116x_writew(val & 0xffff, isp116x->data_reg);
 	isp116x_delay(isp116x, 150);
-	writew(val >> 16, isp116x->data_reg);
+	isp116x_writew(val >> 16, isp116x->data_reg);
 	isp116x_delay(isp116x, 150);
 }
 
@@ -402,9 +444,9 @@ static inline u32 isp116x_read_data32(st
 {
 	u32 val;
 
-	val = (u32) readw(isp116x->data_reg);
+	val = (u32) isp116x_readw(isp116x->data_reg);
 	isp116x_delay(isp116x, 150);
-	val |= ((u32) readw(isp116x->data_reg)) << 16;
+	val |= ((u32) isp116x_readw(isp116x->data_reg)) << 16;
 	isp116x_delay(isp116x, 150);
 	return val;
 }