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

Commit 8c2f0b9b authored by Hemant Kumar's avatar Hemant Kumar
Browse files

USB: dwc3: Fix issues in ISOC endpoint handling



If the interval for which the requests are
intended is already expired, START TRANSFER fails.
Handle this by issuing ENDXFER command and wait
for the XFERNOTREADY event to try once again.

Change-Id: I05fb3564d02528d9c952c789ec7a1b39b0bcedff
Signed-off-by: default avatarSriharsha Allenki <sallenki@codeaurora.org>
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent 9e2c041e
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -1355,7 +1355,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep)
static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep)
{
	struct dwc3_gadget_ep_cmd_params params;
	struct dwc3_request		*req;
	struct dwc3_request		*req, *req1, *n;
	struct dwc3			*dwc = dep->dwc;
	int				starting;
	int				ret;
@@ -1390,6 +1390,30 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep)

	ret = dwc3_send_gadget_ep_cmd(dep, cmd, &params);
	if (ret < 0) {
		if ((ret == -EAGAIN) && starting &&
				usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
			dbg_event(dep->number, "CMD_STS", ret);
			/* If bit13 in Command complete event is set, software
			 * must issue ENDTRANDFER command and wait for
			 * Xfernotready event to queue the requests again.
			 */
			if (!dep->resource_index) {
				dwc3_gadget_ep_get_transfer_index(dep);
				WARN_ON_ONCE(!dep->resource_index);
			}
			dwc3_stop_active_transfer(dwc, dep->number, true);

			list_for_each_entry_safe_reverse(req1, n,
						&dep->started_list, list) {
				req1->trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
				req1->trb = NULL;
				dwc3_gadget_move_pending_list_front(req1);
				dwc3_ep_inc_deq(dep);
			}

			return ret;
		}

		/*
		 * FIXME we need to iterate over the list of requests
		 * here and stop, unmap, free and del each of the linked
+8 −0
Original line number Diff line number Diff line
@@ -81,6 +81,14 @@ static inline void dwc3_gadget_move_started_request(struct dwc3_request *req)
	list_move_tail(&req->list, &dep->started_list);
}

static inline void dwc3_gadget_move_pending_list_front(struct dwc3_request *req)
{
	struct dwc3_ep		*dep = req->dep;

	req->started = false;
	list_move(&req->list, &dep->pending_list);
}

static inline enum dwc3_link_state dwc3_get_link_state(struct dwc3 *dwc)
{
	u32 reg;