Re: [PATCH v2 6/6] phy: tegra: xusb: Move T186 .set_mode() to common implementation

From: Jon Hunter

Date: Fri Mar 27 2026 - 13:52:52 EST



On 24/03/2026 14:36, Diogo Ivo wrote:

...

Ok, I can make it common there as well. However I still feel like
reverting cefc1caee9dd leads to cleaner code since vbus_override() and
id_override() will look similar and only do exactly what they state in
their names and the overall logic looks cleaner.

Just so you know that while commit cefc1caee9dd was being prepared for
upstream submission, the following had been proposed for this ...

@@ -825,11 +826,11 @@ static int tegra186_utmi_phy_set_mode(struct phy *phy, enum phy_mode mode,
tegra186_xusb_padctl_vbus_override(padctl, true);
} else if (submode == USB_ROLE_NONE) {
/*
- * When port is peripheral only or role transitions to
- * USB_ROLE_NONE from USB_ROLE_DEVICE, regulator is not
- * enabled.
+ * The regulator is disabled only when the role transitions
+ * from USB_ROLE_HOST to USB_ROLE_NONE.
*/
- if (regulator_is_enabled(port->supply))
+ value = padctl_readl(padctl, USB2_VBUS_ID);
+ if (!(value & ID_OVERRIDE_FLOATING))
regulator_disable(port->supply);

This shows the relationship between ID override and the regulator and
hence it was moved into id_override(). This is different to your fix
in patch 5/6. So given that we have been using cefc1caee9dd now for
sometime, I don't wish to change the implementation unless there is a
valid reason.

Jon

--
nvpublic