[linux-usb-devel] [PATCH] EHCI: disable wakeup on all ports during shutdown

2007-02-07 Thread Alan Stern
This patch (as850) disables remote wakeup on EHCI ports when the
shutdown() method is called.  If it is left active then some systems
will reboot instead of powering off.  This solves Bugzilla #7828.

Signed-off-by: Alan Stern <[EMAIL PROTECTED]>

---

Index: usb-2.6/drivers/usb/host/ehci-hcd.c
===
--- usb-2.6.orig/drivers/usb/host/ehci-hcd.c
+++ usb-2.6/drivers/usb/host/ehci-hcd.c
@@ -310,6 +310,7 @@ ehci_shutdown (struct usb_hcd *hcd)
 
ehci = hcd_to_ehci (hcd);
(void) ehci_halt (ehci);
+   ehci_disable_all_ports(ehci);
 
/* make BIOS/etc use companion controller during reboot */
ehci_writel(ehci, 0, &ehci->regs->configured_flag);
Index: usb-2.6/drivers/usb/host/ehci-hub.c
===
--- usb-2.6.orig/drivers/usb/host/ehci-hub.c
+++ usb-2.6/drivers/usb/host/ehci-hub.c
@@ -28,6 +28,16 @@
 
 /*-*/
 
+/* On some systems, leaving remote wakeup enabled prevents system shutdown. */
+static void ehci_disable_all_ports(struct ehci_hcd *ehci)
+{
+   int port = HCS_N_PORTS(ehci->hcs_params);
+
+   while (port--)
+   ehci_writel(ehci, PORT_RWC_BITS,
+   &ehci->regs->port_status[port]);
+}
+
 #ifdef CONFIG_PM
 
 static int ehci_bus_suspend (struct usb_hcd *hcd)


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH] EHCI: disable wakeup on all ports during shutdown

2007-02-08 Thread Alan Stern
On Wed, 7 Feb 2007, Alan Stern wrote:

> This patch (as850) disables remote wakeup on EHCI ports when the
> shutdown() method is called.  If it is left active then some systems
> will reboot instead of powering off.  This solves Bugzilla #7828.

I'm having second thoughts about this patch.

First of all, shouldn't we do the same thing in ehci_stop()?  If somebody
unloads ehci-hcd, we don't want to leave remote wakeup enabled on any of
the ports.

On the other hand, what about suspend-to-disk with Wake-On-USB enabled?  
In this situation we definitely do _not_ want to disable remote wakeup.

I'll try to get more information from the original bug reporters.

That brings to mind yet another issue.  Right now it can't arise, but in 
the future it might.  What happens if somebody does a shutdown or unloads 
ehci-hcd at a time when the controller's PCI interface is in D3hot?  The 
driver will attempt to quiesce the controller and end up causing a bus 
access violation.  Something to keep in mind...

Alan Stern


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel