Skip to content

Commit

Permalink
usb: dwc3: ep0: Handle requests greater than wMaxPacketSize
Browse files Browse the repository at this point in the history
To allow ep0 out transfers of upto bounce buffer size
instead of maxpacketsize, use the transfer size as multiple
of ep0 maxpacket size.

Cc: stable@vger.kernel.org
Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
Signed-off-by: Partha Basak <p-basak2@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Moiz Sonasath authored and Felipe Balbi committed Apr 10, 2012
1 parent 6d258a4 commit 566ccdd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/usb/dwc3/ep0.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,12 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
length = trb->size & DWC3_TRB_SIZE_MASK;

if (dwc->ep0_bounced) {
unsigned transfer_size = ur->length;
unsigned maxp = ep0->endpoint.maxpacket;

transfer_size += (maxp - (transfer_size % maxp));
transferred = min_t(u32, ur->length,
ep0->endpoint.maxpacket - length);
transfer_size - length);
memcpy(ur->buf, dwc->ep0_bounce, transferred);
dwc->ep0_bounced = false;
} else {
Expand Down

0 comments on commit 566ccdd

Please sign in to comment.