diff options
author | Artur Petrosyan <Arthur.Petrosyan@synopsys.com> | 2021-04-13 10:37:30 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-04-13 13:25:12 +0300 |
commit | 401411bbc4e62bcbcc020c2c458ecb90843140a8 (patch) | |
tree | 8ec84386ae066d6182b272c4484ad131f021a405 /drivers/usb | |
parent | ef5e0eec476426791d3d5e74fa96b2a30076922d (diff) | |
download | linux-401411bbc4e62bcbcc020c2c458ecb90843140a8.tar.xz |
usb: dwc2: Add exit clock gating before removing driver
When dwc2 core is in clock gating mode loading driver
again causes driver fail. Because in that mode
registers are not accessible.
Added a flow of exiting clock gating mode
to avoid the driver reload failure.
Signed-off-by: Artur Petrosyan <Arthur.Petrosyan@synopsys.com>
Link: https://lore.kernel.org/r/20210413073731.3C81BA022E@mailhost.synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/dwc2/platform.c | 9 |
1 files changed, 9 insertions, 0 deletions
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); |