Browse files

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...
1 parent be97723 commit e6ec57a4d0f5b51d6b4d3e60fc8ba98ddebd17bb @mthuurne committed Jun 7, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 drivers/usb/gadget/jz4740_udc.c
View
8 drivers/usb/gadget/jz4740_udc.c
@@ -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;
}
@@ -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;
}

0 comments on commit e6ec57a

Please sign in to comment.