Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
MIPS: JZ4740: USB: Fix packet read/write functions.
The read_packet() and write_packet() functions were recently converted
to use memcpy_fromio() and memcpy_toio(). However, the FIFO register
is only a single address while memcpy increases the address. Fixed by
using readsl() and writesl() instead.
  • Loading branch information
mthuurne committed Jun 6, 2011
1 parent be97723 commit e6ec57a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/usb/gadget/jz4740_udc.c
Expand Up @@ -257,7 +257,8 @@ static inline int write_packet(struct jz4740_ep *ep,

DEBUG("Write %d (count %d), fifo %x\n", length, count, ep->fifo);

memcpy_toio(fifo, buf, length);
writesl(fifo, buf, length >> 2);
writesb(fifo, &buf[length - (length & 3)], length & 3);

return length;
}
Expand All @@ -277,7 +278,10 @@ static int read_packet(struct jz4740_ep *ep,
length = count;
req->req.actual += length;

memcpy_fromio(buf, fifo, length);
DEBUG("Read %d, fifo %x\n", length, ep->fifo);

readsl(fifo, buf, length >> 2);
readsb(fifo, &buf[length - (length & 3)], length & 3);

return length;
}
Expand Down

0 comments on commit e6ec57a

Please sign in to comment.