aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2022-07-14 22:34:53 -0500
committerAndre Przywara <andre.przywara@arm.com>2023-04-28 01:30:40 +0100
commitdf202d996d72665c76d031849aa064c4881dc777 (patch)
tree910e69df6f0774bfc5cd53bd29b84024ee1c54ee
parent09cbd3858f156e0461c0c939f23cf3c76ef95dcc (diff)
downloadu-boot-df202d996d72665c76d031849aa064c4881dc777.zip
u-boot-df202d996d72665c76d031849aa064c4881dc777.tar.gz
u-boot-df202d996d72665c76d031849aa064c4881dc777.tar.bz2
phy: sun4i-usb: Do not drive VBUS with external VBUS present
It is possible to use host-side USB with externally-provided VBUS. For example, some USB OTG cables have an extra power input which powers both the board and the USB peripheral. To support this setup, skip enabling the VBUS switch/regulator if VBUS voltage is already present. This behavior matches the Linux PHY driver. Signed-off-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
-rw-r--r--drivers/phy/allwinner/phy-sun4i-usb.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c
index 2e969ab..6428163 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -224,6 +224,12 @@ static int sun4i_usb_phy_power_on(struct phy *phy)
initial_usb_scan_delay = 0;
}
+ /* For phy0 only turn on Vbus if we don't have an ext. Vbus */
+ if (phy->id == 0 && sun4i_usb_phy_vbus_detect(phy)) {
+ dev_warn(phy->dev, "External vbus detected, not enabling our own vbus\n");
+ return 0;
+ }
+
if (dm_gpio_is_valid(&usb_phy->gpio_vbus))
dm_gpio_set_value(&usb_phy->gpio_vbus, 1);