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

Commit af15029b authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa Committed by Gerrit - the friendly Code Review server
Browse files

phy: msm: usb: Check VBUS state before accessing registers in suspend



Currently driver is checking for VBUS state after accessing register
in msm_otg_suspend() routine. In case of CDP, there will be race between
msm_otg_suspend() and driving DP pulse. This could cause accessing
register in msm_otg_suspend() while clocks are off as part of sequence
to drive pulse on D+ line and later it is checking for VBUS state high
to abort suspend sequence. Hence fix it by checking for VBUS state
before accessing registers in msm_otg_suspend().

Change-Id: I95ad5339b21647e3971908d15f2eabe0c6311800
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent dde84941
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -1473,17 +1473,6 @@ static int msm_otg_suspend(struct msm_otg *motg)
	if (motg->err_event_seen)
		msm_otg_reset(phy);

	/* Enable line state difference wakeup fix for only device and host
	 * bus suspend scenarios.  Otherwise PHY can not be suspended when
	 * a charger that pulls DP/DM high is connected.
	 */
	config2 = readl_relaxed(USB_GENCONFIG_2);
	if (device_bus_suspend)
		config2 |= GENCONFIG_2_LINESTATE_DIFF_WAKEUP_EN;
	else
		config2 &= ~GENCONFIG_2_LINESTATE_DIFF_WAKEUP_EN;
	writel_relaxed(config2, USB_GENCONFIG_2);

	/*
	 * Abort suspend when,
	 * 1. host mode activation in progress due to Micro-A cable insertion
@@ -1501,6 +1490,17 @@ static int msm_otg_suspend(struct msm_otg *motg)
		return -EBUSY;
	}

	/* Enable line state difference wakeup fix for only device and host
	 * bus suspend scenarios.  Otherwise PHY can not be suspended when
	 * a charger that pulls DP/DM high is connected.
	 */
	config2 = readl_relaxed(USB_GENCONFIG_2);
	if (device_bus_suspend)
		config2 |= GENCONFIG_2_LINESTATE_DIFF_WAKEUP_EN;
	else
		config2 &= ~GENCONFIG_2_LINESTATE_DIFF_WAKEUP_EN;
	writel_relaxed(config2, USB_GENCONFIG_2);

	if (motg->caps & ALLOW_VDD_MIN_WITH_RETENTION_DISABLED) {
		/* put the controller in non-driving mode */
		func_ctrl = ulpi_read(phy, ULPI_FUNC_CTRL);