USB: DWC_OTG: fix otg device clk repeatedly disable
authorWu Liang feng <wulf@rock-chips.com>
Wed, 31 Dec 2014 10:13:01 +0000 (18:13 +0800)
committerWu Liang feng <wulf@rock-chips.com>
Wed, 31 Dec 2014 10:13:01 +0000 (18:13 +0800)
The commit 28e9901cf058f17092b91347c0df0bad62962e5e set
otg device phy enter suspend and resume it after system
wakeup. But we don't control the clk, and it will cause
otg device repeatedly disable clk when resume from suspend.

Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
drivers/usb/dwc_otg_310/dwc_otg_driver.c

index f43627f3b8d865091c47867270a594472ce7ebcb..21b05a8eeb42d7164e060bae9d1868be9f378217 100755 (executable)
@@ -1536,9 +1536,13 @@ static int dwc_otg_pm_suspend(struct device *dev)
        dwc_otg_device_t *dwc_otg_device;
        struct dwc_otg_platform_data *pdata_otg;
 
+       dwc_otg_device = dev_get_platdata(dev);
+
        dev_dbg(dev, "dwc_otg PM suspend\n");
 
-       dwc_otg_device = dev_get_platdata(dev);
+       if (dwc_otg_device->core_if->op_state == B_PERIPHERAL)
+               return 0;
+
        pdata_otg = dwc_otg_device->pldata;
        pdata_otg->phy_suspend(pdata_otg, USB_PHY_SUSPEND);
 
@@ -1550,9 +1554,13 @@ static int dwc_otg_pm_resume(struct device *dev)
        dwc_otg_device_t *dwc_otg_device;
        struct dwc_otg_platform_data *pdata_otg;
 
+       dwc_otg_device = dev_get_platdata(dev);
+
        dev_dbg(dev, "dwc_otg PM resume\n");
 
-       dwc_otg_device = dev_get_platdata(dev);
+       if (dwc_otg_device->core_if->op_state == B_PERIPHERAL)
+               return 0;
+
        pdata_otg = dwc_otg_device->pldata;
        pdata_otg->phy_suspend(pdata_otg, USB_PHY_ENABLED);