diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-06-02 03:27:12 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-06-02 03:31:02 -0400 |
commit | e8b48669de54d390644c77cd26d5c9fccbc1e0a1 (patch) | |
tree | 19f61b72795fe70f24bd2e69a2ef38548710a427 /drivers/usb/gadget/r8a66597-udc.h | |
parent | abb24f4846d1537d73605e8576de8359a98e5ced (diff) |
usb: gadget: r8a66597-udc pio to mmio accessor conversion.
r8a66597-udc is erroneously using PIO routines on MMIO registers, which
presently blows up for any platform that elects to either override or do
away with PIO routines. This managed to work for the common cases since
the PIO routines were simply wrapped to their MMIO counterparts. This
switches over to using the MMIO routines directly, and enables us to kill
off a lot of superfluous casting in the process.
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/usb/gadget/r8a66597-udc.h')
-rw-r--r-- | drivers/usb/gadget/r8a66597-udc.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h index 9a537aa07968..f763b5190afa 100644 --- a/drivers/usb/gadget/r8a66597-udc.h +++ b/drivers/usb/gadget/r8a66597-udc.h | |||
@@ -91,7 +91,7 @@ struct r8a66597_ep { | |||
91 | 91 | ||
92 | struct r8a66597 { | 92 | struct r8a66597 { |
93 | spinlock_t lock; | 93 | spinlock_t lock; |
94 | unsigned long reg; | 94 | void __iomem *reg; |
95 | 95 | ||
96 | #ifdef CONFIG_HAVE_CLK | 96 | #ifdef CONFIG_HAVE_CLK |
97 | struct clk *clk; | 97 | struct clk *clk; |
@@ -127,7 +127,7 @@ struct r8a66597 { | |||
127 | 127 | ||
128 | static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) | 128 | static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) |
129 | { | 129 | { |
130 | return inw(r8a66597->reg + offset); | 130 | return ioread16(r8a66597->reg + offset); |
131 | } | 131 | } |
132 | 132 | ||
133 | static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | 133 | static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, |
@@ -135,7 +135,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | |||
135 | unsigned char *buf, | 135 | unsigned char *buf, |
136 | int len) | 136 | int len) |
137 | { | 137 | { |
138 | unsigned long fifoaddr = r8a66597->reg + offset; | 138 | void __iomem *fifoaddr = r8a66597->reg + offset; |
139 | unsigned int data; | 139 | unsigned int data; |
140 | int i; | 140 | int i; |
141 | 141 | ||
@@ -144,7 +144,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | |||
144 | 144 | ||
145 | /* aligned buf case */ | 145 | /* aligned buf case */ |
146 | if (len >= 4 && !((unsigned long)buf & 0x03)) { | 146 | if (len >= 4 && !((unsigned long)buf & 0x03)) { |
147 | insl(fifoaddr, buf, len / 4); | 147 | ioread32_rep(fifoaddr, buf, len / 4); |
148 | buf += len & ~0x03; | 148 | buf += len & ~0x03; |
149 | len &= 0x03; | 149 | len &= 0x03; |
150 | } | 150 | } |
@@ -152,7 +152,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | |||
152 | /* unaligned buf case */ | 152 | /* unaligned buf case */ |
153 | for (i = 0; i < len; i++) { | 153 | for (i = 0; i < len; i++) { |
154 | if (!(i & 0x03)) | 154 | if (!(i & 0x03)) |
155 | data = inl(fifoaddr); | 155 | data = ioread32(fifoaddr); |
156 | 156 | ||
157 | buf[i] = (data >> ((i & 0x03) * 8)) & 0xff; | 157 | buf[i] = (data >> ((i & 0x03) * 8)) & 0xff; |
158 | } | 158 | } |
@@ -161,7 +161,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | |||
161 | 161 | ||
162 | /* aligned buf case */ | 162 | /* aligned buf case */ |
163 | if (len >= 2 && !((unsigned long)buf & 0x01)) { | 163 | if (len >= 2 && !((unsigned long)buf & 0x01)) { |
164 | insw(fifoaddr, buf, len / 2); | 164 | ioread16_rep(fifoaddr, buf, len / 2); |
165 | buf += len & ~0x01; | 165 | buf += len & ~0x01; |
166 | len &= 0x01; | 166 | len &= 0x01; |
167 | } | 167 | } |
@@ -169,7 +169,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | |||
169 | /* unaligned buf case */ | 169 | /* unaligned buf case */ |
170 | for (i = 0; i < len; i++) { | 170 | for (i = 0; i < len; i++) { |
171 | if (!(i & 0x01)) | 171 | if (!(i & 0x01)) |
172 | data = inw(fifoaddr); | 172 | data = ioread16(fifoaddr); |
173 | 173 | ||
174 | buf[i] = (data >> ((i & 0x01) * 8)) & 0xff; | 174 | buf[i] = (data >> ((i & 0x01) * 8)) & 0xff; |
175 | } | 175 | } |
@@ -179,7 +179,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | |||
179 | static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, | 179 | static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, |
180 | unsigned long offset) | 180 | unsigned long offset) |
181 | { | 181 | { |
182 | outw(val, r8a66597->reg + offset); | 182 | iowrite16(val, r8a66597->reg + offset); |
183 | } | 183 | } |
184 | 184 | ||
185 | static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | 185 | static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, |
@@ -187,21 +187,21 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | |||
187 | unsigned char *buf, | 187 | unsigned char *buf, |
188 | int len) | 188 | int len) |
189 | { | 189 | { |
190 | unsigned long fifoaddr = r8a66597->reg + offset; | 190 | void __iomem *fifoaddr = r8a66597->reg + offset; |
191 | int adj = 0; | 191 | int adj = 0; |
192 | int i; | 192 | int i; |
193 | 193 | ||
194 | if (r8a66597->pdata->on_chip) { | 194 | if (r8a66597->pdata->on_chip) { |
195 | /* 32-bit access only if buf is 32-bit aligned */ | 195 | /* 32-bit access only if buf is 32-bit aligned */ |
196 | if (len >= 4 && !((unsigned long)buf & 0x03)) { | 196 | if (len >= 4 && !((unsigned long)buf & 0x03)) { |
197 | outsl(fifoaddr, buf, len / 4); | 197 | iowrite32_rep(fifoaddr, buf, len / 4); |
198 | buf += len & ~0x03; | 198 | buf += len & ~0x03; |
199 | len &= 0x03; | 199 | len &= 0x03; |
200 | } | 200 | } |
201 | } else { | 201 | } else { |
202 | /* 16-bit access only if buf is 16-bit aligned */ | 202 | /* 16-bit access only if buf is 16-bit aligned */ |
203 | if (len >= 2 && !((unsigned long)buf & 0x01)) { | 203 | if (len >= 2 && !((unsigned long)buf & 0x01)) { |
204 | outsw(fifoaddr, buf, len / 2); | 204 | iowrite16_rep(fifoaddr, buf, len / 2); |
205 | buf += len & ~0x01; | 205 | buf += len & ~0x01; |
206 | len &= 0x01; | 206 | len &= 0x01; |
207 | } | 207 | } |
@@ -216,7 +216,7 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | |||
216 | } | 216 | } |
217 | 217 | ||
218 | for (i = 0; i < len; i++) | 218 | for (i = 0; i < len; i++) |
219 | outb(buf[i], fifoaddr + adj - (i & adj)); | 219 | iowrite8(buf[i], fifoaddr + adj - (i & adj)); |
220 | } | 220 | } |
221 | 221 | ||
222 | static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, | 222 | static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, |