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

Commit 8be3261b authored by Mayank Rana's avatar Mayank Rana
Browse files

usb: phy: hsusb: Correct sequence of putting hsusb phy into retention



On few platform there is different programming sequence is being
suggested to put HSUSB phy into retention. Also it is required to use
different set of registers for it. This change implements the same.

CRs-Fixed: 625668
Change-Id: I0a78737f93e0543f30b0278bb3869fb21f3e0b7e
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 47d53bf2
Loading
Loading
Loading
Loading
+35 −14
Original line number Diff line number Diff line
@@ -347,20 +347,35 @@ static int msm_hsphy_set_suspend(struct usb_phy *uphy, int suspend)
			 * OTGDISABLE0=1
			 * USB2_SUSPEND_N_SEL=1, USB2_SUSPEND_N=0
			 */
			if (phy->core_ver >= MSM_CORE_VER_120)
				msm_usb_write_readback(phy->base,
						HS_PHY_CTRL_COMMON_REG,
						COMMON_OTGDISABLE0,
						COMMON_OTGDISABLE0);
			else
				msm_usb_write_readback(phy->base,
						HS_PHY_CTRL_REG,
						OTGDISABLE0, OTGDISABLE0);

			msm_usb_write_readback(phy->base, HS_PHY_CTRL_REG,
					(OTGDISABLE0 | USB2_SUSPEND_N_SEL |
					 USB2_SUSPEND_N),
					(OTGDISABLE0 | USB2_SUSPEND_N_SEL));
					(USB2_SUSPEND_N_SEL | USB2_SUSPEND_N),
					USB2_SUSPEND_N_SEL);
			/*
			 * Enable PHY retention
			 * RETENABLEN bit is not available on few platforms.
			 */
			if (!chg_connected && !phy->set_pllbtune)
				/* Enable PHY retention */
			if (!chg_connected) {
				if (phy->set_pllbtune)
					msm_usb_write_readback(phy->base,
						HS_PHY_CTRL_COMMON_REG,
						COMMON_PLLITUNE_1,
						COMMON_PLLITUNE_1);
				else
					msm_usb_write_readback(phy->base,
						HS_PHY_CTRL_REG,
						RETENABLEN, 0);
			}
		}

		if (!phy->ext_vbus_id)
			/* Enable PHY-based IDHV and OTGSESSVLD HV interrupts */
@@ -412,22 +427,28 @@ static int msm_hsphy_set_suspend(struct usb_phy *uphy, int suspend)
							DPDMHV_INT_MASK, 0);
		} else {
			/* Disable PHY retention */
			if (phy->set_pllbtune) {
			if (phy->set_pllbtune)
				msm_usb_write_readback(phy->base,
						HS_PHY_CTRL_COMMON_REG,
						COMMON_PLLITUNE_1, 0);
			} else {
			else
				msm_usb_write_readback(phy->base,
						HS_PHY_CTRL_REG,
						RETENABLEN, RETENABLEN);
			}

			/* Bring PHY out of suspend */
			msm_usb_write_readback(phy->base, HS_PHY_CTRL_REG,
						(OTGDISABLE0 |
						 USB2_SUSPEND_N_SEL |
						 USB2_SUSPEND_N),
				(USB2_SUSPEND_N_SEL | USB2_SUSPEND_N), 0);

			if (phy->core_ver >= MSM_CORE_VER_120)
				msm_usb_write_readback(phy->base,
						HS_PHY_CTRL_COMMON_REG,
						COMMON_OTGDISABLE0,
						0);
			else
				msm_usb_write_readback(phy->base,
						HS_PHY_CTRL_REG,
						OTGDISABLE0, 0);
		}
	}