From 9a3360e2f073a654cdacef067dcf56a75f48475d Mon Sep 17 00:00:00 2001 From: Elson Roy Serrao Date: Thu, 25 Feb 2021 18:39:55 -0800 Subject: [PATCH] usb: dwc3: Set number of TRBs to 1 for endless request When USB is disconnected we dont reset the num_trbs field of a request before giving it back to the respective function. When this request is re-used it will have an incorrect num_trb value. For f_qdss HW path we use 1 endless request and allocate 1 TRB to accommodate this request. This request is freed only during an USB composition switch. Doing an USB plug-out/plug-in during an active bam2bam session would result in erroneously incrementing the num_trbs value when the transfer is resumed. When this request is dequeued during a qdss_close we would increment dequeue pointer in accordance with this incorrect num_trbs value. This leads to dequeue pointer going beyond enqueue pointer and thus the subsequent ep_queue fails due to this mismatch. Fix this by always setting the num_trb field to 1 for requests going through qdss HW path. Change-Id: Ibddad6c8fdd67b42d12752ae3ead73d20110c290 Signed-off-by: Elson Roy Serrao --- drivers/usb/dwc3/dwc3-msm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index 4b6dbc9c0b6e..5b2a282379e3 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -975,7 +975,7 @@ static int __dwc3_msm_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) memset(trb, 0, sizeof(*trb)); req->trb = trb; - req->num_trbs++; + req->num_trbs = 1; trb->bph = DBM_TRB_BIT | DBM_TRB_DMA | DBM_TRB_EP_NUM(dep->number); trb->size = DWC3_TRB_SIZE_LENGTH(req->request.length); trb->ctrl = DWC3_TRBCTL_NORMAL | DWC3_TRB_CTRL_HWO |