FAILED: patch "[PATCH] usb: dwc3: gadget: Handle ZLP for sg requests" failed to apply to 5.4-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From bc9a2e226ea95e1699f7590845554de095308b75 Mon Sep 17 00:00:00 2001
From: Thinh Nguyen <[email protected]>
Date: Thu, 6 Aug 2020 19:46:35 -0700
Subject: [PATCH] usb: dwc3: gadget: Handle ZLP for sg requests
Currently dwc3 doesn't handle usb_request->zero for SG requests. This change checks and prepares extra TRBs for the ZLP for SG requests.
Cc <[email protected]> # v4.5+
Fixes 04c03d10e507 ("usb: dwc3: gadget: handle request->zero")
Signed-off-by Thinh Nguyen <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>
drivers/usb/dwc3/gadget.c +31 -0
@@ -1143,6 +1143,37 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep, req->request.short_not_ok, req->request.no_interrupt, req->request.is_last); + }else if (req->request.zero && req->request.length && + !usb_endpoint_xfer_isoc (dep->endpoint.desc) && + !rem && !chain) { +struct dwc3 *dwc = dep->dwc; +struct dwc3_trb *trb; + + req->needs_extra_trb = true; + +/* Prepare normal TRB */ +dwc3_prepare_one_trb (dep, req, trb_length, true, i); + +/* Prepare one extra TRB to handle ZLP */ + trb = &dep->trb_pool[dep->trb_enqueue]; + req->num_trbs++; +__dwc3_prepare_one_trb (dep, trb, dwc->bounce_addr,0 , + !req->direction,1 , + req->request.stream_id, + req->request.short_not_ok, + req->request.no_interrupt, + req->request.is_last); + +/* Prepare one more TRB to handle MPS alignment */ +if (!req->direction) { + trb = &dep->trb_pool[dep->trb_enqueue]; + req->num_trbs++; +__dwc3_prepare_one_trb (dep, trb, dwc->bounce_addr, maxp, + false,1 , req->request.stream_id, + req->request.short_not_ok, + req->request.no_interrupt, + req->request.is_last); + } }else {dwc3_prepare_one_trb (dep, req, trb_length, chain, i); }