usb: dwc3: gadget: fix bug of clac_trbs_left at isoc in transfer

This patch clear the HWO bit in trb_ctrl by software when requests
are moved to queued list.

There are some cases which can lead to missed isoc event in dwc3
endpoint interrupt. For example, in uac+uvc mode, if PC start to
playpack audio or open uvc preview while captureing audio, a lot of
control transfer will bring missed isoc event and we will unmap all
request in started list and move them to queued list. Without this
patch, the number of trbs left will be incorrectle calculated as 0
and no trbs will be prepared at next transfer.

Signed-off-by: Ren Jianing <jianing.ren@rock-chips.com>
Change-Id: Idca5cd10f291962a480fc7e01e2186beaae2efb9
This commit is contained in:
Ren Jianing
2020-08-11 18:25:23 +08:00
committed by Tao Huang
parent 6d3bead414
commit 05c86e9eef

View File

@@ -74,7 +74,14 @@ static inline struct dwc3_request *next_request(struct list_head *list)
static inline void dwc3_gadget_move_queued_request(struct dwc3_request *req) static inline void dwc3_gadget_move_queued_request(struct dwc3_request *req)
{ {
struct dwc3_ep *dep = req->dep; struct dwc3_ep *dep = req->dep;
struct dwc3_trb *trb;
u8 tmp = dep->trb_enqueue;
if (!tmp)
tmp = DWC3_TRB_NUM - 1;
trb = &dep->trb_pool[tmp - 1];
trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
req->status = DWC3_REQUEST_STATUS_QUEUED; req->status = DWC3_REQUEST_STATUS_QUEUED;
list_move_tail(&req->list, &dep->pending_list); list_move_tail(&req->list, &dep->pending_list);
} }