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

Commit a40b143a authored by Mayank Rana's avatar Mayank Rana Committed by Matt Wagantall
Browse files

usb: dwc3: Add error print messages



There is a possible race that arises when gadget events are processed
before the resume routine has disabled the USB2 PHY autosuspend. Some
of the gadget events issue endpoint commands which may time out since
the PHY is still autosuspended. Add error messages to help debug
these failurs.

Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 1957bbd3
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -373,8 +373,12 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep,
		 * interrupt context.
		 */
		timeout--;
		if (!timeout)
		if (!timeout) {
			dev_err(dwc->dev, "%s command timeout for %s\n",
				dwc3_gadget_ep_cmd_string(cmd), dep->name);
			WARN_ON_ONCE(1);
			return -ETIMEDOUT;
		}

		udelay(1);
	} while (1);
@@ -538,22 +542,30 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep,

	if (!(dep->flags & DWC3_EP_ENABLED)) {
		ret = dwc3_gadget_start_config(dwc, dep);
		if (ret)
		if (ret) {
			dev_err(dwc->dev, "start_config() failed for %s\n",
								dep->name);
			return ret;
		}
	}

	ret = dwc3_gadget_set_ep_config(dwc, dep, desc, comp_desc, ignore,
			restore);
	if (ret)
	if (ret) {
		dev_err(dwc->dev, "set_ep_config() failed for %s\n", dep->name);
		return ret;
	}

	if (!(dep->flags & DWC3_EP_ENABLED)) {
		struct dwc3_trb	*trb_st_hw;
		struct dwc3_trb	*trb_link;

		ret = dwc3_gadget_set_xfer_resource(dwc, dep);
		if (ret)
		if (ret) {
			dev_err(dwc->dev, "set_xfer_resource() failed for %s\n",
								dep->name);
			return ret;
		}

		dep->endpoint.desc = desc;
		dep->comp_desc = comp_desc;