mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
usb: dwc3: gadget: fix OUT eps buffer size alignment issue
Per dwc3 databook "Buffer Size Rules and Zero-Length Packets", dwc3 needs buffer size to be aligned to MaxPacketSize on ep out. Change-Id: Iff0e9c29c02c09b93bb34fed178051c02221ecc7 Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
This commit is contained in:
committed by
Huang, Tao
parent
f9f19c1066
commit
bb6cd1d5aa
@@ -1010,6 +1010,17 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
|
||||
|
||||
trace_dwc3_ep_queue(req);
|
||||
|
||||
/*
|
||||
* Per databook, the total size of buffer must be a multiple
|
||||
* of MaxPacketSize for OUT endpoints. And MaxPacketSize is
|
||||
* configed for endpoints in dwc3_gadget_set_ep_config(),
|
||||
* set to usb_endpoint_descriptor->wMaxPacketSize.
|
||||
*/
|
||||
if (dep->direction == 0 &&
|
||||
req->request.length % dep->endpoint.desc->wMaxPacketSize)
|
||||
req->request.length = roundup(req->request.length,
|
||||
dep->endpoint.desc->wMaxPacketSize);
|
||||
|
||||
/*
|
||||
* We only add to our list of requests now and
|
||||
* start consuming the list once we get XferNotReady
|
||||
@@ -1156,7 +1167,7 @@ static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
|
||||
* any other request.
|
||||
*/
|
||||
if (ret == 0 && request->zero && request->length &&
|
||||
(request->length % ep->maxpacket == 0))
|
||||
(request->length % ep->desc->wMaxPacketSize == 0))
|
||||
ret = __dwc3_gadget_ep_queue_zlp(dwc, dep);
|
||||
|
||||
spin_unlock_irqrestore(&dwc->lock, flags);
|
||||
|
||||
Reference in New Issue
Block a user