* Felipe Balbi | 2011-08-29 11:51:34 [+0300]: >diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c >index a6fc5c3..9d8ec02 100644 >--- a/drivers/usb/dwc3/ep0.c >+++ b/drivers/usb/dwc3/ep0.c >@@ -185,10 +185,27 @@ static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep, > req->epnum = dep->number; > > list_add_tail(&req->list, &dep->request_list); >- dwc3_map_buffer_to_dma(req); >+ if (req->request.length == 0) { >+ ret = dwc3_ep0_start_trans(dwc, dep->number, >+ dwc->ctrl_req_addr, 0); >+ } else if ((req->request.length % dep->endpoint.maxpacket) >+ && (dep->number == 0)) { This "problem" is not limited to ep0. And I would beat the gadget drivers to queue [bw]MaxPacketSize0? length requests even if they know that they expect only 5 bytes of data. Otherwise this workaround as to be implemented in other driver as well. It gets a little more complicated if the requests is maxpacket+3 or so. So I'm for fixing the gadget. >+ dwc->ep0_bounced = true; >+ >+ /* >+ * REVISIT in case request length is bigger than EP0 >+ * wMaxPacketSize, we will need two chained TRBs to handle >+ * the transfer. >+ */ A warn_on() in case we hit the problem so we know we need to fix this _now_. >+ ret = dwc3_ep0_start_trans(dwc, dep->number, >+ dwc->ep0_bounce_addr, dep->endpoint.maxpacket); >+ } else { >+ dwc3_map_buffer_to_dma(req); >+ >+ ret = dwc3_ep0_start_trans(dwc, dep->number, >+ req->request.dma, req->request.length); >+ } > >- ret = dwc3_ep0_start_trans(dwc, dep->number, req->request.dma, >- req->request.length); > if (ret < 0) { > list_del(&req->list); > dwc3_unmap_buffer_from_dma(req); >@@ -658,6 +675,11 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, > transferred = ur->length - trb.length; > ur->actual += transferred; > >+ if (dwc->ep0_bounced) { transferred = min(req->length, dep->endpoint.maxpacket - trb.length) >+ memcpy(ur->buf, dwc->ep0_bounce, transferred); >+ dwc->ep0_bounced = false; >+ } >+ > if ((epnum & 1) && ur->actual < ur->length) { > /* for some reason we did not get everything out */ > Sebastian -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html