Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1211134 > unrolled thread
| Started by | Marek Szyprowski <m.szyprowski@samsung.com> |
|---|---|
| First post | 2015-08-21 14:40 +0200 |
| Last post | 2015-08-27 12:00 +0200 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 1/7] phy: exynos-usb2: add vbus regulator support Marek Szyprowski <m.szyprowski@samsung.com> - 2015-08-21 14:40 +0200
Re: [PATCH 1/7] phy: exynos-usb2: add vbus regulator support Kishon Vijay Abraham I <kishon@ti.com> - 2015-08-21 14:50 +0200
Re: [PATCH 1/7] phy: exynos-usb2: add vbus regulator support Marek Szyprowski <m.szyprowski@samsung.com> - 2015-08-25 07:50 +0200
Re: [PATCH 1/7] phy: exynos-usb2: add vbus regulator support Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-08-25 08:20 +0200
Re: [PATCH 1/7] phy: exynos-usb2: add vbus regulator support Kishon Vijay Abraham I <kishon@ti.com> - 2015-08-27 12:00 +0200
| From | Marek Szyprowski <m.szyprowski@samsung.com> |
|---|---|
| Date | 2015-08-21 14:40 +0200 |
| Subject | [PATCH 1/7] phy: exynos-usb2: add vbus regulator support |
| Message-ID | <pZTLZ-3GC-21@gated-at.bofh.it> |
Exynos USB2 PHY has separate power supply, which is usually provided by
VBUS regulator. This patch adds support for it. VBUS regulator is
optional, to keep compatibility with boards, which have VBUS provided
from some always-on power source.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
.../devicetree/bindings/phy/samsung-phy.txt | 3 +++
drivers/phy/phy-samsung-usb2.c | 25 ++++++++++++++++++++--
drivers/phy/phy-samsung-usb2.h | 2 ++
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt
index 60c6f2a633e0..0289d3b07853 100644
--- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
+++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
@@ -44,6 +44,9 @@ Required properties:
- the "ref" clock is used to get the rate of the clock provided to the
PHY module
+Optional properties:
+- vbus-supply: power-supply phandle for vbus power source
+
The first phandle argument in the PHY specifier identifies the PHY, its
meaning is compatible dependent. For the currently supported SoCs (Exynos 4210
and Exynos 4212) it is as follows:
diff --git a/drivers/phy/phy-samsung-usb2.c b/drivers/phy/phy-samsung-usb2.c
index f278a9c547e1..1d22d93b552d 100644
--- a/drivers/phy/phy-samsung-usb2.c
+++ b/drivers/phy/phy-samsung-usb2.c
@@ -27,6 +27,13 @@ static int samsung_usb2_phy_power_on(struct phy *phy)
dev_dbg(drv->dev, "Request to power_on \"%s\" usb phy\n",
inst->cfg->label);
+
+ if (drv->vbus) {
+ ret = regulator_enable(drv->vbus);
+ if (ret)
+ goto err_regulator;
+ }
+
ret = clk_prepare_enable(drv->clk);
if (ret)
goto err_main_clk;
@@ -48,6 +55,9 @@ err_power_on:
err_instance_clk:
clk_disable_unprepare(drv->clk);
err_main_clk:
+ if (drv->vbus)
+ regulator_disable(drv->vbus);
+err_regulator:
return ret;
}
@@ -55,7 +65,7 @@ static int samsung_usb2_phy_power_off(struct phy *phy)
{
struct samsung_usb2_phy_instance *inst = phy_get_drvdata(phy);
struct samsung_usb2_phy_driver *drv = inst->drv;
- int ret;
+ int ret = 0;
dev_dbg(drv->dev, "Request to power_off \"%s\" usb phy\n",
inst->cfg->label);
@@ -68,7 +78,10 @@ static int samsung_usb2_phy_power_off(struct phy *phy)
}
clk_disable_unprepare(drv->ref_clk);
clk_disable_unprepare(drv->clk);
- return 0;
+ if (drv->vbus)
+ ret = regulator_disable(drv->vbus);
+
+ return ret;
}
static const struct phy_ops samsung_usb2_phy_ops = {
@@ -203,6 +216,14 @@ static int samsung_usb2_phy_probe(struct platform_device *pdev)
return ret;
}
+ drv->vbus = devm_regulator_get(dev, "vbus");
+ if (IS_ERR(drv->vbus)) {
+ ret = PTR_ERR(drv->vbus);
+ if (ret == -EPROBE_DEFER)
+ return ret;
+ drv->vbus = NULL;
+ }
+
for (i = 0; i < drv->cfg->num_phys; i++) {
char *label = drv->cfg->phys[i].label;
struct samsung_usb2_phy_instance *p = &drv->instances[i];
diff --git a/drivers/phy/phy-samsung-usb2.h b/drivers/phy/phy-samsung-usb2.h
index 44bead9b8f34..6563e7ca0ac4 100644
--- a/drivers/phy/phy-samsung-usb2.h
+++ b/drivers/phy/phy-samsung-usb2.h
@@ -17,6 +17,7 @@
#include <linux/device.h>
#include <linux/regmap.h>
#include <linux/spinlock.h>
+#include <linux/regulator/consumer.h>
#define KHZ 1000
#define MHZ (KHZ * KHZ)
@@ -37,6 +38,7 @@ struct samsung_usb2_phy_driver {
const struct samsung_usb2_phy_config *cfg;
struct clk *clk;
struct clk *ref_clk;
+ struct regulator *vbus;
unsigned long ref_rate;
u32 ref_reg_val;
struct device *dev;
--
1.9.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Kishon Vijay Abraham I <kishon@ti.com> |
|---|---|
| Date | 2015-08-21 14:50 +0200 |
| Message-ID | <pZTVF-3S1-31@gated-at.bofh.it> |
| In reply to | #1211134 |
Hi,
On Friday 21 August 2015 06:08 PM, Marek Szyprowski wrote:
> Exynos USB2 PHY has separate power supply, which is usually provided by
> VBUS regulator. This patch adds support for it. VBUS regulator is
> optional, to keep compatibility with boards, which have VBUS provided
> from some always-on power source.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> .../devicetree/bindings/phy/samsung-phy.txt | 3 +++
> drivers/phy/phy-samsung-usb2.c | 25 ++++++++++++++++++++--
> drivers/phy/phy-samsung-usb2.h | 2 ++
> 3 files changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> index 60c6f2a633e0..0289d3b07853 100644
> --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> @@ -44,6 +44,9 @@ Required properties:
> - the "ref" clock is used to get the rate of the clock provided to the
> PHY module
>
> +Optional properties:
> +- vbus-supply: power-supply phandle for vbus power source
how about using phy-supply?
Thanks
Kishon
> +
> The first phandle argument in the PHY specifier identifies the PHY, its
> meaning is compatible dependent. For the currently supported SoCs (Exynos 4210
> and Exynos 4212) it is as follows:
> diff --git a/drivers/phy/phy-samsung-usb2.c b/drivers/phy/phy-samsung-usb2.c
> index f278a9c547e1..1d22d93b552d 100644
> --- a/drivers/phy/phy-samsung-usb2.c
> +++ b/drivers/phy/phy-samsung-usb2.c
> @@ -27,6 +27,13 @@ static int samsung_usb2_phy_power_on(struct phy *phy)
>
> dev_dbg(drv->dev, "Request to power_on \"%s\" usb phy\n",
> inst->cfg->label);
> +
> + if (drv->vbus) {
> + ret = regulator_enable(drv->vbus);
> + if (ret)
> + goto err_regulator;
> + }
> +
> ret = clk_prepare_enable(drv->clk);
> if (ret)
> goto err_main_clk;
> @@ -48,6 +55,9 @@ err_power_on:
> err_instance_clk:
> clk_disable_unprepare(drv->clk);
> err_main_clk:
> + if (drv->vbus)
> + regulator_disable(drv->vbus);
> +err_regulator:
> return ret;
> }
>
> @@ -55,7 +65,7 @@ static int samsung_usb2_phy_power_off(struct phy *phy)
> {
> struct samsung_usb2_phy_instance *inst = phy_get_drvdata(phy);
> struct samsung_usb2_phy_driver *drv = inst->drv;
> - int ret;
> + int ret = 0;
>
> dev_dbg(drv->dev, "Request to power_off \"%s\" usb phy\n",
> inst->cfg->label);
> @@ -68,7 +78,10 @@ static int samsung_usb2_phy_power_off(struct phy *phy)
> }
> clk_disable_unprepare(drv->ref_clk);
> clk_disable_unprepare(drv->clk);
> - return 0;
> + if (drv->vbus)
> + ret = regulator_disable(drv->vbus);
> +
> + return ret;
> }
>
> static const struct phy_ops samsung_usb2_phy_ops = {
> @@ -203,6 +216,14 @@ static int samsung_usb2_phy_probe(struct platform_device *pdev)
> return ret;
> }
>
> + drv->vbus = devm_regulator_get(dev, "vbus");
> + if (IS_ERR(drv->vbus)) {
> + ret = PTR_ERR(drv->vbus);
> + if (ret == -EPROBE_DEFER)
> + return ret;
> + drv->vbus = NULL;
> + }
> +
> for (i = 0; i < drv->cfg->num_phys; i++) {
> char *label = drv->cfg->phys[i].label;
> struct samsung_usb2_phy_instance *p = &drv->instances[i];
> diff --git a/drivers/phy/phy-samsung-usb2.h b/drivers/phy/phy-samsung-usb2.h
> index 44bead9b8f34..6563e7ca0ac4 100644
> --- a/drivers/phy/phy-samsung-usb2.h
> +++ b/drivers/phy/phy-samsung-usb2.h
> @@ -17,6 +17,7 @@
> #include <linux/device.h>
> #include <linux/regmap.h>
> #include <linux/spinlock.h>
> +#include <linux/regulator/consumer.h>
>
> #define KHZ 1000
> #define MHZ (KHZ * KHZ)
> @@ -37,6 +38,7 @@ struct samsung_usb2_phy_driver {
> const struct samsung_usb2_phy_config *cfg;
> struct clk *clk;
> struct clk *ref_clk;
> + struct regulator *vbus;
> unsigned long ref_rate;
> u32 ref_reg_val;
> struct device *dev;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Marek Szyprowski <m.szyprowski@samsung.com> |
|---|---|
| Date | 2015-08-25 07:50 +0200 |
| Message-ID | <q1fhn-5O7-1@gated-at.bofh.it> |
| In reply to | #1211148 |
Hello, On 2015-08-21 14:44, Kishon Vijay Abraham I wrote: > On Friday 21 August 2015 06:08 PM, Marek Szyprowski wrote: >> Exynos USB2 PHY has separate power supply, which is usually provided by >> VBUS regulator. This patch adds support for it. VBUS regulator is >> optional, to keep compatibility with boards, which have VBUS provided >> from some always-on power source. >> >> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> >> --- >> .../devicetree/bindings/phy/samsung-phy.txt | 3 +++ >> drivers/phy/phy-samsung-usb2.c | 25 ++++++++++++++++++++-- >> drivers/phy/phy-samsung-usb2.h | 2 ++ >> 3 files changed, 28 insertions(+), 2 deletions(-) >> >> diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt >> index 60c6f2a633e0..0289d3b07853 100644 >> --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt >> +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt >> @@ -44,6 +44,9 @@ Required properties: >> - the "ref" clock is used to get the rate of the clock provided to the >> PHY module >> >> +Optional properties: >> +- vbus-supply: power-supply phandle for vbus power source > how about using phy-supply? I wanted to make it a bit more descriptive (vbus-supply is rather self explaining name) and keep it in line with Exynos usb3-drd phy, which already supports vbus-supply. If you think that this is a bad idea, a will use phy-supply then. Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Krzysztof Kozlowski <k.kozlowski@samsung.com> |
|---|---|
| Date | 2015-08-25 08:20 +0200 |
| Message-ID | <q1fKp-6B7-1@gated-at.bofh.it> |
| In reply to | #1212701 |
On 25.08.2015 14:47, Marek Szyprowski wrote: > Hello, > > On 2015-08-21 14:44, Kishon Vijay Abraham I wrote: >> On Friday 21 August 2015 06:08 PM, Marek Szyprowski wrote: >>> Exynos USB2 PHY has separate power supply, which is usually provided by >>> VBUS regulator. This patch adds support for it. VBUS regulator is >>> optional, to keep compatibility with boards, which have VBUS provided >>> from some always-on power source. >>> >>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> >>> --- >>> .../devicetree/bindings/phy/samsung-phy.txt | 3 +++ >>> drivers/phy/phy-samsung-usb2.c | 25 >>> ++++++++++++++++++++-- >>> drivers/phy/phy-samsung-usb2.h | 2 ++ >>> 3 files changed, 28 insertions(+), 2 deletions(-) >>> >>> diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt >>> b/Documentation/devicetree/bindings/phy/samsung-phy.txt >>> index 60c6f2a633e0..0289d3b07853 100644 >>> --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt >>> +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt >>> @@ -44,6 +44,9 @@ Required properties: >>> - the "ref" clock is used to get the rate of the clock provided >>> to the >>> PHY module >>> +Optional properties: >>> +- vbus-supply: power-supply phandle for vbus power source >> how about using phy-supply? > > I wanted to make it a bit more descriptive (vbus-supply is rather self > explaining name) > and keep it in line with Exynos usb3-drd phy, which already supports > vbus-supply. > If you think that this is a bad idea, a will use phy-supply then. This is actually supply for VBUS, not for the phy. Using phy-supply would work fine and reduce the size of code... but would be rather a hacky-use of phy and it could be misleading. I don't have strong feeling about this, both ideas have its advantages. If I had to choose than I would like to use vbus-supply because of its correctness with real-world (this is a VBUS after all). Best regards, Krzysztof -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Kishon Vijay Abraham I <kishon@ti.com> |
|---|---|
| Date | 2015-08-27 12:00 +0200 |
| Message-ID | <q228q-RU-7@gated-at.bofh.it> |
| In reply to | #1212713 |
Hi, On Tuesday 25 August 2015 11:42 AM, Krzysztof Kozlowski wrote: > On 25.08.2015 14:47, Marek Szyprowski wrote: >> Hello, >> >> On 2015-08-21 14:44, Kishon Vijay Abraham I wrote: >>> On Friday 21 August 2015 06:08 PM, Marek Szyprowski wrote: >>>> Exynos USB2 PHY has separate power supply, which is usually provided by >>>> VBUS regulator. This patch adds support for it. VBUS regulator is >>>> optional, to keep compatibility with boards, which have VBUS provided >>>> from some always-on power source. >>>> >>>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> >>>> --- >>>> .../devicetree/bindings/phy/samsung-phy.txt | 3 +++ >>>> drivers/phy/phy-samsung-usb2.c | 25 >>>> ++++++++++++++++++++-- >>>> drivers/phy/phy-samsung-usb2.h | 2 ++ >>>> 3 files changed, 28 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt >>>> b/Documentation/devicetree/bindings/phy/samsung-phy.txt >>>> index 60c6f2a633e0..0289d3b07853 100644 >>>> --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt >>>> +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt >>>> @@ -44,6 +44,9 @@ Required properties: >>>> - the "ref" clock is used to get the rate of the clock provided >>>> to the >>>> PHY module >>>> +Optional properties: >>>> +- vbus-supply: power-supply phandle for vbus power source >>> how about using phy-supply? >> >> I wanted to make it a bit more descriptive (vbus-supply is rather self >> explaining name) >> and keep it in line with Exynos usb3-drd phy, which already supports >> vbus-supply. >> If you think that this is a bad idea, a will use phy-supply then. > > This is actually supply for VBUS, not for the phy. Using phy-supply > would work fine and reduce the size of code... but would be rather a > hacky-use of phy and it could be misleading. > > I don't have strong feeling about this, both ideas have its advantages. > If I had to choose than I would like to use vbus-supply because of its > correctness with real-world (this is a VBUS after all). Alright.. lets use vbus-supply then. Thanks Kishon -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web