mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 00:39:48 +00:00
usb: dwc2: drd: reset current session before setting the new one
If role is changed without the "none" step, A- and B- valid session could
be set at the same time. It is an issue.
This patch resets A-session if role switch sets B-session, and resets
B-session if role switch sets A-session.
Then, it is possible to change the role without the "none" step.
Fixes: 17f934024e
("usb: dwc2: override PHY input signals with usb role switch support")
Acked-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/20211005095305.66397-4-amelie.delaunay@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8d387f61b0
commit
1ad707f559
1 changed files with 2 additions and 0 deletions
|
@ -40,6 +40,7 @@ static int dwc2_ovr_avalid(struct dwc2_hsotg *hsotg, bool valid)
|
||||||
(!valid && !(gotgctl & GOTGCTL_ASESVLD)))
|
(!valid && !(gotgctl & GOTGCTL_ASESVLD)))
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
|
|
||||||
|
gotgctl &= ~GOTGCTL_BVALOVAL;
|
||||||
if (valid)
|
if (valid)
|
||||||
gotgctl |= GOTGCTL_AVALOVAL | GOTGCTL_VBVALOVAL;
|
gotgctl |= GOTGCTL_AVALOVAL | GOTGCTL_VBVALOVAL;
|
||||||
else
|
else
|
||||||
|
@ -58,6 +59,7 @@ static int dwc2_ovr_bvalid(struct dwc2_hsotg *hsotg, bool valid)
|
||||||
(!valid && !(gotgctl & GOTGCTL_BSESVLD)))
|
(!valid && !(gotgctl & GOTGCTL_BSESVLD)))
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
|
|
||||||
|
gotgctl &= ~GOTGCTL_AVALOVAL;
|
||||||
if (valid)
|
if (valid)
|
||||||
gotgctl |= GOTGCTL_BVALOVAL | GOTGCTL_VBVALOVAL;
|
gotgctl |= GOTGCTL_BVALOVAL | GOTGCTL_VBVALOVAL;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue