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

Commit cd3de4a5 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

USB: ehci-msm2: Put data lines into nondriving mode before PHY lpm



On some platforms, 2nd host controller is used to connect UICC card and
it applies pull down resistors on data lines. UICC card is full speed
ICUSB peripheral, which doesn't expect pull down resistor applied on
data lines by host. Hence put datalines in non driving mode during bus
suspend before putting PHY in low power mode so that pull downs will
be removed to save power.

Change-Id: I2df57a082fa47156ab8d8675828a5dfa8a1c35d0
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent 90f1b5b9
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -707,6 +707,8 @@ static int msm_ehci_suspend(struct msm_hcd *mhcd)
	struct usb_hcd *hcd = mhcd_to_hcd(mhcd);
	unsigned long timeout;
	u32 portsc;
	const struct msm_usb_host_platform_data *pdata;
	u32 func_ctrl;

	if (atomic_read(&mhcd->in_lpm)) {
		dev_dbg(mhcd->dev, "%s called in lpm\n", __func__);
@@ -723,6 +725,14 @@ static int msm_ehci_suspend(struct msm_hcd *mhcd)
		return -EBUSY;
	}

	pdata = mhcd->dev->platform_data;
	if (pdata && pdata->is_uicc) {
		/* put the controller in non-driving mode */
		func_ctrl = msm_ulpi_read(mhcd, ULPI_FUNC_CTRL);
		func_ctrl &= ~ULPI_FUNC_CTRL_OPMODE_MASK;
		func_ctrl |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING;
		msm_ulpi_write(mhcd, func_ctrl, ULPI_FUNC_CTRL);
	}
	/* If port is enabled wait 5ms for PHCD to come up. Reset PHY
	 * and link if it fails to do so.
	 * If port is not enabled set the PHCD bit and poll for it to
@@ -821,6 +831,8 @@ static int msm_ehci_resume(struct msm_hcd *mhcd)
	unsigned long timeout;
	unsigned temp;
	unsigned long flags;
	u32 func_ctrl;
	const struct msm_usb_host_platform_data *pdata;

	if (!atomic_read(&mhcd->in_lpm)) {
		dev_dbg(mhcd->dev, "%s called in !in_lpm\n", __func__);
@@ -887,6 +899,14 @@ static int msm_ehci_resume(struct msm_hcd *mhcd)
	}

skip_phy_resume:
	pdata = mhcd->dev->platform_data;
	if (pdata && pdata->is_uicc) {
		/* put the controller in normal mode */
		func_ctrl = msm_ulpi_read(mhcd, ULPI_FUNC_CTRL);
		func_ctrl &= ~ULPI_FUNC_CTRL_OPMODE_MASK;
		func_ctrl |= ULPI_FUNC_CTRL_OPMODE_NORMAL;
		msm_ulpi_write(mhcd, func_ctrl, ULPI_FUNC_CTRL);
	}

	set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
	usb_hcd_resume_root_hub(hcd);