Greg and David:

This patch (as738) fixes the root-hub remote-wakeup support in ehci-hcd.  
The existing code has two problems.  First, when the bus is suspended all 
root-hub interrupts are disabled.  Second, the call to 
usb_hcd_resume_root_hub() is in the wrong place -- it is invoked when a 
wakeup request arrives on a suspended port rather than when the root hub 
itself generates a wakeup request.

Working remote wakeup support is an important part of autoresume and a
prerequisite for autosuspend.

Alan Stern



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

---

It's easy to test that the existing code doesn't work and the patched 
driver does.  Just unplug all the ports on an EHCI controller, suspend the 
root hub interface and the root hub device through sysfs, and then try 
plugging in a USB device.  Without the patch, nothing happens.  With the 
patch, the driver wakes up and processes the new connection.


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
@@ -76,6 +76,10 @@ static int ehci_bus_suspend (struct usb_
        ehci_halt (ehci);
        hcd->state = HC_STATE_SUSPENDED;
 
+       /* allow remote wakeup */
+       if (device_may_wakeup(&hcd->self.root_hub->dev))
+               writel (INTR_MASK, &ehci->regs->intr_enable);
+
        ehci->next_statechange = jiffies + msecs_to_jiffies(10);
        spin_unlock_irq (&ehci->lock);
        return 0;
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
@@ -625,7 +625,7 @@ static irqreturn_t ehci_irq (struct usb_
                /* resume root hub? */
                status = readl (&ehci->regs->command);
                if (!(status & CMD_RUN))
-                       writel (status | CMD_RUN, &ehci->regs->command);
+                       usb_hcd_resume_root_hub(hcd);
 
                while (i--) {
                        status = readl (&ehci->regs->port_status [i]);
@@ -641,7 +641,6 @@ static irqreturn_t ehci_irq (struct usb_
                         */
                        ehci->reset_done [i] = jiffies + msecs_to_jiffies (20);
                        ehci_dbg (ehci, "port %d remote wakeup\n", i + 1);
-                       usb_hcd_resume_root_hub(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

Reply via email to