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

Commit d1119d2d authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: dwc3: Restart USB if SETUP packet is completed before conndone"

parents 68c2d0f3 9dfd0a6f
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -935,6 +935,19 @@ static void dwc3_ep0_inspect_setup(struct dwc3 *dwc,
	if (!dwc->gadget_driver)
		goto out;

	/*
	 * A SETUP packet from previous session might get completed with delay
	 * and get inspected before ConnectDone event for the new connection is
	 * fired. This leads to controller not responding to fresh SETUP packets
	 * anymore, even after fresh RESET from host.
	 * Restart USB gadget if such delayed SETUP packet is inspected.
	 */
	if (!dwc->connected) {
		dbg_event(0x0, "Setup_restart", 0);
		dwc3_notify_event(dwc, DWC3_CONTROLLER_RESTART_USB_SESSION, 0);
		return;
	}

	trace_dwc3_ctrl_req(ctrl);

	len = le16_to_cpu(ctrl->wLength);
+3 −2
Original line number Diff line number Diff line
@@ -2152,6 +2152,7 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend)

		dwc->err_evt_seen = false;
		dwc->pullups_connected = false;
		dwc->connected = false;

		__dwc3_gadget_ep_disable(dwc->eps[0]);
		__dwc3_gadget_ep_disable(dwc->eps[1]);
@@ -3261,8 +3262,6 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)

	usb_phy_start_link_training(dwc->usb3_phy);

	dwc->connected = true;

	/*
	 * WORKAROUND: DWC3 revisions <1.88a have an issue which
	 * would cause a missing Disconnect Event if there's a
@@ -3450,6 +3449,8 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
		dwc3_writel(dwc->regs, DWC3_DCTL, reg);
	}

	dwc->connected = true;

	dep = dwc->eps[0];
	ret = __dwc3_gadget_ep_enable(dep, true, false);
	if (ret) {