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

Commit b2a4b92a authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: dwc3: Clear USB2PHY_SUSP bit during disconnect"

parents 9f24384d e1e8f22e
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1897,8 +1897,12 @@ static int dwc3_msm_power_set_property_usb(struct power_supply *psy,
		if (mdwc->otg_xceiv && !mdwc->ext_inuse &&
		    (mdwc->ext_xceiv.otg_capability || !init)) {
			mdwc->ext_xceiv.bsv = val->intval;
			/*
			 * Set debouncing delay to 120ms. Otherwise battery
			 * charging CDP complaince test fails if delay > 120ms.
			 */
			queue_delayed_work(system_nrt_wq,
							&mdwc->resume_work, 20);
							&mdwc->resume_work, 12);

			if (!init)
				init = true;
+17 −0
Original line number Diff line number Diff line
@@ -96,6 +96,19 @@ static int dwc3_otg_set_suspend(struct usb_phy *phy, int suspend)
	return 0;
}

static void dwc3_otg_set_hsphy_auto_suspend(struct dwc3_otg *dotg, bool susp)
{
	struct dwc3 *dwc = dotg->dwc;
	u32 reg;

	reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
	if (susp)
		reg |= DWC3_GUSB2PHYCFG_SUSPHY;
	else
		reg &= ~(DWC3_GUSB2PHYCFG_SUSPHY);
	dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
}

/**
 * dwc3_otg_set_host_power - Enable port power control for host operation
 *
@@ -197,6 +210,7 @@ static int dwc3_otg_start_host(struct usb_otg *otg, int on)
		 * remove_hcd, But we may not use standard set_host method
		 * anymore.
		 */
		dwc3_otg_set_hsphy_auto_suspend(dotg, true);
		dwc3_otg_set_host_regs(dotg);
		/*
		 * FIXME If micro A cable is disconnected during system suspend,
@@ -245,6 +259,7 @@ static int dwc3_otg_start_host(struct usb_otg *otg, int on)
						ext_xceiv->ext_block_reset)
			ext_xceiv->ext_block_reset(ext_xceiv, true);

		dwc3_otg_set_hsphy_auto_suspend(dotg, false);
		dwc3_otg_set_peripheral_regs(dotg);

		/* re-init core and OTG registers as block reset clears these */
@@ -315,6 +330,7 @@ static int dwc3_otg_start_peripheral(struct usb_otg *otg, int on)
						ext_xceiv->ext_block_reset)
			ext_xceiv->ext_block_reset(ext_xceiv, false);

		dwc3_otg_set_hsphy_auto_suspend(dotg, true);
		dwc3_otg_set_peripheral_regs(dotg);
		usb_gadget_vbus_connect(otg->gadget);
	} else {
@@ -323,6 +339,7 @@ static int dwc3_otg_start_peripheral(struct usb_otg *otg, int on)
		usb_gadget_vbus_disconnect(otg->gadget);
		usb_phy_notify_disconnect(dotg->dwc->usb2_phy, USB_SPEED_HIGH);
		usb_phy_notify_disconnect(dotg->dwc->usb3_phy, USB_SPEED_SUPER);
		dwc3_otg_set_hsphy_auto_suspend(dotg, false);
	}

	return 0;
+5 −1
Original line number Diff line number Diff line
@@ -3096,7 +3096,11 @@ int dwc3_gadget_init(struct dwc3 *dwc)

	/* Enable USB2 LPM and automatic phy suspend only on recent versions */
	if (dwc->revision >= DWC3_REVISION_194A) {
		dwc3_gadget_usb2_phy_suspend(dwc, true);
		/*
		 * Clear autosuspend bit in dwc3 register for USB2. It will be
		 * enabled before setting run/stop bit.
		 */
		dwc3_gadget_usb2_phy_suspend(dwc, false);
		dwc3_gadget_usb3_phy_suspend(dwc, true);
	}