Skip to content

Commit 10d510a

Browse files
tq-steinagregkh
authored andcommitted
usb: dwc3: Fix default mode initialization
The default mode, configurable by DT, shall be set before usb role switch driver is registered. Otherwise there is a race between default mode and mode set by usb role switch driver. Fixes: 98ed256 ("usb: dwc3: Add support for role-switch-default-mode binding") Cc: stable <stable@kernel.org> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/20231025095110.2405281-1-alexander.stein@ew.tq-group.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cdd0cde commit 10d510a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/usb/dwc3/drd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc)
505505
dwc->role_switch_default_mode = USB_DR_MODE_PERIPHERAL;
506506
mode = DWC3_GCTL_PRTCAP_DEVICE;
507507
}
508+
dwc3_set_mode(dwc, mode);
508509

509510
dwc3_role_switch.fwnode = dev_fwnode(dwc->dev);
510511
dwc3_role_switch.set = dwc3_usb_role_switch_set;
@@ -526,7 +527,6 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc)
526527
}
527528
}
528529

529-
dwc3_set_mode(dwc, mode);
530530
return 0;
531531
}
532532
#else

0 commit comments

Comments
 (0)