OHCI isn't coming back on the OLPC after resume.

After a bit of testing, the problem seems to have come down to two points.

The first is that ohci_pci_resume is not forcing the root hub to be resumed
properly, that's a fairly trivial and obviously correct patch.

The second is trickier, ohci_rh_resume is getting called in a state that it
thinks is an indication that it's coming back from a SUSPEND where it did not
lose power.

I've patched it, and hopefully there won't be any false positives, but I don't
have another machine to do suspend/resume testing on, so while it works for me,
I can't guarantee that it won't cause problems for others.

In any case, USB 1.1 devices directly plugged into the machine didn't work
after resume before this, and do now.

Signed-off-by: Zephaniah E. Hull <[EMAIL PROTECTED]>

diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index bb9cc59..3660dcc 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -165,6 +165,12 @@ static int ohci_rh_resume (struct ohci_hcd *ohci)
                }
        } else switch (ohci->hc_control & OHCI_CTRL_HCFS) {
        case OHCI_USB_SUSPEND:
+               /* FIXME: we should try to detect loss of VBUS better. */
+               if (!autostopped) {
+                       ohci_dbg (ohci, "resume root hub -- lost power\n");
+                       status = -EBUSY;
+                       break;
+               }
                ohci->hc_control &= ~(OHCI_CTRL_HCFS|OHCI_SCHED_ENABLES);
                ohci->hc_control |= OHCI_USB_RESUME;
                ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index 48de318..ae1ecb2 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -282,7 +282,9 @@ static int ohci_pci_resume (struct usb_hcd *hcd)
        prepare_for_handover(hcd);
 
        /* Force the PM core to resume the root hub */
-       hcd_to_bus(hcd)->root_hub->dev.power.prev_state.event = PM_EVENT_ON;
+       usb_root_hub_lost_power(hcd->self.root_hub);
+
+       hcd->state = HC_STATE_SUSPENDED;
        return 0;
 }
 

-- 
          1024D/E65A7801 Zephaniah E. Hull <[EMAIL PROTECTED]>
           92ED 94E4 B1E6 3624 226D  5727 4453 008B E65A 7801
            CCs of replies from mailing lists are requested.

Attachment: signature.asc
Description: Digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
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