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

Commit 762a5f3a authored by Hemant Kumar's avatar Hemant Kumar Committed by Gerrit - the friendly Code Review server
Browse files

EHCI: HSIC: Halt controller before driving suspend on to the bus



There can be SOFs underway after suspending the port
(setting susp bit) which leads to phy lockup or unexpected
device disconnections. Halt the controller before setting
port suspend bit to avoid such issues.

Change-Id: I9ab3fe0556e845621d9314b66d2af955251284fb
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
Signed-off-by: default avatarChandana Kishori Chiluveru <cchiluve@codeaurora.org>
parent cf1c9dba
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -275,6 +275,14 @@ int ehci_bus_suspend (struct usb_hcd *hcd)
		if (t1 & PORT_OWNER)
			set_bit(port, &ehci->owned_ports);
		else if ((t1 & PORT_PE) && !(t1 & PORT_SUSPEND)) {
			/* clear RS bit before setting SUSP bit
			 * and wait for HCH to get set. */
			if (ehci->susp_sof_bug) {
				spin_unlock_irq(&ehci->lock);
				ehci_halt(ehci);
				spin_lock_irq(&ehci->lock);
			}

			t2 |= PORT_SUSPEND;
			set_bit(port, &ehci->bus_suspended);
		}
@@ -338,8 +346,9 @@ int ehci_bus_suspend (struct usb_hcd *hcd)
	if (ehci->bus_suspended)
		udelay(150);

	/* turn off now-idle HC */
	ehci_halt (ehci);
	/* if this bit is set, controller is already haled */
	if (!ehci->susp_sof_bug)
		ehci_halt(ehci); /* turn off now-idle HC */

	spin_lock_irq(&ehci->lock);
	if (ehci->enabled_hrtimer_events & BIT(EHCI_HRTIMER_POLL_DEAD))
@@ -1179,7 +1188,11 @@ int ehci_hub_control(
			 */
			temp &= ~PORT_WKCONN_E;
			temp |= PORT_WKDISC_E | PORT_WKOC_E;
			ehci_writel(ehci, temp | PORT_SUSPEND, status_reg);
			if (ehci->susp_sof_bug)
				ehci_writel(ehci, temp, status_reg);
			else
				ehci_writel(ehci, temp | PORT_SUSPEND,
						status_reg);
			if (ehci->has_tdi_phy_lpm) {
				spin_unlock_irqrestore(&ehci->lock, flags);
				msleep(5);/* 5ms for HCD enter low pwr mode */