usb: r8a66597-hcd pio to mmio accessor conversion.
authorPaul Mundt <lethal@linux-sh.org>
Wed, 2 Jun 2010 07:27:54 +0000 (16:27 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Wed, 2 Jun 2010 07:31:15 +0000 (16:31 +0900)
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>
drivers/usb/host/r8a66597-hcd.c
drivers/usb/host/r8a66597.h

index 6db57ab..1a2bb4c 100644 (file)
@@ -2404,7 +2404,7 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev)
 
        del_timer_sync(&r8a66597->rh_timer);
        usb_remove_hcd(hcd);
-       iounmap((void *)r8a66597->reg);
+       iounmap(r8a66597->reg);
 #ifdef CONFIG_HAVE_CLK
        if (r8a66597->pdata->on_chip)
                clk_put(r8a66597->clk);
@@ -2496,7 +2496,7 @@ static int __devinit r8a66597_probe(struct platform_device *pdev)
        init_timer(&r8a66597->rh_timer);
        r8a66597->rh_timer.function = r8a66597_timer;
        r8a66597->rh_timer.data = (unsigned long)r8a66597;
-       r8a66597->reg = (unsigned long)reg;
+       r8a66597->reg = reg;
 
        /* make sure no interrupts are pending */
        ret = r8a66597_clock_enable(r8a66597);
index 228e3fb..95d0f5a 100644 (file)
@@ -112,7 +112,7 @@ struct r8a66597_root_hub {
 
 struct r8a66597 {
        spinlock_t lock;
-       unsigned long reg;
+       void __iomem *reg;
 #ifdef CONFIG_HAVE_CLK
        struct clk *clk;
 #endif
@@ -170,67 +170,67 @@ static inline struct urb *r8a66597_get_urb(struct r8a66597 *r8a66597,
 
 static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset)
 {
-       return inw(r8a66597->reg + offset);
+       return ioread16(r8a66597->reg + offset);
 }
 
 static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597,
                                      unsigned long offset, u16 *buf,
                                      int len)
 {
-       unsigned long fifoaddr = r8a66597->reg + offset;
+       void __iomem *fifoaddr = r8a66597->reg + offset;
        unsigned long count;
 
        if (r8a66597->pdata->on_chip) {
                count = len / 4;
-               insl(fifoaddr, buf, count);
+               ioread32_rep(fifoaddr, buf, count);
 
                if (len & 0x00000003) {
-                       unsigned long tmp = inl(fifoaddr);
+                       unsigned long tmp = ioread32(fifoaddr);
                        memcpy((unsigned char *)buf + count * 4, &tmp,
                               len & 0x03);
                }
        } else {
                len = (len + 1) / 2;
-               insw(fifoaddr, buf, len);
+               ioread16_rep(fifoaddr, buf, len);
        }
 }
 
 static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val,
                                  unsigned long offset)
 {
-       outw(val, r8a66597->reg + offset);
+       iowrite16(val, r8a66597->reg + offset);
 }
 
 static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597,
                                       unsigned long offset, u16 *buf,
                                       int len)
 {
-       unsigned long fifoaddr = r8a66597->reg + offset;
+       void __iomem *fifoaddr = r8a66597->reg + offset;
        unsigned long count;
        unsigned char *pb;
        int i;
 
        if (r8a66597->pdata->on_chip) {
                count = len / 4;
-               outsl(fifoaddr, buf, count);
+               iowrite32_rep(fifoaddr, buf, count);
 
                if (len & 0x00000003) {
                        pb = (unsigned char *)buf + count * 4;
                        for (i = 0; i < (len & 0x00000003); i++) {
                                if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND)
-                                       outb(pb[i], fifoaddr + i);
+                                       iowrite8(pb[i], fifoaddr + i);
                                else
-                                       outb(pb[i], fifoaddr + 3 - i);
+                                       iowrite8(pb[i], fifoaddr + 3 - i);
                        }
                }
        } else {
                int odd = len & 0x0001;
 
                len = len / 2;
-               outsw(fifoaddr, buf, len);
+               ioread16_rep(fifoaddr, buf, len);
                if (unlikely(odd)) {
                        buf = &buf[len];
-                       outb((unsigned char)*buf, fifoaddr);
+                       iowrite8((unsigned char)*buf, fifoaddr);
                }
        }
 }