From: Roger Quadros Date: Tue, 19 Apr 2016 12:20:39 +0000 (+0300) Subject: usb: s3c-otg: Fix short packet for request size > ep.maxpacket X-Git-Tag: v2016.05-rc3~27^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=842769ea51d849fee3f6c03939cabd3971e75cfd;p=platform%2Fkernel%2Fu-boot.git usb: s3c-otg: Fix short packet for request size > ep.maxpacket Request size can be greater than ep.packet and still end in a short packet. We need to tackle this case as end of transfer (if short_not_ok is not set) as indicated in USB 2.0 Specification [1], else we get stuck up on certain protocols like fastboot. [1] - USB2.0 Specification, Section 5.3.2 Pipes Reported-by: Steve Rae Signed-off-by: Roger Quadros Tested-by: Steve Rae Tested-by: Lukasz Majewski --- diff --git a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c index bce9c30..9aa0f33 100644 --- a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c +++ b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c @@ -229,7 +229,7 @@ static void complete_rx(struct dwc2_udc *dev, u8 ep_num) ROUND(xfer_size, CONFIG_SYS_CACHELINE_SIZE)); req->req.actual += min(xfer_size, req->req.length - req->req.actual); - is_short = (xfer_size < ep->ep.maxpacket); + is_short = !!(xfer_size % ep->ep.maxpacket); debug_cond(DEBUG_OUT_EP != 0, "%s: RX DMA done : ep = %d, rx bytes = %d/%d, "