aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/ep0.c
diff options
context:
space:
mode:
authorMoiz Sonasath <m-sonasath@ti.com>2012-03-14 01:44:56 -0400
committerFelipe Balbi <balbi@ti.com>2012-04-10 05:21:43 -0400
commit566ccdda07dc5898272b6fbad9c616fc44be305a (patch)
tree556b76d96c6061db261d064725866f965d52c6ca /drivers/usb/dwc3/ep0.c
parent6d258a4c42089229b855fd706622029decf316d6 (diff)
usb: dwc3: ep0: Handle requests greater than wMaxPacketSize
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>
Diffstat (limited to 'drivers/usb/dwc3/ep0.c')
-rw-r--r--drivers/usb/dwc3/ep0.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 25910e251c04..a40d3bb0f1c2 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -559,8 +559,12 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
559 length = trb->size & DWC3_TRB_SIZE_MASK; 559 length = trb->size & DWC3_TRB_SIZE_MASK;
560 560
561 if (dwc->ep0_bounced) { 561 if (dwc->ep0_bounced) {
562 unsigned transfer_size = ur->length;
563 unsigned maxp = ep0->endpoint.maxpacket;
564
565 transfer_size += (maxp - (transfer_size % maxp));
562 transferred = min_t(u32, ur->length, 566 transferred = min_t(u32, ur->length,
563 ep0->endpoint.maxpacket - length); 567 transfer_size - length);
564 memcpy(ur->buf, dwc->ep0_bounce, transferred); 568 memcpy(ur->buf, dwc->ep0_bounce, transferred);
565 dwc->ep0_bounced = false; 569 dwc->ep0_bounced = false;
566 } else { 570 } else {