OSDN Git Service

usb: dwc2: drd: restore role and overrides upon resume
authorFabrice Gasnier <fabrice.gasnier@foss.st.com>
Mon, 6 Dec 2021 15:56:43 +0000 (16:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Dec 2021 15:52:51 +0000 (16:52 +0100)
commit3ad02e0e524117d019417b88715c69802ec9c5e0
tree2a965e4b3a053861a4810afe6dae82cbafc8d788
parente14acb8769850fedfbfc62a64998e34348442784
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>
drivers/usb/dwc2/drd.c
drivers/usb/dwc2/platform.c