Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89dd42bf authored by Pratham Pratap's avatar Pratham Pratap
Browse files

usb: dwc3: gadget: Add delay for EPCMDCMPLT



In some cases issuing end_transfer command as part
of remove requests to eps is taking around 2ms for
the endpoint command complete interrupt(EPCMDCMPLT).
And before EPCMDCMPLT interrupt driver has already
unmapped the request which controller may access leading
to SMMU fault. Fix this by adding delay before giving
back the requests to gadget driver.

Change-Id: Iba10f5337a43c5f7db702321f6dce3b5e1b1af44
Signed-off-by: default avatarPratham Pratap <prathampratap@codeaurora.org>
parent 1f946a61
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -805,6 +805,7 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action)

static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep)
{
	int retries = 40;
	struct dwc3_request		*req;

	dbg_log_string("START for %s(%d)", dep->name, dep->number);
@@ -824,6 +825,14 @@ static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep)
		dwc->eps[1]->trb_enqueue = 0;
	}

	do {
		udelay(50);
	} while ((dep->flags & DWC3_EP_END_TRANSFER_PENDING) && --retries);

	if (!retries)
		dbg_log_string("ep end_xfer cmd completion timeout for %d",
				dep->number);

	/* - giveback all requests to gadget driver */
	while (!list_empty(&dep->started_list)) {
		req = next_request(&dep->started_list);