summaryrefslogtreecommitdiff
path: root/drivers/phy
diff options
context:
space:
mode:
authorWilliam Wu <william.wu@rock-chips.com>2018-05-16 20:24:25 +0800
committerTao Huang <huangtao@rock-chips.com>2018-05-17 09:59:13 +0800
commit38c609e3028f6b51910377b85e839d003d4d90b0 (patch)
treec1e384a4ceb34eaf49dd651ecbf52ef6bde21979 /drivers/phy
parentf8fb8bcd21ec9d26cc5ead78adaf4056317100c7 (diff)
BACKPORT: phy: rockchip-usb: Add vbus regulator support
On rockchip devices vbus is supplied by a separate power supply, often through a regulator. Add support for describing the regulator in device-tree following the same convention as several other usb phy's. Change-Id: Ib13fa5d9c50cab3dd6711f2e7dd8489a4f06840b Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: William Wu <william.wu@rock-chips.com> (cherry picked from commit 9d685ed77b1b07411c2a0a3e38f567e17f1a247a)
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/rockchip/phy-rockchip-usb.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/phy/rockchip/phy-rockchip-usb.c b/drivers/phy/rockchip/phy-rockchip-usb.c
index 9f0f8e60b675..45a9d586a3c7 100644
--- a/drivers/phy/rockchip/phy-rockchip-usb.c
+++ b/drivers/phy/rockchip/phy-rockchip-usb.c
@@ -66,6 +66,7 @@ struct rockchip_usb_phy {
struct phy *phy;
bool uart_enabled;
struct reset_control *reset;
+ struct regulator *vbus;
};
static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy,
@@ -88,6 +89,9 @@ static void rockchip_usb_phy480m_disable(struct clk_hw *hw)
struct rockchip_usb_phy,
clk480m_hw);
+ if (phy->vbus)
+ regulator_disable(phy->vbus);
+
/* Power down usb phy analog blocks by set siddq 1 */
rockchip_usb_phy_power(phy, 1);
}
@@ -143,6 +147,14 @@ static int rockchip_usb_phy_power_on(struct phy *_phy)
if (phy->uart_enabled)
return -EBUSY;
+ if (phy->vbus) {
+ int ret;
+
+ ret = regulator_enable(phy->vbus);
+ if (ret)
+ return ret;
+ }
+
return clk_prepare_enable(phy->clk480m);
}
@@ -268,6 +280,13 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,
}
phy_set_drvdata(rk_phy->phy, rk_phy);
+ rk_phy->vbus = devm_regulator_get_optional(&rk_phy->phy->dev, "vbus");
+ if (IS_ERR(rk_phy->vbus)) {
+ if (PTR_ERR(rk_phy->vbus) == -EPROBE_DEFER)
+ return PTR_ERR(rk_phy->vbus);
+ rk_phy->vbus = NULL;
+ }
+
/*
* Setting the COMMONONN to 1'b0 for EHCI PHY on RK3288 SoC.
*