diff options
author | Fabrice Gasnier <fabrice.gasnier@foss.st.com> | 2021-12-06 16:56:43 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-12-17 16:52:51 +0100 |
commit | 3ad02e0e524117d019417b88715c69802ec9c5e0 (patch) | |
tree | 2a965e4b3a053861a4810afe6dae82cbafc8d788 /drivers/usb/dwc2/platform.c | |
parent | usb: dwc2: drd: add role-switch-default-node support (diff) | |
download | linux-3ad02e0e524117d019417b88715c69802ec9c5e0.tar.xz linux-3ad02e0e524117d019417b88715c69802ec9c5e0.zip |
usb: dwc2: drd: restore role and overrides upon resume
Override enable bits may not be restored when going to low power mode
(e.g. when in DWC2_POWER_DOWN_PARAM_NONE).
These bits are set when probing/initializing drd (role switch). Restore
them upon resume from low power mode (in case these have been lost).
To achieve this, the last known role is restored upon resume. And the
override enable bits are always set when configuring aval, bval and vbval.
When resuming, forcing the role should be done only once, or this can cause
port changes in HOST mode for instance.
So, only restore FORCEDEVMODE/FORCEHOSTMODE when role_sw is unused
Acked-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/1638806203-6624-4-git-send-email-fabrice.gasnier@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to '')
-rw-r--r-- | drivers/usb/dwc2/platform.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index a1feaa09be57..5d41c6a9b740 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -727,10 +727,12 @@ static int __maybe_unused dwc2_resume(struct device *dev) spin_unlock_irqrestore(&dwc2->lock, flags); } - /* Need to restore FORCEDEVMODE/FORCEHOSTMODE */ - dwc2_force_dr_mode(dwc2); - - dwc2_drd_resume(dwc2); + if (!dwc2->role_sw) { + /* Need to restore FORCEDEVMODE/FORCEHOSTMODE */ + dwc2_force_dr_mode(dwc2); + } else { + dwc2_drd_resume(dwc2); + } if (dwc2_is_device_mode(dwc2)) ret = dwc2_hsotg_resume(dwc2); |