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

Commit 0d5efd7a authored by Mayank Rana's avatar Mayank Rana
Browse files

dwc3: Add required support to get lfps_rxterm interrupt from SS_PHY



lfps_rxterm interrupt is not seen on attaching USB super speed device when
USB is into LPM with USB host mode without device attach case. This change
fixes below issues to get lfps_rxterm interrupt to resume USB.
1. Correct polarity of lfps rxterm interrupt from edge trigger to level
trigger
2. Notify USB SS PHY driver about USB host cable status to allow required
configuration while USB SS PHY is being suspended.
3. Also it is required to clear ALFPS_DTCT_EN and set ARCVR_DTCT_EVENT_SEL
when USB SS PHY is being suspended with host cable connected case to detect
next super speed device attach condition using lfps_rxterm interrupt.

Change-Id: Ia763ec6b742ca681e71454d29f866009add56c52
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 7529b53b
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -3008,8 +3008,9 @@ static int dwc3_msm_probe(struct platform_device *pdev)
		ret = devm_request_threaded_irq(&pdev->dev, mdwc->ss_phy_irq,
					msm_dwc3_pwr_irq,
					msm_dwc3_pwr_irq_thread,
					IRQF_TRIGGER_RISING | IRQF_EARLY_RESUME
					| IRQF_ONESHOT, "ss_phy_irq", mdwc);
					IRQF_TRIGGER_HIGH | IRQ_TYPE_LEVEL_HIGH
					| IRQF_EARLY_RESUME | IRQF_ONESHOT,
					"ss_phy_irq", mdwc);
		if (ret) {
			dev_err(&pdev->dev, "irqreq ss_phy_irq failed: %d\n",
					ret);
@@ -3519,13 +3520,16 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)
		dev_dbg(mdwc->dev, "%s: turn on host\n", __func__);

		mdwc->hs_phy->flags |= PHY_HOST_MODE;
		if (dwc->maximum_speed == USB_SPEED_SUPER)
		if (dwc->maximum_speed == USB_SPEED_SUPER) {
			mdwc->ss_phy->flags |= PHY_HOST_MODE;
			usb_phy_notify_connect(mdwc->ss_phy,
						USB_SPEED_SUPER);
		}

		usb_phy_notify_connect(mdwc->hs_phy, USB_SPEED_HIGH);
		pm_runtime_get_sync(mdwc->dev);
		dbg_event(0xFF, "StrtHost gync",
			atomic_read(&mdwc->dev->power.usage_count));
		usb_phy_notify_connect(mdwc->hs_phy, USB_SPEED_HIGH);
		if (!IS_ERR(mdwc->vbus_reg))
			ret = regulator_enable(mdwc->vbus_reg);
		if (ret) {
@@ -3614,8 +3618,13 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)
		dbg_event(0xFF, "StopHost gsync",
			atomic_read(&mdwc->dev->power.usage_count));
		usb_phy_notify_disconnect(mdwc->hs_phy, USB_SPEED_HIGH);
		mdwc->hs_phy->flags &= ~PHY_HOST_MODE;
		if (mdwc->ss_phy->flags & PHY_HOST_MODE) {
			usb_phy_notify_disconnect(mdwc->ss_phy,
					USB_SPEED_SUPER);
			mdwc->ss_phy->flags &= ~PHY_HOST_MODE;
		}

		mdwc->hs_phy->flags &= ~PHY_HOST_MODE;
		platform_device_del(dwc->xhci);
		usb_unregister_notify(&mdwc->host_nb);

+6 −4
Original line number Diff line number Diff line
@@ -201,14 +201,16 @@ static void msm_ssusb_qmp_enable_autonomous(struct msm_ssphy_qmp *phy,

	if (enable) {
		msm_ssusb_qmp_clr_lfps_rxterm_int(phy);
		if (phy->phy.flags & DEVICE_IN_SS_MODE) {
			val =
			readb_relaxed(phy->base + autonomous_mode_offset);
		val = readb_relaxed(phy->base + autonomous_mode_offset);
		val |= ARCVR_DTCT_EN;
		if (phy->phy.flags & DEVICE_IN_SS_MODE) {
			val |= ALFPS_DTCT_EN;
			val &= ~ARCVR_DTCT_EVENT_SEL;
			writeb_relaxed(val, phy->base + autonomous_mode_offset);
		} else {
			val &= ~ALFPS_DTCT_EN;
			val |= ARCVR_DTCT_EVENT_SEL;
		}
		writeb_relaxed(val, phy->base + autonomous_mode_offset);
		msm_ssusb_qmp_clamp_enable(phy, true);
	} else {
		msm_ssusb_qmp_clamp_enable(phy, false);