mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-08 01:29:02 +00:00
usb: dwc3: gadget: Handle ZLP for sg requests
[ Upstream commitbc9a2e226e
] 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: <stable@vger.kernel.org> # v4.5+ Fixes:04c03d10e5
("usb: dwc3: gadget: handle request->zero") Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> Signed-off-by: Felipe Balbi <balbi@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
7012bf6d6c
commit
9c75144644
1 changed files with 29 additions and 0 deletions
|
@ -1104,6 +1104,35 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
|
||||||
req->request.stream_id,
|
req->request.stream_id,
|
||||||
req->request.short_not_ok,
|
req->request.short_not_ok,
|
||||||
req->request.no_interrupt);
|
req->request.no_interrupt);
|
||||||
|
} 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);
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dwc3_prepare_one_trb(dep, req, trb_length, chain, i);
|
dwc3_prepare_one_trb(dep, req, trb_length, chain, i);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue