Skip to content

Commit

Permalink
usb: gadget: m66592-udc pio to mmio accessor conversion.
Browse files Browse the repository at this point in the history
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: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Paul Mundt committed Jun 2, 2010
1 parent 4b3fb4e commit abb24f4
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions drivers/usb/gadget/m66592-udc.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,61 +537,61 @@ struct m66592 {
/*-------------------------------------------------------------------------*/
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,
unsigned long offset,
void *buf, unsigned long len)
{
unsigned long fifoaddr = (unsigned long)m66592->reg + offset;
void __iomem *fifoaddr = m66592->reg + offset;

if (m66592->pdata->on_chip) {
len = (len + 3) / 4;
insl(fifoaddr, buf, len);
ioread32_rep(fifoaddr, buf, len);
} else {
len = (len + 1) / 2;
insw(fifoaddr, buf, len);
ioread16_rep(fifoaddr, buf, len);
}
}

static inline void m66592_write(struct m66592 *m66592, u16 val,
unsigned long offset)
{
outw(val, (unsigned long)m66592->reg + offset);
iowrite16(val, m66592->reg + offset);
}

static inline void m66592_write_fifo(struct m66592 *m66592,
unsigned long offset,
void *buf, unsigned long len)
{
unsigned long fifoaddr = (unsigned long)m66592->reg + offset;
void __iomem *fifoaddr = m66592->reg + offset;

if (m66592->pdata->on_chip) {
unsigned long count;
unsigned char *pb;
int i;

count = len / 4;
outsl(fifoaddr, buf, count);
iowrite32_rep(fifoaddr, buf, count);

if (len & 0x00000003) {
pb = buf + count * 4;
for (i = 0; i < (len & 0x00000003); i++) {
if (m66592_read(m66592, M66592_CFBCFG)) /* le */
outb(pb[i], fifoaddr + (3 - i));
iowrite8(pb[i], fifoaddr + (3 - i));
else
outb(pb[i], fifoaddr + i);
iowrite8(pb[i], fifoaddr + i);
}
}
} else {
unsigned long odd = len & 0x0001;

len = len / 2;
outsw(fifoaddr, buf, len);
iowrite16_rep(fifoaddr, buf, len);
if (odd) {
unsigned char *p = buf + len*2;
outb(*p, fifoaddr);
iowrite8(*p, fifoaddr);
}
}
}
Expand Down

0 comments on commit abb24f4

Please sign in to comment.