usb: dwc2: gadget: remove D+ pull-up while no vbus with usb-role-switch

Bugzilla: http://bugzilla.redhat.com/2113003
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=48723298
Tested: HP ZBook 15 G5/80D5 Laptop
  ThinkPad P1 Gen5  TB4
  HP zBook Fury

commit db638c6500abaffb8f7770b2a69c40d003d54ae1
Author: Amelie Delaunay <amelie.delaunay@foss.st.com>
Date:   Wed Jun 22 18:07:17 2022 +0200

    usb: dwc2: gadget: remove D+ pull-up while no vbus with usb-role-switch

    When using usb-role-switch, D+ pull-up is set as soon as DTCL_SFTDISCON is
    cleared, whatever the vbus valid signal state is. The pull-up should not
    be set when vbus isn't present (this is determined by the drd controller).

    This patch ensures that B-Session (so Peripheral role + vbus valid signal)
    is valid before clearing the DCTL_SFTDISCON bit when role switch is used.
    Keep original behavior when usb-role-switch isn't used.

    Acked-by: Minas Harutyunyan <hminas@synopsys.com>
    Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
    Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
    Link: https://lore.kernel.org/r/20220622160717.314580-1-fabrice.gasnier@foss.st.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Torez Smith <torez@redhat.com>
This commit is contained in:
Torez Smith 2022-11-01 21:34:06 -04:00
parent 50998d649f
commit 344efaeb6e
1 changed files with 2 additions and 1 deletions

View File

@ -3594,7 +3594,8 @@ void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)
void dwc2_hsotg_core_connect(struct dwc2_hsotg *hsotg)
{
/* remove the soft-disconnect and let's go */
dwc2_clear_bit(hsotg, DCTL, DCTL_SFTDISCON);
if (!hsotg->role_sw || (dwc2_readl(hsotg, GOTGCTL) & GOTGCTL_BSESVLD))
dwc2_clear_bit(hsotg, DCTL, DCTL_SFTDISCON);
}
/**