[PATCH v3 1/1] USB: EHCI: wait more than 3ms until the device enters full-speed idle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the high-speed device does not enter full-speed idle after
wakeup on disconnect logic has effected, there will be an
unexpected disconnect wakeup interrupt due to the bus is still SE0.

Signed-off-by: Peter Chen <peter.chen@xxxxxxxxxxxxx>

Hi Alan,

If you can't met this issue, it may due to your hardware enables
WKDN after detecting full-speed idle or the time between stop
SoF and enable WKDN is more than 3ms (You need to know when
the WKDN has really taken effect).
---
Changes for v3:
- Stop SoF first, then delay 3.5-4ms, enable WKDS at last.

Changes for v2:
- Using usleep_range instead of mdelay

 drivers/usb/host/ehci-hub.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 47b858f..111ac61 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -300,7 +300,27 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
 		}
 
 		if (t1 != t2) {
-			ehci_writel(ehci, t2, reg);
+			/*
+			 * If the high-speed device has not switched
+			 * to full-speed idle before WKDISC_E has taken
+			 * effect, there will be a WKDISC event.
+			 */
+			if (t2 & PORT_WKDISC_E &&
+					(ehci_port_speed(ehci, t2)
+					 == USB_PORT_STAT_HIGH_SPEED)) {
+				t2 &= ~PORT_WKDISC_E;
+				/* Stop SoF first */
+				ehci_writel(ehci, t2, reg);
+				spin_unlock_irq(&ehci->lock);
+				/* Wait for full-speed idle */
+				usleep_range(3500, 4000);
+				spin_lock_irq(&ehci->lock);
+				t2 |= PORT_WKDISC_E;
+				ehci_writel(ehci, t2, reg);
+			}
+			else {
+				ehci_writel(ehci, t2, reg);
+			}
 			changed = 1;
 		}
 	}
-- 
1.7.8


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux