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

Commit 0b74edbd authored by Azhar Shaikh's avatar Azhar Shaikh
Browse files

usb: ehci-msm2: Support for suspend/resume of QUSB2 PHY



Add support to suspend/resume QUSB2 PHY.

Change-Id: If0d0ffc648d963cb1a71f198cec48e591b47f603
Signed-off-by: default avatarAzhar Shaikh <azhars@codeaurora.org>
parent bd92c12e
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -757,6 +757,9 @@ static int msm_ehci_suspend(struct msm_hcd *mhcd)
		}
	}

	/* Suspend QUSB2 PHY */
	usb_phy_set_suspend(hcd->phy, 1);

	/*
	 * PHY has capability to generate interrupt asynchronously in low
	 * power mode (LPM). This interrupt is level triggered. So USB IRQ
@@ -873,6 +876,9 @@ static int msm_ehci_resume(struct msm_hcd *mhcd)
	temp &= ~ULPI_STP_CTRL;
	writel_relaxed(temp, USB_USBCMD);

	/* Resume QUSB2 PHY */
	usb_phy_set_suspend(hcd->phy, 0);

	if (!(readl_relaxed(USB_PORTSC) & PORTSC_PHCD))
		goto skip_phy_resume;

@@ -1523,12 +1529,15 @@ static int ehci_msm2_probe(struct platform_device *pdev)
		hcd->phy = NULL;
	}

	if (hcd->phy)
	if (hcd->phy) {
		usb_phy_init(hcd->phy);
	else if (pdata && pdata->use_sec_phy)
		/* Set Host mode flag */
		hcd->phy->flags |= PHY_HOST_MODE;
	} else if (pdata && pdata->use_sec_phy) {
		mhcd->usb_phy_ctrl_reg = USB_PHY_CTRL2;
	else
	} else {
		mhcd->usb_phy_ctrl_reg = USB_PHY_CTRL;
	}

	ret = msm_hsusb_reset(mhcd);
	if (ret) {
@@ -1676,8 +1685,11 @@ static int ehci_msm2_remove(struct platform_device *pdev)

	usb_remove_hcd(hcd);

	if (hcd->phy)
	if (hcd->phy) {
		/* Clear host mode flag */
		hcd->phy->flags &= ~PHY_HOST_MODE;
		usb_phy_shutdown(hcd->phy);
	}

	if (mhcd->xo_clk) {
		clk_disable_unprepare(mhcd->xo_clk);