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

Commit 33f65b9a authored by Mayank Rana's avatar Mayank Rana Committed by Hemant Kumar
Browse files

usb: phy: snps: Enable auto resume during host mode suspend



Auto resume feature will keep dp/dm lines in resume state till SW has
chance to turn on clocks and handle line-state interrupt and drive
resume signaling. usb2 host needs to hold the resume signal after
device initiates remote wakeup signaling which can be from 1ms to 15ms.
Auto resume will help to hold the dp/dm lines in resume state if device
drives remote wakeup for short duration (like 1ms) and expects host to
hold the state.

Change-Id: Ic80f067240c1540caa8822c072548d096ff17680
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent f05af998
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
#define VBUSVLDEXT0				BIT(0)

#define USB2_PHY_USB_PHY_HS_PHY_CTRL2		(0x64)
#define USB2_AUTO_RESUME			BIT(0)
#define USB2_SUSPEND_N				BIT(2)
#define USB2_SUSPEND_N_SEL			BIT(3)

@@ -441,6 +442,15 @@ static int msm_hsphy_set_suspend(struct usb_phy *uphy, int suspend)
	if (suspend) { /* Bus suspend */
		if (phy->cable_connected ||
			(phy->phy.flags & PHY_HOST_MODE)) {
			/* Enable auto-resume functionality by pulsing signal */
			msm_usb_write_readback(phy->base,
				USB2_PHY_USB_PHY_HS_PHY_CTRL2,
				USB2_AUTO_RESUME, USB2_AUTO_RESUME);
			usleep_range(500, 1000);
			msm_usb_write_readback(phy->base,
				USB2_PHY_USB_PHY_HS_PHY_CTRL2,
				USB2_AUTO_RESUME, 0);

			msm_hsphy_enable_clocks(phy, false);
		} else {/* Cable disconnect */
			mutex_lock(&phy->phy_lock);