Skip to content

Commit db638c6

Browse files
ADESTMgregkh
authored andcommitted
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 <[email protected]> Signed-off-by: Amelie Delaunay <[email protected]> Signed-off-by: Fabrice Gasnier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 21cdd6a commit db638c6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/usb/dwc2/gadget.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3594,7 +3594,8 @@ void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)
35943594
void dwc2_hsotg_core_connect(struct dwc2_hsotg *hsotg)
35953595
{
35963596
/* remove the soft-disconnect and let's go */
3597-
dwc2_clear_bit(hsotg, DCTL, DCTL_SFTDISCON);
3597+
if (!hsotg->role_sw || (dwc2_readl(hsotg, GOTGCTL) & GOTGCTL_BSESVLD))
3598+
dwc2_clear_bit(hsotg, DCTL, DCTL_SFTDISCON);
35983599
}
35993600

36003601
/**

0 commit comments

Comments
 (0)