linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] phy: exynos-usb2: add vbus regulator support
@ 2015-10-06 13:41 Marek Szyprowski
  2015-10-06 13:47 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Szyprowski @ 2015-10-06 13:41 UTC (permalink / raw)
  To: linux-kernel, linux-samsung-soc
  Cc: Marek Szyprowski, Krzysztof Kozlowski, Kishon Vijay Abraham I

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>
---
This is just a resend of a patch posted in the following thread:
https://lkml.org/lkml/2015/8/21/306

I really hope that it will finally get merged to v4.4. For more
information and background, please refer to the mentioned thread.

Marek Szyprowski
---
 .../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 60c6f2a..0289d3b 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 f278a9c..1d22d93 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 44bead9..6563e7c 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND] phy: exynos-usb2: add vbus regulator support
  2015-10-06 13:41 [PATCH RESEND] phy: exynos-usb2: add vbus regulator support Marek Szyprowski
@ 2015-10-06 13:47 ` Krzysztof Kozlowski
  2015-10-06 14:09   ` Marek Szyprowski
  0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-06 13:47 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-kernel, linux-samsung-soc, Krzysztof Kozlowski,
	Kishon Vijay Abraham I

2015-10-06 22:41 GMT+09:00 Marek Szyprowski <m.szyprowski@samsung.com>:
>
> 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>
> ---
> This is just a resend of a patch posted in the following thread:
> https://lkml.org/lkml/2015/8/21/306
>
> I really hope that it will finally get merged to v4.4. For more
> information and background, please refer to the mentioned thread.
>
> Marek Szyprowski
> ---
>  .../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(-)

Any particular reason to dropping my tested-by? Do you changed here anything?

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND] phy: exynos-usb2: add vbus regulator support
  2015-10-06 13:47 ` Krzysztof Kozlowski
@ 2015-10-06 14:09   ` Marek Szyprowski
  2015-10-06 14:29     ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Szyprowski @ 2015-10-06 14:09 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: linux-kernel, linux-samsung-soc, Kishon Vijay Abraham I

Hello,

On 2015-10-06 15:47, Krzysztof Kozlowski wrote:
> 2015-10-06 22:41 GMT+09:00 Marek Szyprowski <m.szyprowski@samsung.com>:
>> 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>
>> ---
>> This is just a resend of a patch posted in the following thread:
>> https://lkml.org/lkml/2015/8/21/306
>>
>> I really hope that it will finally get merged to v4.4. For more
>> information and background, please refer to the mentioned thread.
>>
>> Marek Szyprowski
>> ---
>>   .../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(-)
> Any particular reason to dropping my tested-by? Do you changed here anything?

Nope, I just forgot to add your "Tested-by: Krzysztof Kozlowski
<k.kozlowski@samsung.com>".

This was a pure resend, no changes to the patch has been made. I just 
noticed
that it is over 6 weeks since the initial submission and the patch is still
not in linux-next...

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND] phy: exynos-usb2: add vbus regulator support
  2015-10-06 14:09   ` Marek Szyprowski
@ 2015-10-06 14:29     ` Kishon Vijay Abraham I
  2015-10-06 15:02       ` Javier Martinez Canillas
  0 siblings, 1 reply; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2015-10-06 14:29 UTC (permalink / raw)
  To: Marek Szyprowski, Krzysztof Kozlowski; +Cc: linux-kernel, linux-samsung-soc

Hi,

On Tuesday 06 October 2015 07:39 PM, Marek Szyprowski wrote:
> Hello,
> 
> On 2015-10-06 15:47, Krzysztof Kozlowski wrote:
>> 2015-10-06 22:41 GMT+09:00 Marek Szyprowski <m.szyprowski@samsung.com>:
>>> 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>
>>> ---
>>> This is just a resend of a patch posted in the following thread:
>>> https://lkml.org/lkml/2015/8/21/306
>>>
>>> I really hope that it will finally get merged to v4.4. For more
>>> information and background, please refer to the mentioned thread.
>>>
>>> Marek Szyprowski
>>> ---
>>>   .../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(-)
>> Any particular reason to dropping my tested-by? Do you changed here
>> anything?
> 
> Nope, I just forgot to add your "Tested-by: Krzysztof Kozlowski
> <k.kozlowski@samsung.com>".
> 
> This was a pure resend, no changes to the patch has been made. I just
> noticed
> that it is over 6 weeks since the initial submission and the patch is still
> not in linux-next...

It won't be in linux-next. I've just merged this patch to linux-phy
-next and will be sent during the next merge window. Only fixes will be
merged during the -rc releases.

Thanks
Kishon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND] phy: exynos-usb2: add vbus regulator support
  2015-10-06 14:29     ` Kishon Vijay Abraham I
@ 2015-10-06 15:02       ` Javier Martinez Canillas
  0 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2015-10-06 15:02 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Marek Szyprowski, Krzysztof Kozlowski
  Cc: linux-kernel, linux-samsung-soc

Hello Kishon,

On 10/06/2015 04:29 PM, Kishon Vijay Abraham I wrote:
> On Tuesday 06 October 2015 07:39 PM, Marek Szyprowski wrote:

[snip]

>>
>> This was a pure resend, no changes to the patch has been made. I just
>> noticed
>> that it is over 6 weeks since the initial submission and the patch is still
>> not in linux-next...
> 
> It won't be in linux-next. I've just merged this patch to linux-phy
> -next and will be sent during the next merge window. Only fixes will be
> merged during the -rc releases.
>

When patches are pushed to mainline it's somehow orthogonal to what is
exposed in -next. Only fixes for regressions will be pushed during the
-rc cycle and new features will be pushed during the next merge window
of course but that should not prevent accepted patches to get some test
coverage under -next.

In fact, ideally patches should sit in -next for a couple of weeks before
are pushed to mainline since there is a lot of automated (0day, kernelci,
etc) and manual testing that happen on that tree to detect issues earlier.

I noticed that linux-phy isn't shown in [0] though, probably should be added?

> Thanks
> Kishon
> --

[0]: http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/Next/Trees?id=HEAD

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-06 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-06 13:41 [PATCH RESEND] phy: exynos-usb2: add vbus regulator support Marek Szyprowski
2015-10-06 13:47 ` Krzysztof Kozlowski
2015-10-06 14:09   ` Marek Szyprowski
2015-10-06 14:29     ` Kishon Vijay Abraham I
2015-10-06 15:02       ` Javier Martinez Canillas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).