On Fri, 20 Oct 2006, Alan Stern wrote:

> I'm just building 2.6.19-rc2, so we'll see what happens with the OHCI
> controllers on my machine.

Okay, I tried it.  And I found a bug: When RD and RHSC are both set in the 
interrupt status register, the driver tries to do _two_ root-hub resumes!
That accounts for the mysterious "resume root" lines in the log.

The patch below fixes that problem.  I didn't see the other, more
important problem, though.  All the port resumes all completed as expected
and on time.  Still, you never know -- perhaps the patch will fix both 
problems.

Alan Stern


Index: 2.6.19-rc2/drivers/usb/host/ohci-hcd.c
===================================================================
--- 2.6.19-rc2.orig/drivers/usb/host/ohci-hcd.c
+++ 2.6.19-rc2/drivers/usb/host/ohci-hcd.c
@@ -715,13 +715,6 @@ static irqreturn_t ohci_irq (struct usb_
                return IRQ_NOTMINE;
        }
 
-       if (ints & OHCI_INTR_RHSC) {
-               ohci_vdbg (ohci, "rhsc\n");
-               ohci->next_statechange = jiffies + STATECHANGE_DELAY;
-               ohci_writel (ohci, OHCI_INTR_RHSC, &regs->intrstatus);
-               usb_hcd_poll_rh_status(hcd);
-       }
-
        if (ints & OHCI_INTR_UE) {
                disable (ohci);
                ohci_err (ohci, "OHCI Unrecoverable Error, disabled\n");
@@ -731,14 +724,26 @@ static irqreturn_t ohci_irq (struct usb_
                ohci_usb_reset (ohci);
        }
 
-       if (ints & OHCI_INTR_RD) {
-               ohci_vdbg (ohci, "resume detect\n");
-               ohci_writel (ohci, OHCI_INTR_RD, &regs->intrstatus);
+       if (ints & OHCI_INTR_RHSC) {
+               ohci_vdbg(ohci, "rhsc\n");
+               ohci->next_statechange = jiffies + STATECHANGE_DELAY;
+               ohci_writel(ohci, OHCI_INTR_RD | OHCI_INTR_RHSC,
+                               &regs->intrstatus);
+               usb_hcd_poll_rh_status(hcd);
+       }
+
+       /* For connect and disconnect events, we expect the controller
+        * to turn on RHSC along with RD.  But for remote wakeup events
+        * this might not happen.
+        */
+       else if (ints & OHCI_INTR_RD) {
+               ohci_vdbg(ohci, "resume detect\n");
+               ohci_writel(ohci, OHCI_INTR_RD, &regs->intrstatus);
                hcd->poll_rh = 1;
                if (ohci->autostop) {
-                       spin_lock (&ohci->lock);
-                       ohci_rh_resume (ohci);
-                       spin_unlock (&ohci->lock);
+                       spin_lock(&ohci->lock);
+                       ohci_rh_resume(ohci);
+                       spin_unlock(&ohci->lock);
                } else
                        usb_hcd_resume_root_hub(hcd);
        }
Index: 2619/drivers/usb/host/ohci-hub.c
===================================================================
--- 2619.orig/drivers/usb/host/ohci-hub.c
+++ 2619/drivers/usb/host/ohci-hub.c
@@ -169,7 +169,8 @@ __acquires(ohci->lock)
                break;
        case OHCI_USB_RESUME:
                /* HCFS changes sometime after INTR_RD */
-               ohci_info (ohci, "wakeup\n");
+               ohci_info (ohci, "%s\n",
+                               autostopped ? "auto-wakeup" : "wakeup");
                break;
        case OHCI_USB_OPER:
                /* this can happen after resuming a swsusp snapshot */


-------------------------------------------------------------------------
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