diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index b28b8cd45799..f8b819cfa80e 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -326,6 +326,15 @@ static int dwc2_driver_remove(struct platform_device *dev) "exit partial_power_down failed\n"); } + /* Exit clock gating when driver is removed. */ + if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_NONE && + hsotg->bus_suspended) { + if (dwc2_is_device_mode(hsotg)) + dwc2_gadget_exit_clock_gating(hsotg, 0); + else + dwc2_host_exit_clock_gating(hsotg, 0); + } + dwc2_debugfs_exit(hsotg); if (hsotg->hcd_enabled) dwc2_hcd_remove(hsotg);