Commit abb24f48 authored by Paul Mundt's avatar Paul Mundt

usb: gadget: m66592-udc pio to mmio accessor conversion.

m66592-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: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 4b3fb4e7
...@@ -537,35 +537,35 @@ struct m66592 { ...@@ -537,35 +537,35 @@ struct m66592 {
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static inline u16 m66592_read(struct m66592 *m66592, unsigned long offset) static inline u16 m66592_read(struct m66592 *m66592, unsigned long offset)
{ {
return inw((unsigned long)m66592->reg + offset); return ioread16(m66592->reg + offset);
} }
static inline void m66592_read_fifo(struct m66592 *m66592, static inline void m66592_read_fifo(struct m66592 *m66592,
unsigned long offset, unsigned long offset,
void *buf, unsigned long len) void *buf, unsigned long len)
{ {
unsigned long fifoaddr = (unsigned long)m66592->reg + offset; void __iomem *fifoaddr = m66592->reg + offset;
if (m66592->pdata->on_chip) { if (m66592->pdata->on_chip) {
len = (len + 3) / 4; len = (len + 3) / 4;
insl(fifoaddr, buf, len); ioread32_rep(fifoaddr, buf, len);
} else { } else {
len = (len + 1) / 2; len = (len + 1) / 2;
insw(fifoaddr, buf, len); ioread16_rep(fifoaddr, buf, len);
} }
} }
static inline void m66592_write(struct m66592 *m66592, u16 val, static inline void m66592_write(struct m66592 *m66592, u16 val,
unsigned long offset) unsigned long offset)
{ {
outw(val, (unsigned long)m66592->reg + offset); iowrite16(val, m66592->reg + offset);
} }
static inline void m66592_write_fifo(struct m66592 *m66592, static inline void m66592_write_fifo(struct m66592 *m66592,
unsigned long offset, unsigned long offset,
void *buf, unsigned long len) void *buf, unsigned long len)
{ {
unsigned long fifoaddr = (unsigned long)m66592->reg + offset; void __iomem *fifoaddr = m66592->reg + offset;
if (m66592->pdata->on_chip) { if (m66592->pdata->on_chip) {
unsigned long count; unsigned long count;
...@@ -573,25 +573,25 @@ static inline void m66592_write_fifo(struct m66592 *m66592, ...@@ -573,25 +573,25 @@ static inline void m66592_write_fifo(struct m66592 *m66592,
int i; int i;
count = len / 4; count = len / 4;
outsl(fifoaddr, buf, count); iowrite32_rep(fifoaddr, buf, count);
if (len & 0x00000003) { if (len & 0x00000003) {
pb = buf + count * 4; pb = buf + count * 4;
for (i = 0; i < (len & 0x00000003); i++) { for (i = 0; i < (len & 0x00000003); i++) {
if (m66592_read(m66592, M66592_CFBCFG)) /* le */ if (m66592_read(m66592, M66592_CFBCFG)) /* le */
outb(pb[i], fifoaddr + (3 - i)); iowrite8(pb[i], fifoaddr + (3 - i));
else else
outb(pb[i], fifoaddr + i); iowrite8(pb[i], fifoaddr + i);
} }
} }
} else { } else {
unsigned long odd = len & 0x0001; unsigned long odd = len & 0x0001;
len = len / 2; len = len / 2;
outsw(fifoaddr, buf, len); iowrite16_rep(fifoaddr, buf, len);
if (odd) { if (odd) {
unsigned char *p = buf + len*2; unsigned char *p = buf + len*2;
outb(*p, fifoaddr); iowrite8(*p, fifoaddr);
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment