]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00176299-2 usb host suspend/resume can't work randomly
authorTony LIU <junjie.liu@freescale.com>
Wed, 7 Mar 2012 07:55:32 +0000 (15:55 +0800)
committerOliver Wendt <ow@karo-electronics.de>
Mon, 30 Sep 2013 12:11:16 +0000 (14:11 +0200)
usb core part

Signed-off-by: Tony LIU <junjie.liu@freescale.com>
drivers/usb/core/hub.c
drivers/usb/host/ehci-hub.c

index 2eb71ec3924ed8229cf3ac17f62eb6519e25d10e..45540466d8fb951e76fbe7f39e5291b3395a3c4e 100644 (file)
 
 #ifdef CONFIG_ARCH_MX6
 #define MX6_USB_HOST_HACK
-
 #include <linux/fsl_devices.h>
-extern void fsl_platform_set_usb_phy_dis(struct fsl_usb2_platform_data *pdata,
-                                        bool enable);
 #endif
 /* if we are in debug mode, always announce new devices */
 #ifdef DEBUG
@@ -2540,6 +2537,17 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
                                (msg.event & PM_EVENT_AUTO ? "auto-" : ""));
                msleep(25);
 
+#ifdef MX6_USB_HOST_HACK
+               if (hub->hdev->parent == NULL) {
+                       struct usb_device *hdev = hub->hdev;
+                       struct usb_hcd *hcd = bus_to_hcd(hdev->bus);
+                       struct fsl_usb2_platform_data *pdata;
+                       pdata = hcd->self.controller->platform_data;
+                       if (pdata->platform_rh_resume)
+                               pdata->platform_rh_resume(pdata);
+               }
+#endif
+
                /* Virtual root hubs can trigger on GET_PORT_STATUS to
                 * stop resume signaling.  Then finish the resume
                 * sequence.
@@ -2551,6 +2559,16 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
        }
 
  SuspendCleared:
+#ifdef MX6_USB_HOST_HACK
+       if (hub->hdev->parent == NULL) {
+               struct usb_device *hdev = hub->hdev;
+               struct usb_hcd *hcd = bus_to_hcd(hdev->bus);
+               struct fsl_usb2_platform_data *pdata;
+               pdata = hcd->self.controller->platform_data;
+               if (pdata->platform_rh_resume)
+                       pdata->platform_rh_resume(pdata);
+       }
+#endif
        if (status == 0) {
                if (hub_is_superspeed(hub->hdev)) {
                        if (portchange & USB_PORT_STAT_C_LINK_STATE)
@@ -3037,7 +3055,8 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
                                struct fsl_usb2_platform_data *pdata;
                                pdata = (struct fsl_usb2_platform_data *)
                                         dev->platform_data;
-                               fsl_platform_set_usb_phy_dis(pdata, 1);
+                               if (pdata && pdata->platform_set_disconnect_det)
+                                       pdata->platform_set_disconnect_det(pdata, 1);
                        }
                }
        }
@@ -3190,9 +3209,10 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
                                pdata->init(NULL);
                }
                if ((port1 == 1) && (hdev->level == 0)) {
-                       if (!(portstatus&USB_PORT_STAT_CONNECTION)) {
+                       if (!(portstatus & USB_PORT_STAT_CONNECTION)) {
                                /* Must clear HOSTDISCONDETECT when disconnect*/
-                               fsl_platform_set_usb_phy_dis(pdata, 0);
+                               if (pdata->platform_set_disconnect_det)
+                                       pdata->platform_set_disconnect_det(pdata, 0);
                        }
                }
        }
index d6a80d9731a24e1bf7fd62fe94c6d0c0b1be46f1..b49e65f8d89e03883c8f3c54d604b0c0360ed42b 100644 (file)
@@ -430,6 +430,14 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
                spin_unlock_irq(&ehci->lock);
                msleep(20);
                spin_lock_irq(&ehci->lock);
+#ifdef MX6_USB_HOST_HACK
+               {
+                       struct fsl_usb2_platform_data *pdata;
+                       pdata = hcd->self.controller->platform_data;
+                       if (pdata->platform_rh_resume)
+                               pdata->platform_rh_resume(pdata);
+               }
+#endif
        }
 
        i = HCS_N_PORTS (ehci->hcs_params);
@@ -826,14 +834,6 @@ static int ehci_hub_control (
                                msleep(5);/* wait to leave low-power mode */
                                spin_lock_irqsave(&ehci->lock, flags);
                        }
-                       #ifdef MX6_USB_HOST_HACK
-                       {
-                               struct fsl_usb2_platform_data *pdata;
-                               pdata = hcd->self.controller->platform_data;
-                               if (pdata->platform_resume)
-                                       pdata->platform_resume(pdata);
-                       }
-                       #endif
 
                        /* resume signaling for 20 msec */
                        temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS);
@@ -1079,8 +1079,8 @@ static int ehci_hub_control (
                        {
                                struct fsl_usb2_platform_data *pdata;
                                pdata = hcd->self.controller->platform_data;
-                               if (pdata->platform_suspend)
-                                       pdata->platform_suspend(pdata);
+                               if (pdata->platform_rh_suspend)
+                                       pdata->platform_rh_suspend(pdata);
                        }
 #endif
                        if (hostpc_reg) {