If transfer not ready is received before ep queue is called for control out transfer then pending flag is set. Handling of this case was not correct. TRB size must be max packet for all control out transfer. dma sync function should also be called before start transfer. Signed-off-by: Pratyush Anand <pratyush.anand@xxxxxx> --- drivers/usb/dwc3/ep0.c | 26 +++++++++++++++++++++++--- 1 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index c6c9b8a..ad4062a 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -150,9 +150,29 @@ static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep, return 0; } - ret = dwc3_ep0_start_trans(dwc, direction, - req->request.dma, req->request.length, - DWC3_TRBCTL_CONTROL_DATA); + dwc3_map_buffer_to_dma(req); + + if (direction) + ret = dwc3_ep0_start_trans(dwc, direction, + req->request.dma, req->request.length, + DWC3_TRBCTL_CONTROL_DATA); + else { + WARN_ON(req->request.length > dep->endpoint.maxpacket); + + dwc->ep0_bounced = true; + + /* + * REVISIT in case request length is bigger than EP0 + * wMaxPacketSize, we will need two chained TRBs to + * handle the transfer. + */ + + ret = dwc3_ep0_start_trans(dwc, direction, + dwc->ep0_bounce_addr, + dep->endpoint.maxpacket, + DWC3_TRBCTL_CONTROL_DATA); + } + dep->flags &= ~(DWC3_EP_PENDING_REQUEST | DWC3_EP0_DIR_IN); } else if (dwc->delayed_status) { -- 1.7.2.2 -- 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