usb: dwc3: fix PM resume error for rockchip platforms

We enable PM runtime auto suspend on rockchip platforms (e.g. rk3399),
it allows DWC3 controller to enter runtime suspend if usb cable detached.
So we don't need to do anything in dwc3_suspend() and dwc3_resume()
which duplicated the same operations as dwc3_runtime_suspend() and
dwc3_runtime_resume().

And if DWC3 controller works on HOST mode, we can't do runtime resume
DWC3 gadget.

Change-Id: I63e734f51b05274251d8a88a664eee768568eb7b
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
This commit is contained in:
Wu Liang feng
2016-08-16 14:20:11 +08:00
committed by Huang, Tao
parent 7b082cbcee
commit 389d138fab
2 changed files with 10 additions and 1 deletions

View File

@@ -1247,6 +1247,9 @@ static int dwc3_suspend(struct device *dev)
struct dwc3 *dwc = dev_get_drvdata(dev);
int ret;
if (pm_runtime_suspended(dwc->dev))
return 0;
ret = dwc3_suspend_common(dwc);
if (ret)
return ret;
@@ -1261,6 +1264,9 @@ static int dwc3_resume(struct device *dev)
struct dwc3 *dwc = dev_get_drvdata(dev);
int ret;
if (pm_runtime_suspended(dwc->dev))
return 0;
pinctrl_pm_select_default_state(dev);
ret = dwc3_resume_common(dwc);

View File

@@ -2873,7 +2873,10 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt)
u32 count;
u32 reg;
if (pm_runtime_suspended(dwc->dev)) {
reg = dwc3_readl(dwc->regs, DWC3_GCTL);
if (pm_runtime_suspended(dwc->dev) &&
DWC3_GCTL_PRTCAP(reg) != DWC3_GCTL_PRTCAP_HOST) {
pm_runtime_get(dwc->dev);
disable_irq_nosync(dwc->irq_gadget);
dwc->pending_events = true;