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

[PATCH] Re-power USB ports on wakeup



Hi list,

Most of us have problems with USB unresponsive after one out of two
wakeups. This patch fixes it for me; it looks like the port status
isn't automatically updated (to ~PORT_POWER) when sleeping...

So this patch just unpowers the ports manually at the end of ehci_suspend.
I don't know if it's really correct: Ben & Greg, I'd like your comments. if
it's fine, can you push it upstream?

Signed-off-by: Colin Leroy <colin@colino.net>
--- a/drivers/usb/host/ehci-hcd.c	2005-03-15 17:28:52.000000000 +0100
+++ b/drivers/usb/host/ehci-hcd.c	2005-03-15 17:29:52.000000000 +0100
@@ -701,6 +701,7 @@
 static int ehci_suspend (struct usb_hcd *hcd, u32 state)
 {
 	struct ehci_hcd		*ehci = hcd_to_ehci (hcd);
+	unsigned port;
 
 	if (time_before (jiffies, ehci->next_statechange))
 		msleep (100);
@@ -716,6 +717,16 @@
 	// save (PCI) FLADJ in case of Vaux power loss
 	// ... we'd only use it to handle clock skew
 
+	/* Suspend all ports manually (to get them powered at resume) */
+	for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) {
+		u32	status;
+		port--;
+		status = readl (&ehci->regs->port_status [port]);
+		writel (status & ~PORT_POWER,
+					&ehci->regs->port_status [port]);
+		ehci_dbg(ehci, "port %d unpowered\n", port);
+	}
+
 	return 0;
 }
 



Reply to: