Skip to content

Commit 1c98347

Browse files
committed
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>
1 parent e8b4866 commit 1c98347

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

‎drivers/usb/host/r8a66597-hcd.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,7 +2404,7 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev)
24042404

24052405
del_timer_sync(&r8a66597->rh_timer);
24062406
usb_remove_hcd(hcd);
2407-
iounmap((void *)r8a66597->reg);
2407+
iounmap(r8a66597->reg);
24082408
#ifdef CONFIG_HAVE_CLK
24092409
if (r8a66597->pdata->on_chip)
24102410
clk_put(r8a66597->clk);
@@ -2496,7 +2496,7 @@ static int __devinit r8a66597_probe(struct platform_device *pdev)
24962496
init_timer(&r8a66597->rh_timer);
24972497
r8a66597->rh_timer.function = r8a66597_timer;
24982498
r8a66597->rh_timer.data = (unsigned long)r8a66597;
2499-
r8a66597->reg = (unsigned long)reg;
2499+
r8a66597->reg = reg;
25002500

25012501
/* make sure no interrupts are pending */
25022502
ret = r8a66597_clock_enable(r8a66597);

‎drivers/usb/host/r8a66597.h‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ struct r8a66597_root_hub {
112112

113113
struct r8a66597 {
114114
spinlock_t lock;
115-
unsigned long reg;
115+
void __iomem *reg;
116116
#ifdef CONFIG_HAVE_CLK
117117
struct clk *clk;
118118
#endif
@@ -170,67 +170,67 @@ static inline struct urb *r8a66597_get_urb(struct r8a66597 *r8a66597,
170170

171171
static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset)
172172
{
173-
return inw(r8a66597->reg + offset);
173+
return ioread16(r8a66597->reg + offset);
174174
}
175175

176176
static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597,
177177
unsigned long offset, u16 *buf,
178178
int len)
179179
{
180-
unsigned long fifoaddr = r8a66597->reg + offset;
180+
void __iomem *fifoaddr = r8a66597->reg + offset;
181181
unsigned long count;
182182

183183
if (r8a66597->pdata->on_chip) {
184184
count = len / 4;
185-
insl(fifoaddr, buf, count);
185+
ioread32_rep(fifoaddr, buf, count);
186186

187187
if (len & 0x00000003) {
188-
unsigned long tmp = inl(fifoaddr);
188+
unsigned long tmp = ioread32(fifoaddr);
189189
memcpy((unsigned char *)buf + count * 4, &tmp,
190190
len & 0x03);
191191
}
192192
} else {
193193
len = (len + 1) / 2;
194-
insw(fifoaddr, buf, len);
194+
ioread16_rep(fifoaddr, buf, len);
195195
}
196196
}
197197

198198
static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val,
199199
unsigned long offset)
200200
{
201-
outw(val, r8a66597->reg + offset);
201+
iowrite16(val, r8a66597->reg + offset);
202202
}
203203

204204
static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597,
205205
unsigned long offset, u16 *buf,
206206
int len)
207207
{
208-
unsigned long fifoaddr = r8a66597->reg + offset;
208+
void __iomem *fifoaddr = r8a66597->reg + offset;
209209
unsigned long count;
210210
unsigned char *pb;
211211
int i;
212212

213213
if (r8a66597->pdata->on_chip) {
214214
count = len / 4;
215-
outsl(fifoaddr, buf, count);
215+
iowrite32_rep(fifoaddr, buf, count);
216216

217217
if (len & 0x00000003) {
218218
pb = (unsigned char *)buf + count * 4;
219219
for (i = 0; i < (len & 0x00000003); i++) {
220220
if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND)
221-
outb(pb[i], fifoaddr + i);
221+
iowrite8(pb[i], fifoaddr + i);
222222
else
223-
outb(pb[i], fifoaddr + 3 - i);
223+
iowrite8(pb[i], fifoaddr + 3 - i);
224224
}
225225
}
226226
} else {
227227
int odd = len & 0x0001;
228228

229229
len = len / 2;
230-
outsw(fifoaddr, buf, len);
230+
ioread16_rep(fifoaddr, buf, len);
231231
if (unlikely(odd)) {
232232
buf = &buf[len];
233-
outb((unsigned char)*buf, fifoaddr);
233+
iowrite8((unsigned char)*buf, fifoaddr);
234234
}
235235
}
236236
}

0 commit comments

Comments
 (0)