diff options
author | Vivek Gautam <gautam.vivek@samsung.com> | 2014-11-21 08:35:49 -0500 |
---|---|---|
committer | Kishon Vijay Abraham I <kishon@ti.com> | 2014-11-22 03:38:09 -0500 |
commit | a6867836db35d1e178744166765b57288bf4e8e5 (patch) | |
tree | 753bc621412a95344ec96bd7e8b9c61baefff7f2 | |
parent | 9bde18c1b5d2c9a1b90fc0f3bbe1a314194f6fdf (diff) |
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: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
-rw-r--r-- | drivers/phy/phy-exynos5-usbdrd.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c index 99ba56dc63dd..04374018425f 100644 --- a/drivers/phy/phy-exynos5-usbdrd.c +++ b/drivers/phy/phy-exynos5-usbdrd.c | |||
@@ -159,6 +159,8 @@ struct exynos5_usbdrd_phy_drvdata { | |||
159 | * reference clocks' for SS and HS operations | 159 | * reference clocks' for SS and HS operations |
160 | * @ref_clk: reference clock to PHY block from which PHY's | 160 | * @ref_clk: reference clock to PHY block from which PHY's |
161 | * operational clocks are derived | 161 | * operational clocks are derived |
162 | * vbus: VBUS regulator for phy | ||
163 | * vbus_boost: Boost regulator for VBUS present on few Exynos boards | ||
162 | */ | 164 | */ |
163 | struct exynos5_usbdrd_phy { | 165 | struct exynos5_usbdrd_phy { |
164 | struct device *dev; | 166 | struct device *dev; |
@@ -178,6 +180,7 @@ struct exynos5_usbdrd_phy { | |||
178 | u32 extrefclk; | 180 | u32 extrefclk; |
179 | struct clk *ref_clk; | 181 | struct clk *ref_clk; |
180 | struct regulator *vbus; | 182 | struct regulator *vbus; |
183 | struct regulator *vbus_boost; | ||
181 | }; | 184 | }; |
182 | 185 | ||
183 | static inline | 186 | static inline |
@@ -460,11 +463,20 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy) | |||
460 | } | 463 | } |
461 | 464 | ||
462 | /* Enable VBUS supply */ | 465 | /* Enable VBUS supply */ |
466 | if (phy_drd->vbus_boost) { | ||
467 | ret = regulator_enable(phy_drd->vbus_boost); | ||
468 | if (ret) { | ||
469 | dev_err(phy_drd->dev, | ||
470 | "Failed to enable VBUS boost supply\n"); | ||
471 | goto fail_vbus; | ||
472 | } | ||
473 | } | ||
474 | |||
463 | if (phy_drd->vbus) { | 475 | if (phy_drd->vbus) { |
464 | ret = regulator_enable(phy_drd->vbus); | 476 | ret = regulator_enable(phy_drd->vbus); |
465 | if (ret) { | 477 | if (ret) { |
466 | dev_err(phy_drd->dev, "Failed to enable VBUS supply\n"); | 478 | dev_err(phy_drd->dev, "Failed to enable VBUS supply\n"); |
467 | goto fail_vbus; | 479 | goto fail_vbus_boost; |
468 | } | 480 | } |
469 | } | 481 | } |
470 | 482 | ||
@@ -473,6 +485,10 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy) | |||
473 | 485 | ||
474 | return 0; | 486 | return 0; |
475 | 487 | ||
488 | fail_vbus_boost: | ||
489 | if (phy_drd->vbus_boost) | ||
490 | regulator_disable(phy_drd->vbus_boost); | ||
491 | |||
476 | fail_vbus: | 492 | fail_vbus: |
477 | clk_disable_unprepare(phy_drd->ref_clk); | 493 | clk_disable_unprepare(phy_drd->ref_clk); |
478 | if (!phy_drd->drv_data->has_common_clk_gate) { | 494 | if (!phy_drd->drv_data->has_common_clk_gate) { |
@@ -497,6 +513,8 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy) | |||
497 | /* Disable VBUS supply */ | 513 | /* Disable VBUS supply */ |
498 | if (phy_drd->vbus) | 514 | if (phy_drd->vbus) |
499 | regulator_disable(phy_drd->vbus); | 515 | regulator_disable(phy_drd->vbus); |
516 | if (phy_drd->vbus_boost) | ||
517 | regulator_disable(phy_drd->vbus_boost); | ||
500 | 518 | ||
501 | clk_disable_unprepare(phy_drd->ref_clk); | 519 | clk_disable_unprepare(phy_drd->ref_clk); |
502 | if (!phy_drd->drv_data->has_common_clk_gate) { | 520 | if (!phy_drd->drv_data->has_common_clk_gate) { |
@@ -690,7 +708,7 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) | |||
690 | break; | 708 | break; |
691 | } | 709 | } |
692 | 710 | ||
693 | /* Get Vbus regulator */ | 711 | /* Get Vbus regulators */ |
694 | phy_drd->vbus = devm_regulator_get(dev, "vbus"); | 712 | phy_drd->vbus = devm_regulator_get(dev, "vbus"); |
695 | if (IS_ERR(phy_drd->vbus)) { | 713 | if (IS_ERR(phy_drd->vbus)) { |
696 | ret = PTR_ERR(phy_drd->vbus); | 714 | ret = PTR_ERR(phy_drd->vbus); |
@@ -701,6 +719,16 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) | |||
701 | phy_drd->vbus = NULL; | 719 | phy_drd->vbus = NULL; |
702 | } | 720 | } |
703 | 721 | ||
722 | phy_drd->vbus_boost = devm_regulator_get(dev, "vbus-boost"); | ||
723 | if (IS_ERR(phy_drd->vbus_boost)) { | ||
724 | ret = PTR_ERR(phy_drd->vbus_boost); | ||
725 | if (ret == -EPROBE_DEFER) | ||
726 | return ret; | ||
727 | |||
728 | dev_warn(dev, "Failed to get VBUS boost supply regulator\n"); | ||
729 | phy_drd->vbus_boost = NULL; | ||
730 | } | ||
731 | |||
704 | dev_vdbg(dev, "Creating usbdrd_phy phy\n"); | 732 | dev_vdbg(dev, "Creating usbdrd_phy phy\n"); |
705 | 733 | ||
706 | for (i = 0; i < EXYNOS5_DRDPHYS_NUM; i++) { | 734 | for (i = 0; i < EXYNOS5_DRDPHYS_NUM; i++) { |