On Linux, controller nodes with an extcon property delegate VBUS detection to an extcon device instead of the PHY. This is typically done on boards where VBUS is wired to external circuitry (e.g. a charging IC) that the PHY cannot itself observe, so the PHY's VBUS comparator can't be trusted for these nodes.
For such nodes, treat VBUS as always valid after controller reset, matching Linux's own reset handling [1]. This is detected by checking for the presence of the "extcon" property on the controller's devicetree node. Link: https://github.com/torvalds/linux/blob/9b87fdc9af2fbfcdb5c24a64139685ef80f6573f/drivers/usb/chipidea/ci_hdrc_msm.c#L117-L122 Signed-off-by: Reza Kurniawan <[email protected]> --- drivers/usb/host/ehci-msm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c index a58eff7cb..5205dd49e 100644 --- a/drivers/usb/host/ehci-msm.c +++ b/drivers/usb/host/ehci-msm.c @@ -25,6 +25,7 @@ struct msm_ehci_priv { struct ehci_ctrl ctrl; /* Needed by EHCI */ struct usb_ehci *ehci; /* Start of IP core*/ struct phy phy; + bool ext_vbus_sess_vld; }; struct qcom_ci_hdrc_priv { @@ -69,6 +70,9 @@ static int ehci_usb_probe(struct udevice *dev) if (ret < 0) return ret; + if (dev_read_prop(dev, "extcon", NULL)) + p->ext_vbus_sess_vld = true; + return ehci_register(dev, hccr, hcor, &msm_ehci_ops, 0, plat->init_type); } @@ -106,6 +110,10 @@ static int ehci_usb_of_to_plat(struct udevice *dev) } #if defined(CONFIG_CI_UDC) + +#define GEN2_SESS_VLD_CTRL_EN BIT(7) +#define SESS_VLD_CTRL BIT(25) + /* Little quirk that MSM needs with Chipidea controller * Must reinit phy after reset */ @@ -114,6 +122,14 @@ void ci_init_after_reset(struct ehci_ctrl *ctrl) struct msm_ehci_priv *p = ctrl->priv; generic_phy_reset(&p->phy); + + if (p->ext_vbus_sess_vld) { + /* Enable sess_vld */ + setbits_le32(&p->ehci->genconfig2, GEN2_SESS_VLD_CTRL_EN); + + /* Enable external vbus configuration in the LINK */ + setbits_le32(&p->ehci->usbcmd, SESS_VLD_CTRL); + } } #endif --- base-commit: 951132236b9adc592c2e49faadd103c6a355cac3 change-id: 20260917-b4-msm-usb-extcon-fix-a6491b836fd9 Best regards, -- Reza Kurniawan <[email protected]>
