Ivan,

Can you please test, whether the following patch will make 
the HC alive again after suspend-to-ram in your system. Note 
that the patch won't try to keep the state, it just 
reinitializes the controller.

Olav


--- linux-2.6.13-usb-resume0/drivers/usb/host/isp116x-hcd.c     2005-10-10 
08:36:04.000000000 +0300
+++ linux-2.6.13-usb-resume1/drivers/usb/host/isp116x-hcd.c     2005-10-10 
12:48:35.000000000 +0300
@@ -1193,15 +1193,16 @@ static int isp116x_hub_suspend(struct us
        return ret;
 }
 
+static int isp116x_reset(struct usb_hcd *hcd);
+static int isp116x_start(struct usb_hcd *hcd);
+
 static int isp116x_hub_resume(struct usb_hcd *hcd)
 {
        struct isp116x *isp116x = hcd_to_isp116x(hcd);
        u32 val;
-       int ret = -EINPROGRESS;
 
        msleep(5);
        spin_lock_irq(&isp116x->lock);
-
        val = isp116x_read_reg32(isp116x, HCCONTROL);
        switch (val & HCCONTROL_HCFS) {
        case HCCONTROL_USB_SUSPEND:
@@ -1215,16 +1216,23 @@ static int isp116x_hub_resume(struct usb
                   SUSPENDED state won't be removed from
                   sysfs/usbN/power.state as a response to remote
                   wakeup. Maybe in the future. */
+               spin_unlock_irq(&isp116x->lock);
                hcd->self.root_hub->dev.power.power_state = PMSG_ON;
-               ret = 0;
-               break;
+               return 0;
        default:
-               ret = -EBUSY;
-       }
-
-       if (ret != -EINPROGRESS) {
+               /* HCCONTROL_USB_RESET: this may happen, when during
+                  suspension the HC lost power. Reinitialize completely */
                spin_unlock_irq(&isp116x->lock);
-               return ret;
+               DBG("Chip has been reset while suspended. Reinit from 
scratch.\n");
+               isp116x_reset(hcd);
+               isp116x_start(hcd);
+               isp116x_hub_control(hcd, SetPortFeature,
+                                   USB_PORT_FEAT_POWER, 1, NULL, 0);
+               if ((isp116x->rhdesca & RH_A_NDP) == 2)
+                       isp116x_hub_control(hcd, SetPortFeature,
+                                           USB_PORT_FEAT_POWER, 2, NULL, 0);
+               hcd->self.root_hub->dev.power.power_state = PMSG_ON;
+               return 0;
        }
 
        val = isp116x->rhdesca & RH_A_NDP;


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
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