Commit a6867836 authored by Vivek Gautam's avatar Vivek Gautam Committed by Kishon Vijay Abraham I

phy: exynos5-usbdrd: Add facility for VBUS-BOOST-5V supply

Some Exynos boards have a separate regulator controlling a
Boost 5V supply which goes as input for VBUS regulator.
So adding a control for the same in driver, to enable
vbus supply on the port.
Signed-off-by: default avatarVivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
parent 9bde18c1
...@@ -159,6 +159,8 @@ struct exynos5_usbdrd_phy_drvdata { ...@@ -159,6 +159,8 @@ struct exynos5_usbdrd_phy_drvdata {
* reference clocks' for SS and HS operations * reference clocks' for SS and HS operations
* @ref_clk: reference clock to PHY block from which PHY's * @ref_clk: reference clock to PHY block from which PHY's
* operational clocks are derived * operational clocks are derived
* vbus: VBUS regulator for phy
* vbus_boost: Boost regulator for VBUS present on few Exynos boards
*/ */
struct exynos5_usbdrd_phy { struct exynos5_usbdrd_phy {
struct device *dev; struct device *dev;
...@@ -178,6 +180,7 @@ struct exynos5_usbdrd_phy { ...@@ -178,6 +180,7 @@ struct exynos5_usbdrd_phy {
u32 extrefclk; u32 extrefclk;
struct clk *ref_clk; struct clk *ref_clk;
struct regulator *vbus; struct regulator *vbus;
struct regulator *vbus_boost;
}; };
static inline static inline
...@@ -460,11 +463,20 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy) ...@@ -460,11 +463,20 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy)
} }
/* Enable VBUS supply */ /* Enable VBUS supply */
if (phy_drd->vbus_boost) {
ret = regulator_enable(phy_drd->vbus_boost);
if (ret) {
dev_err(phy_drd->dev,
"Failed to enable VBUS boost supply\n");
goto fail_vbus;
}
}
if (phy_drd->vbus) { if (phy_drd->vbus) {
ret = regulator_enable(phy_drd->vbus); ret = regulator_enable(phy_drd->vbus);
if (ret) { if (ret) {
dev_err(phy_drd->dev, "Failed to enable VBUS supply\n"); dev_err(phy_drd->dev, "Failed to enable VBUS supply\n");
goto fail_vbus; goto fail_vbus_boost;
} }
} }
...@@ -473,6 +485,10 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy) ...@@ -473,6 +485,10 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy)
return 0; return 0;
fail_vbus_boost:
if (phy_drd->vbus_boost)
regulator_disable(phy_drd->vbus_boost);
fail_vbus: fail_vbus:
clk_disable_unprepare(phy_drd->ref_clk); clk_disable_unprepare(phy_drd->ref_clk);
if (!phy_drd->drv_data->has_common_clk_gate) { if (!phy_drd->drv_data->has_common_clk_gate) {
...@@ -497,6 +513,8 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy) ...@@ -497,6 +513,8 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy)
/* Disable VBUS supply */ /* Disable VBUS supply */
if (phy_drd->vbus) if (phy_drd->vbus)
regulator_disable(phy_drd->vbus); regulator_disable(phy_drd->vbus);
if (phy_drd->vbus_boost)
regulator_disable(phy_drd->vbus_boost);
clk_disable_unprepare(phy_drd->ref_clk); clk_disable_unprepare(phy_drd->ref_clk);
if (!phy_drd->drv_data->has_common_clk_gate) { if (!phy_drd->drv_data->has_common_clk_gate) {
...@@ -690,7 +708,7 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) ...@@ -690,7 +708,7 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev)
break; break;
} }
/* Get Vbus regulator */ /* Get Vbus regulators */
phy_drd->vbus = devm_regulator_get(dev, "vbus"); phy_drd->vbus = devm_regulator_get(dev, "vbus");
if (IS_ERR(phy_drd->vbus)) { if (IS_ERR(phy_drd->vbus)) {
ret = PTR_ERR(phy_drd->vbus); ret = PTR_ERR(phy_drd->vbus);
...@@ -701,6 +719,16 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) ...@@ -701,6 +719,16 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev)
phy_drd->vbus = NULL; phy_drd->vbus = NULL;
} }
phy_drd->vbus_boost = devm_regulator_get(dev, "vbus-boost");
if (IS_ERR(phy_drd->vbus_boost)) {
ret = PTR_ERR(phy_drd->vbus_boost);
if (ret == -EPROBE_DEFER)
return ret;
dev_warn(dev, "Failed to get VBUS boost supply regulator\n");
phy_drd->vbus_boost = NULL;
}
dev_vdbg(dev, "Creating usbdrd_phy phy\n"); dev_vdbg(dev, "Creating usbdrd_phy phy\n");
for (i = 0; i < EXYNOS5_DRDPHYS_NUM; i++) { for (i = 0; i < EXYNOS5_DRDPHYS_NUM; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment