Re: [PATCH v4 7/7] usb: dwc3: qcom: Enable VBUS override at probe for default peripheral role
From: Peter Chen
Date: Mon Nov 02 2026 - 01:36:28 EST
On 26-10-29 00:29:37, Faisal Hassan wrote:
> When the controller is in OTG mode with usb-role-switch and
> role-switch-default-mode set to peripheral, the role notifier never sees
> a transition at probe, so the QSCRATCH VBUS override is not programmed
> and the device never gets a session-valid indication.
>
> Enable the VBUS override at probe whenever the initial role is
> USB_ROLE_DEVICE.
>
> Validated on SA8255P with an HS host attached: 20 unbind/bind and 20
> suspend/resume iterations completed with no failures.
>
> Signed-off-by: Faisal Hassan <faisal.hassan@xxxxxxxxxxxxxxxx>
> ---
> drivers/usb/dwc3/dwc3-qcom.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 0896a323bdda..92f1223f7b21 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -953,10 +953,12 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
> dwc3_qcom_vbus_override_enable(qcom, true);
....
> } else {
> if ((device_property_read_bool(dev, "usb-role-switch")) &&
> - (usb_get_role_switch_default_mode(dev) == USB_DR_MODE_HOST))
> + (usb_get_role_switch_default_mode(dev) == USB_DR_MODE_HOST)) {
> qcom->current_role = USB_ROLE_HOST;
> - else
> + } else {
> qcom->current_role = USB_ROLE_DEVICE;
> + dwc3_qcom_vbus_override_enable(qcom, true);
> + }
How about move it and above [....] under device role, let above code purely determine current_role:
if (qcom->current_role == USB_ROLE_DEVICE)
dwc3_qcom_vbus_override_enable(qcom, true);
Peter
--
Thanks,
Peter Chen