diff options
author | Artur Petrosyan <Arthur.Petrosyan@synopsys.com> | 2021-04-08 12:46:14 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-04-09 16:16:39 +0300 |
commit | b46b1ef7b0da5c9257b98a0d1d658422e7851783 (patch) | |
tree | c6a49b2ce7dcf019dc11a5f9479b673d01038495 /drivers/usb/dwc2 | |
parent | c74c26f6e398387cc953b3fdb54858f09bfb696b (diff) | |
download | linux-b46b1ef7b0da5c9257b98a0d1d658422e7851783.tar.xz |
usb: dwc2: Add exit partial power down before removing driver
When dwc2 core is in partial power down mode
loading driver again causes driver fail. Because in
that mode registers are not accessible.
Added a flow of exiting the partial power down mode
to avoid the driver reload failure.
Acked-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
Signed-off-by: Artur Petrosyan <Arthur.Petrosyan@synopsys.com>
Link: https://lore.kernel.org/r/20210408094615.8AE35A0094@mailhost.synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/dwc2')
-rw-r--r-- | drivers/usb/dwc2/platform.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 5f18acac7406..b28b8cd45799 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -316,6 +316,15 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) static int dwc2_driver_remove(struct platform_device *dev) { struct dwc2_hsotg *hsotg = platform_get_drvdata(dev); + int ret = 0; + + /* Exit Partial Power Down when driver is removed. */ + if (hsotg->in_ppd) { + ret = dwc2_exit_partial_power_down(hsotg, 0, true); + if (ret) + dev_err(hsotg->dev, + "exit partial_power_down failed\n"); + } dwc2_debugfs_exit(hsotg); if (hsotg->hcd_enabled) @@ -334,7 +343,7 @@ static int dwc2_driver_remove(struct platform_device *dev) reset_control_assert(hsotg->reset); reset_control_assert(hsotg->reset_ecc); - return 0; + return ret; } /** |