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

Commit 6f536528 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa Committed by Gerrit - the friendly Code Review server
Browse files

USB: dwc3-msm: Disable DBM endpoint in msm_ep_unconfig if no req queued



There is a chance that error might occur in connect_work before
endless request is queued to USB controller and bails out. In this case,
DBM endpoint will not be disabled and results in setendpoint config
command timeouts after next connect and could cause usb endpoint enable
fails. Fix this by disabling DBM endpoint corresponding to USB endpoint
in msm_ep_unconfig() if there are no requests queued to USB endpoint.

Change-Id: I5601d76c58263150a3ad5b026a8f2b10da087ba5
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: default avatarChandana Kishori Chiluveru <cchiluve@codeaurora.org>
Signed-off-by: default avatarSriharsha Allenki <sallenki@codeaurora.org>
parent 0f83836c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ static int find_matching_dbm_ep(struct dbm *dbm, u8 usb_ep)
		if (dbm->ep_num_mapping[i] == usb_ep)
			return i;

	pr_err("%s: No DBM EP matches USB EP %d", __func__, usb_ep);
	pr_debug("%s: No DBM EP matches USB EP %d", __func__, usb_ep);
	return -ENODEV; /* Not found */
}

@@ -378,7 +378,7 @@ int dbm_ep_unconfig(struct dbm *dbm, u8 usb_ep)
	dbm_ep = find_matching_dbm_ep(dbm, usb_ep);

	if (dbm_ep < 0) {
		pr_err("usb ep index %d has no corresponding dbm ep\n", usb_ep);
		pr_debug("usb ep index %d has no corespondng dbm ep\n", usb_ep);
		return -ENODEV;
	}

+22 −0
Original line number Diff line number Diff line
@@ -1549,6 +1549,28 @@ int msm_ep_unconfig(struct usb_ep *ep)
	 * Do HERE more usb endpoint un-configurations
	 * which are specific to MSM.
	 */
	if (!mdwc->dbm || (dep->endpoint.ep_type == EP_TYPE_GSI))
		return 0;

	if (dep->trb_dequeue == dep->trb_enqueue
					&& list_empty(&dep->pending_list)
					&& list_empty(&dep->started_list)) {
		dev_dbg(mdwc->dev,
			"%s: request is not queued, disable DBM ep for ep %s\n",
			__func__, ep->name);
		/* Unconfigure dbm ep */
		dbm_ep_unconfig(mdwc->dbm, dep->number);

		/*
		 * If this is the last endpoint we unconfigured, than reset also
		 * the event buffers; unless unconfiguring the ep due to lpm,
		 * in which case the event buffer only gets reset during the
		 * block reset.
		 */
		if (dbm_get_num_of_eps_configured(mdwc->dbm) == 0 &&
				!dbm_reset_ep_after_lpm(mdwc->dbm))
			dbm_event_buffer_config(mdwc->dbm, 0, 0, 0);
	}

	return 0;
}