From 4a1bab8fa980387a172156336bf8d9ef3a16685f Mon Sep 17 00:00:00 2001 From: Wu Liang feng Date: Wed, 31 Dec 2014 18:13:01 +0800 Subject: [PATCH] USB: DWC_OTG: fix otg device clk repeatedly disable 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 --- drivers/usb/dwc_otg_310/dwc_otg_driver.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc_otg_310/dwc_otg_driver.c b/drivers/usb/dwc_otg_310/dwc_otg_driver.c index f43627f3b8d8..21b05a8eeb42 100755 --- a/drivers/usb/dwc_otg_310/dwc_otg_driver.c +++ b/drivers/usb/dwc_otg_310/dwc_otg_driver.c @@ -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); -- 2.34.1