diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 4cea590ca3f6..919090293487 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1642,7 +1642,14 @@ static int dwc3_probe(struct platform_device *pdev) goto err5; dwc3_debugfs_init(dwc); - pm_runtime_put(dev); + + if (of_device_is_compatible(dev->parent->of_node, + "rockchip,rk3399-dwc3")) { + pm_runtime_allow(dev); + pm_runtime_put_sync_suspend(dev); + } else { + pm_runtime_put(dev); + } return 0; diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 2b8377dbbab5..01b923cae95c 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2581,6 +2581,15 @@ static int __dwc3_gadget_start(struct dwc3 *dwc) int ret = 0; u32 reg; + /* + * If the DWC3 is in runtime suspend, the clocks maybe + * disabled, so avoid enable the DWC3 endpoints here. + * The DWC3 runtime PM resume routine will handle the + * gadget start sequence. + */ + if (pm_runtime_suspended(dwc->dev)) + return ret; + /* * Use IMOD if enabled via dwc->imod_interval. Otherwise, if * the core supports IMOD, disable it.