Resend, David Brownell previously signed off on this patch at
http://sourceforge.net/mailarchive/message.php?msg_id=12031154

Retested on 2.6.13, this time CONFIG_USB_SUSPEND=y was required to
function properly, if off then these errors were printed:

hub 1-0:1.0: resubmit --> -113
hub 1-0:1.0: hub_port_status failed (err = -113)
hub 1-0:1.0: hub_hub_status failed (err = -113)
hub 1-0:1.0: get_hub_status failed

(-113 == -EHOSTUNREACH) May be expected, if not I can investigate
further.  Any concerns please let me know, thanks. -- Todd

----snip---
Suspend/resume for the Intel XScale PXA27x OHCI host controller.

From: Nicolas Pitre and Todd Poynor
Signed-off-by: Todd Poynor <[EMAIL PROTECTED]>
Signed-off-by: David Brownell <[EMAIL PROTECTED]>

Index: linux-2.6.13/drivers/usb/host/ohci-pxa27x.c
===================================================================
--- linux-2.6.13.orig/drivers/usb/host/ohci-pxa27x.c
+++ linux-2.6.13/drivers/usb/host/ohci-pxa27x.c
@@ -310,6 +310,7 @@ static const struct hc_driver ohci_pxa27
        .hub_suspend =          ohci_hub_suspend,
        .hub_resume =           ohci_hub_resume,
 #endif
+       .start_port_reset =     ohci_start_port_reset,
 };
 
 /*-------------------------------------------------------------------------*/
@@ -337,32 +338,67 @@ static int ohci_hcd_pxa27x_drv_remove(st
        return 0;
 }
 
-static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state, 
u32 level)
+#ifdef CONFIG_PM
+static int ohci_hcd_pxa27x_drv_suspend(struct device *dev,
+                                      pm_message_t message, u32 level)
 {
-//     struct platform_device *pdev = to_platform_device(dev);
-//     struct usb_hcd *hcd = dev_get_drvdata(dev);
-       printk("%s: not implemented yet\n", __FUNCTION__);
+       struct platform_device *pdev = to_platform_device(dev);
+       struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));
+       int status = -EINVAL;
 
-       return 0;
+       if (level != SUSPEND_POWER_DOWN)
+               return 0;
+
+       down(&ohci_to_hcd(ohci)->self.root_hub->serialize);
+       status = ohci_hub_suspend(ohci_to_hcd(ohci));
+       if (status == 0) {
+               pxa27x_stop_hc(pdev);
+               ohci_to_hcd(ohci)->self.root_hub->state =
+                       USB_STATE_SUSPENDED;
+               ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED;
+               dev->power.power_state = PMSG_SUSPEND;
+       }
+       up(&ohci_to_hcd(ohci)->self.root_hub->serialize);
+       return status;
 }
 
 static int ohci_hcd_pxa27x_drv_resume(struct device *dev, u32 level)
 {
-//     struct platform_device *pdev = to_platform_device(dev);
-//     struct usb_hcd *hcd = dev_get_drvdata(dev);
-       printk("%s: not implemented yet\n", __FUNCTION__);
+       struct platform_device *pdev = to_platform_device(dev);
+       struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));
+       int             status = 0;
 
-       return 0;
-}
+       if (level != RESUME_POWER_ON)
+               return 0;
 
+       if (time_before(jiffies, ohci->next_statechange))
+               msleep(5);
+       ohci->next_statechange = jiffies;
+       pxa27x_start_hc(pdev);
+#ifdef CONFIG_USB_SUSPEND
+       /* get extra cleanup even if remote wakeup isn"t in use */
+       status = usb_resume_device(ohci_to_hcd(ohci)->self.root_hub);
+#else
+       down(&ohci_to_hcd(ohci)->self.root_hub->serialize);
+       status = ohci_hub_resume(ohci_to_hcd(ohci));
+       up(&ohci_to_hcd(ohci)->self.root_hub->serialize);
+#endif
+       if (status == 0)
+               dev->power.power_state = PMSG_ON;
+
+       return status;
+}
+#endif
 
 static struct device_driver ohci_hcd_pxa27x_driver = {
        .name           = "pxa27x-ohci",
        .bus            = &platform_bus_type,
        .probe          = ohci_hcd_pxa27x_drv_probe,
        .remove         = ohci_hcd_pxa27x_drv_remove,
-       .suspend        = ohci_hcd_pxa27x_drv_suspend, 
-       .resume         = ohci_hcd_pxa27x_drv_resume, 
+#ifdef CONFIG_PM
+       .suspend        = ohci_hcd_pxa27x_drv_suspend,
+       .resume         = ohci_hcd_pxa27x_drv_resume,
+#endif
 };
 
 static int __init ohci_hcd_pxa27x_init (void)


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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