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

Commit 629cc650 authored by Hemant Kumar's avatar Hemant Kumar Committed by Vijayavardhan Vennapusa
Browse files

usb: dwc3: restart usb upon endpoint cmd timeout



Sometime endpoint command timeout happening after
usb device enumeration. Controller stops responding to
any endpoint commands afterwards. To recover from this
condition restart usb by simulating vbus off and on
except for end transfer command. Also increase the
command timeout from 1500us to 3000us.

Change-Id: I7c1833d844fd432b33158686361e24e66a2fd92c
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent 3f08a569
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -975,6 +975,7 @@ struct dwc3 {
	int			irq;
	struct tasklet_struct	bh;
	unsigned long		irq_cnt;
	unsigned long		ep_cmd_timeout_cnt;
	unsigned                bh_completion_time[MAX_INTR_STATS];
	unsigned                bh_handled_evt_cnt[MAX_INTR_STATS];
	unsigned                bh_dbg_index;
+1 −1
Original line number Diff line number Diff line
@@ -1799,7 +1799,7 @@ static void dwc3_msm_notify_event(struct dwc3 *dwc, unsigned event,
		break;
	case DWC3_CONTROLLER_RESTART_USB_SESSION:
		dev_dbg(mdwc->dev, "DWC3_CONTROLLER_RESTART_USB_SESSION received\n");
		dwc3_restart_usb_work(&mdwc->restart_usb_work);
		schedule_work(&mdwc->restart_usb_work);
		break;
	case DWC3_CONTROLLER_NOTIFY_DISABLE_UPDXFER:
		dwc3_msm_dbm_disable_updxfer(dwc, value);
+6 −1
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep,
		unsigned cmd, struct dwc3_gadget_ep_cmd_params *params)
{
	struct dwc3_ep		*dep = dwc->eps[ep];
	u32			timeout = 1500;
	u32			timeout = 3000;
	u32			reg;

	trace_dwc3_gadget_ep_cmd(dep, cmd, params);
@@ -381,6 +381,11 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep,
		if (!timeout) {
			dev_err(dwc->dev, "%s command timeout for %s\n",
				dwc3_gadget_ep_cmd_string(cmd), dep->name);
			if (!(cmd & DWC3_DEPCMD_ENDTRANSFER)) {
				dwc->ep_cmd_timeout_cnt++;
				dwc3_notify_event(dwc,
					DWC3_CONTROLLER_RESTART_USB_SESSION, 0);
			}
			return -ETIMEDOUT;
		}