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

Commit 3e7dcb50 authored by Hemant Kumar's avatar Hemant Kumar
Browse files

usb: phy-msm-susb-qmp: power down phy upon disconnect notification



USB type-C compliance test 4.5.6(DRP Connect Try.SNK DRP) is failing
because super speed communication(link layer) does not stop upon
moving from Attached.SRC to Unattached.SNK state. This happens because
in Attached.SRC state hub driver performs re-tries to enumerate the
device(exerciser) and upon failure resets the bus. As a result in the
middle of re-tries when cc line gets disconnected, unloading XHCI stack
takes longer to finish and auto suspend kicks in afterwards to initiate
mdwc runtime suspend which powers down ss phy. Hence power down ss phy as
soon as phy disconnect notification comes which happens before XHCI driver
is unloaded.

Change-Id: I83578fb09564f56df2746870c6e39ab86547448d
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent c70d827b
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -623,10 +623,7 @@ static int msm_ssphy_qmp_set_suspend(struct usb_phy *uphy, int suspend)
	}

	if (suspend) {
		if (!phy->cable_connected)
			writel_relaxed(0x00,
			phy->base + phy->phy_reg[USB3_PHY_POWER_DOWN_CONTROL]);
		else
		if (phy->cable_connected)
			msm_ssusb_qmp_enable_autonomous(phy, 1);

		/* Make sure above write completed with PHY */
@@ -674,6 +671,10 @@ static int msm_ssphy_qmp_notify_disconnect(struct usb_phy *uphy,
	struct msm_ssphy_qmp *phy = container_of(uphy, struct msm_ssphy_qmp,
					phy);

	writel_relaxed(0x00,
		phy->base + phy->phy_reg[USB3_PHY_POWER_DOWN_CONTROL]);
	readl_relaxed(phy->base + phy->phy_reg[USB3_PHY_POWER_DOWN_CONTROL]);

	dev_dbg(uphy->dev, "QMP phy disconnect notification\n");
	dev_dbg(uphy->dev, " cable_connected=%d\n", phy->cable_connected);
	phy->cable_connected = false;