diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-06-02 03:27:54 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-06-02 03:31:15 -0400 |
commit | 1c98347e613bf17ea2f18c9766ce0ab77f65a96d (patch) | |
tree | 79ac000a8fb4b829f23e2247810de8c8c38eb608 /drivers/usb | |
parent | e8b48669de54d390644c77cd26d5c9fccbc1e0a1 (diff) |
usb: r8a66597-hcd pio to mmio accessor conversion.
r8a66597-hcd 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')
-rw-r--r-- | drivers/usb/host/r8a66597-hcd.c | 4 | ||||
-rw-r--r-- | drivers/usb/host/r8a66597.h | 26 |
2 files changed, 15 insertions, 15 deletions
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index 6db57ab6079d..1a2bb4ce638f 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -2404,7 +2404,7 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev) | |||
2404 | 2404 | ||
2405 | del_timer_sync(&r8a66597->rh_timer); | 2405 | del_timer_sync(&r8a66597->rh_timer); |
2406 | usb_remove_hcd(hcd); | 2406 | usb_remove_hcd(hcd); |
2407 | iounmap((void *)r8a66597->reg); | 2407 | iounmap(r8a66597->reg); |
2408 | #ifdef CONFIG_HAVE_CLK | 2408 | #ifdef CONFIG_HAVE_CLK |
2409 | if (r8a66597->pdata->on_chip) | 2409 | if (r8a66597->pdata->on_chip) |
2410 | clk_put(r8a66597->clk); | 2410 | clk_put(r8a66597->clk); |
@@ -2496,7 +2496,7 @@ static int __devinit r8a66597_probe(struct platform_device *pdev) | |||
2496 | init_timer(&r8a66597->rh_timer); | 2496 | init_timer(&r8a66597->rh_timer); |
2497 | r8a66597->rh_timer.function = r8a66597_timer; | 2497 | r8a66597->rh_timer.function = r8a66597_timer; |
2498 | r8a66597->rh_timer.data = (unsigned long)r8a66597; | 2498 | r8a66597->rh_timer.data = (unsigned long)r8a66597; |
2499 | r8a66597->reg = (unsigned long)reg; | 2499 | r8a66597->reg = reg; |
2500 | 2500 | ||
2501 | /* make sure no interrupts are pending */ | 2501 | /* make sure no interrupts are pending */ |
2502 | ret = r8a66597_clock_enable(r8a66597); | 2502 | ret = r8a66597_clock_enable(r8a66597); |
diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h index 228e3fb23854..95d0f5adfdcf 100644 --- a/drivers/usb/host/r8a66597.h +++ b/drivers/usb/host/r8a66597.h | |||
@@ -112,7 +112,7 @@ struct r8a66597_root_hub { | |||
112 | 112 | ||
113 | struct r8a66597 { | 113 | struct r8a66597 { |
114 | spinlock_t lock; | 114 | spinlock_t lock; |
115 | unsigned long reg; | 115 | void __iomem *reg; |
116 | #ifdef CONFIG_HAVE_CLK | 116 | #ifdef CONFIG_HAVE_CLK |
117 | struct clk *clk; | 117 | struct clk *clk; |
118 | #endif | 118 | #endif |
@@ -170,67 +170,67 @@ static inline struct urb *r8a66597_get_urb(struct r8a66597 *r8a66597, | |||
170 | 170 | ||
171 | static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) | 171 | static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) |
172 | { | 172 | { |
173 | return inw(r8a66597->reg + offset); | 173 | return ioread16(r8a66597->reg + offset); |
174 | } | 174 | } |
175 | 175 | ||
176 | static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | 176 | static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, |
177 | unsigned long offset, u16 *buf, | 177 | unsigned long offset, u16 *buf, |
178 | int len) | 178 | int len) |
179 | { | 179 | { |
180 | unsigned long fifoaddr = r8a66597->reg + offset; | 180 | void __iomem *fifoaddr = r8a66597->reg + offset; |
181 | unsigned long count; | 181 | unsigned long count; |
182 | 182 | ||
183 | if (r8a66597->pdata->on_chip) { | 183 | if (r8a66597->pdata->on_chip) { |
184 | count = len / 4; | 184 | count = len / 4; |
185 | insl(fifoaddr, buf, count); | 185 | ioread32_rep(fifoaddr, buf, count); |
186 | 186 | ||
187 | if (len & 0x00000003) { | 187 | if (len & 0x00000003) { |
188 | unsigned long tmp = inl(fifoaddr); | 188 | unsigned long tmp = ioread32(fifoaddr); |
189 | memcpy((unsigned char *)buf + count * 4, &tmp, | 189 | memcpy((unsigned char *)buf + count * 4, &tmp, |
190 | len & 0x03); | 190 | len & 0x03); |
191 | } | 191 | } |
192 | } else { | 192 | } else { |
193 | len = (len + 1) / 2; | 193 | len = (len + 1) / 2; |
194 | insw(fifoaddr, buf, len); | 194 | ioread16_rep(fifoaddr, buf, len); |
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||
198 | static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, | 198 | static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, |
199 | unsigned long offset) | 199 | unsigned long offset) |
200 | { | 200 | { |
201 | outw(val, r8a66597->reg + offset); | 201 | iowrite16(val, r8a66597->reg + offset); |
202 | } | 202 | } |
203 | 203 | ||
204 | static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | 204 | static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, |
205 | unsigned long offset, u16 *buf, | 205 | unsigned long offset, u16 *buf, |
206 | int len) | 206 | int len) |
207 | { | 207 | { |
208 | unsigned long fifoaddr = r8a66597->reg + offset; | 208 | void __iomem *fifoaddr = r8a66597->reg + offset; |
209 | unsigned long count; | 209 | unsigned long count; |
210 | unsigned char *pb; | 210 | unsigned char *pb; |
211 | int i; | 211 | int i; |
212 | 212 | ||
213 | if (r8a66597->pdata->on_chip) { | 213 | if (r8a66597->pdata->on_chip) { |
214 | count = len / 4; | 214 | count = len / 4; |
215 | outsl(fifoaddr, buf, count); | 215 | iowrite32_rep(fifoaddr, buf, count); |
216 | 216 | ||
217 | if (len & 0x00000003) { | 217 | if (len & 0x00000003) { |
218 | pb = (unsigned char *)buf + count * 4; | 218 | pb = (unsigned char *)buf + count * 4; |
219 | for (i = 0; i < (len & 0x00000003); i++) { | 219 | for (i = 0; i < (len & 0x00000003); i++) { |
220 | if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND) | 220 | if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND) |
221 | outb(pb[i], fifoaddr + i); | 221 | iowrite8(pb[i], fifoaddr + i); |
222 | else | 222 | else |
223 | outb(pb[i], fifoaddr + 3 - i); | 223 | iowrite8(pb[i], fifoaddr + 3 - i); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | } else { | 226 | } else { |
227 | int odd = len & 0x0001; | 227 | int odd = len & 0x0001; |
228 | 228 | ||
229 | len = len / 2; | 229 | len = len / 2; |
230 | outsw(fifoaddr, buf, len); | 230 | ioread16_rep(fifoaddr, buf, len); |
231 | if (unlikely(odd)) { | 231 | if (unlikely(odd)) { |
232 | buf = &buf[len]; | 232 | buf = &buf[len]; |
233 | outb((unsigned char)*buf, fifoaddr); | 233 | iowrite8((unsigned char)*buf, fifoaddr); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | } | 236 | } |