summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorFabian Vogt <fabian@ritter-vogt.de>2021-03-24 17:11:15 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-26 16:43:47 +0300
commit75bb93be0027123b5db6cbcce89eb62f0f6b3c5b (patch)
treeb46f57f4692caa93e52678e8d2d8ea0cc0989405 /drivers/usb/gadget
parent3e7c2510bdfe89a9ec223dd7acd6bfc8bb1cbeb6 (diff)
downloadlinux-75bb93be0027123b5db6cbcce89eb62f0f6b3c5b.tar.xz
fotg210-udc: Complete OUT requests on short packets
A short packet indicates the end of a transfer and marks the request as complete. Fixes: b84a8dee23fd ("usb: gadget: add Faraday fotg210_udc driver") Signed-off-by: Fabian Vogt <fabian@ritter-vogt.de> Link: https://lore.kernel.org/r/20210324141115.9384-8-fabian@ritter-vogt.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/udc/fotg210-udc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c
index e4036a689adb..fdca28e72a3b 100644
--- a/drivers/usb/gadget/udc/fotg210-udc.c
+++ b/drivers/usb/gadget/udc/fotg210-udc.c
@@ -849,12 +849,16 @@ static void fotg210_out_fifo_handler(struct fotg210_ep *ep)
{
struct fotg210_request *req = list_entry(ep->queue.next,
struct fotg210_request, queue);
+ int disgr1 = ioread32(ep->fotg210->reg + FOTG210_DISGR1);
fotg210_start_dma(ep, req);
- /* finish out transfer */
+ /* Complete the request when it's full or a short packet arrived.
+ * Like other drivers, short_not_ok isn't handled.
+ */
+
if (req->req.length == req->req.actual ||
- req->req.actual < ep->ep.maxpacket)
+ (disgr1 & DISGR1_SPK_INT(ep->epnum - 1)))
fotg210_done(ep, req, 0);
}