All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] PHY: ti-pipe3: Manage 3.3V PHY regulator
@ 2014-06-30 11:00 Roger Quadros
       [not found] ` <1404126038-19974-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
  2014-06-30 11:00 ` [PATCH 3/3] ARM: dts: dra7-evm: Add regulator information to USB2 PHYs Roger Quadros
  0 siblings, 2 replies; 11+ messages in thread
From: Roger Quadros @ 2014-06-30 11:00 UTC (permalink / raw)
  To: kishon-l0cyMroinI0, balbi-l0cyMroinI0, tony-4v6yS6AI5VpBDgjK7y7TUQ
  Cc: nm-l0cyMroinI0, t-kristo-l0cyMroinI0,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Roger Quadros

Hi,

On some SoCs e.g. J6 the 3.3V supply to the USB2 PHY can be
powered down when the PHY is not in use. Add regulator
management code to control this power line.

cheers,
-roger
---

Roger Quadros (3):
  phy: omap-usb2: Manage PHY 3.3V supply regulator
  phy: omap-usb2: Add PHY regulator to DT binding documentation
  ARM: dts: dra7-evm: Add regulator information to USB2 PHYs

 Documentation/devicetree/bindings/phy/ti-phy.txt |  1 +
 arch/arm/boot/dts/dra7-evm.dts                   |  8 ++++++++
 drivers/phy/phy-omap-usb2.c                      | 25 ++++++++++++++++++++++++
 include/linux/phy/omap_usb.h                     |  1 +
 4 files changed, 35 insertions(+)

-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator
       [not found] ` <1404126038-19974-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
@ 2014-06-30 11:00   ` Roger Quadros
       [not found]     ` <1404126038-19974-2-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
  2014-06-30 11:00   ` [PATCH 2/3] phy: omap-usb2: Add PHY regulator to DT binding documentation Roger Quadros
  1 sibling, 1 reply; 11+ messages in thread
From: Roger Quadros @ 2014-06-30 11:00 UTC (permalink / raw)
  To: kishon-l0cyMroinI0, balbi-l0cyMroinI0, tony-4v6yS6AI5VpBDgjK7y7TUQ
  Cc: nm-l0cyMroinI0, t-kristo-l0cyMroinI0,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Roger Quadros

On some SoCs e.g. J6 the 3.3V supply to the USB2 PHY can be
powered down when the PHY is not in use. Add regulator
management code to control this power line.

Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
---
 drivers/phy/phy-omap-usb2.c  | 25 +++++++++++++++++++++++++
 include/linux/phy/omap_usb.h |  1 +
 2 files changed, 26 insertions(+)

diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 7007c11..2afc79c 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -30,6 +30,7 @@
 #include <linux/phy/omap_control_phy.h>
 #include <linux/phy/phy.h>
 #include <linux/of_platform.h>
+#include <linux/regulator/consumer.h>
 
 #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
 #define USB2PHY_ANA_CONFIG1 0x4c
@@ -107,6 +108,14 @@ static int omap_usb_power_off(struct phy *x)
 
 	omap_control_phy_power(phy->control_dev, 0);
 
+	if (phy->pwr) {
+		int ret;
+
+		ret = regulator_disable(phy->pwr);
+		if (ret)
+			return ret;
+	}
+
 	return 0;
 }
 
@@ -114,6 +123,14 @@ static int omap_usb_power_on(struct phy *x)
 {
 	struct omap_usb *phy = phy_get_drvdata(x);
 
+	if (phy->pwr) {
+		int ret;
+
+		ret = regulator_enable(phy->pwr);
+		if (ret)
+			return ret;
+	}
+
 	omap_control_phy_power(phy->control_dev, 1);
 
 	return 0;
@@ -253,6 +270,14 @@ static int omap_usb2_probe(struct platform_device *pdev)
 	phy->control_dev = &control_pdev->dev;
 	omap_control_phy_power(phy->control_dev, 0);
 
+	/* phy-supply */
+	phy->pwr = devm_regulator_get_optional(phy->dev, "phy");
+	if (IS_ERR(phy->pwr)) {
+		if (PTR_ERR(phy->pwr) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+		phy->pwr = NULL;
+	}
+
 	otg->set_host		= omap_usb_set_host;
 	otg->set_peripheral	= omap_usb_set_peripheral;
 	if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS)
diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h
index dc2c541..e2c46df 100644
--- a/include/linux/phy/omap_usb.h
+++ b/include/linux/phy/omap_usb.h
@@ -40,6 +40,7 @@ struct omap_usb {
 	struct clk		*wkupclk;
 	struct clk		*optclk;
 	u8			flags;
+	struct regulator	*pwr;
 };
 
 struct usb_phy_data {
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/3] phy: omap-usb2: Add PHY regulator to DT binding documentation
       [not found] ` <1404126038-19974-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
  2014-06-30 11:00   ` [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator Roger Quadros
@ 2014-06-30 11:00   ` Roger Quadros
  1 sibling, 0 replies; 11+ messages in thread
From: Roger Quadros @ 2014-06-30 11:00 UTC (permalink / raw)
  To: kishon-l0cyMroinI0, balbi-l0cyMroinI0, tony-4v6yS6AI5VpBDgjK7y7TUQ
  Cc: nm-l0cyMroinI0, t-kristo-l0cyMroinI0,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Roger Quadros

The PHY driver can manage a regulator that supplies power to
the USB2 PHY. Add DT binding information for that.

Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
---
 Documentation/devicetree/bindings/phy/ti-phy.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index 9ce458f..a6acd99 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -41,6 +41,7 @@ Required properties:
 Optional properties:
  - ctrl-module : phandle of the control module used by PHY driver to power on
    the PHY.
+ - phy-supply: phandle of the regulator that supplies power to the PHY.
 
 This is usually a subnode of ocp2scp to which it is connected.
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 3/3] ARM: dts: dra7-evm: Add regulator information to USB2 PHYs
  2014-06-30 11:00 [PATCH 0/3] PHY: ti-pipe3: Manage 3.3V PHY regulator Roger Quadros
       [not found] ` <1404126038-19974-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
@ 2014-06-30 11:00 ` Roger Quadros
  2014-07-09 11:56   ` Tony Lindgren
  1 sibling, 1 reply; 11+ messages in thread
From: Roger Quadros @ 2014-06-30 11:00 UTC (permalink / raw)
  To: kishon, balbi, tony; +Cc: nm, t-kristo, linux-omap, linux-usb, Roger Quadros

The ldousb_reg regulator provides power to the USB1 and USB2
High Speed PHYs.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 arch/arm/boot/dts/dra7-evm.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts
index 4adc280..fd96ced 100644
--- a/arch/arm/boot/dts/dra7-evm.dts
+++ b/arch/arm/boot/dts/dra7-evm.dts
@@ -495,3 +495,11 @@
 		};
 	};
 };
+
+&usb2_phy1 {
+	phy-supply = <&ldousb_reg>;
+};
+
+&usb2_phy2 {
+	phy-supply = <&ldousb_reg>;
+};
-- 
1.8.3.2


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

* Re: [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator
       [not found]     ` <1404126038-19974-2-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
@ 2014-06-30 17:09       ` Felipe Balbi
  2014-07-01  9:56       ` Kishon Vijay Abraham I
  1 sibling, 0 replies; 11+ messages in thread
From: Felipe Balbi @ 2014-06-30 17:09 UTC (permalink / raw)
  To: Roger Quadros
  Cc: kishon-l0cyMroinI0, balbi-l0cyMroinI0,
	tony-4v6yS6AI5VpBDgjK7y7TUQ, nm-l0cyMroinI0,
	t-kristo-l0cyMroinI0, linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 2527 bytes --]

Hi,

On Mon, Jun 30, 2014 at 02:00:36PM +0300, Roger Quadros wrote:
> On some SoCs e.g. J6 the 3.3V supply to the USB2 PHY can be
> powered down when the PHY is not in use. Add regulator
> management code to control this power line.
> 
> Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>

Reviewed-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>

> ---
>  drivers/phy/phy-omap-usb2.c  | 25 +++++++++++++++++++++++++
>  include/linux/phy/omap_usb.h |  1 +
>  2 files changed, 26 insertions(+)
> 
> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
> index 7007c11..2afc79c 100644
> --- a/drivers/phy/phy-omap-usb2.c
> +++ b/drivers/phy/phy-omap-usb2.c
> @@ -30,6 +30,7 @@
>  #include <linux/phy/omap_control_phy.h>
>  #include <linux/phy/phy.h>
>  #include <linux/of_platform.h>
> +#include <linux/regulator/consumer.h>
>  
>  #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
>  #define USB2PHY_ANA_CONFIG1 0x4c
> @@ -107,6 +108,14 @@ static int omap_usb_power_off(struct phy *x)
>  
>  	omap_control_phy_power(phy->control_dev, 0);
>  
> +	if (phy->pwr) {
> +		int ret;
> +
> +		ret = regulator_disable(phy->pwr);
> +		if (ret)
> +			return ret;
> +	}
> +
>  	return 0;
>  }
>  
> @@ -114,6 +123,14 @@ static int omap_usb_power_on(struct phy *x)
>  {
>  	struct omap_usb *phy = phy_get_drvdata(x);
>  
> +	if (phy->pwr) {
> +		int ret;
> +
> +		ret = regulator_enable(phy->pwr);
> +		if (ret)
> +			return ret;
> +	}
> +
>  	omap_control_phy_power(phy->control_dev, 1);
>  
>  	return 0;
> @@ -253,6 +270,14 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  	phy->control_dev = &control_pdev->dev;
>  	omap_control_phy_power(phy->control_dev, 0);
>  
> +	/* phy-supply */
> +	phy->pwr = devm_regulator_get_optional(phy->dev, "phy");
> +	if (IS_ERR(phy->pwr)) {
> +		if (PTR_ERR(phy->pwr) == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;
> +		phy->pwr = NULL;
> +	}
> +
>  	otg->set_host		= omap_usb_set_host;
>  	otg->set_peripheral	= omap_usb_set_peripheral;
>  	if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS)
> diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h
> index dc2c541..e2c46df 100644
> --- a/include/linux/phy/omap_usb.h
> +++ b/include/linux/phy/omap_usb.h
> @@ -40,6 +40,7 @@ struct omap_usb {
>  	struct clk		*wkupclk;
>  	struct clk		*optclk;
>  	u8			flags;
> +	struct regulator	*pwr;
>  };
>  
>  struct usb_phy_data {
> -- 
> 1.8.3.2
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator
       [not found]     ` <1404126038-19974-2-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
  2014-06-30 17:09       ` Felipe Balbi
@ 2014-07-01  9:56       ` Kishon Vijay Abraham I
       [not found]         ` <53B285DC.8070102-l0cyMroinI0@public.gmane.org>
  1 sibling, 1 reply; 11+ messages in thread
From: Kishon Vijay Abraham I @ 2014-07-01  9:56 UTC (permalink / raw)
  To: Roger Quadros, balbi-l0cyMroinI0, tony-4v6yS6AI5VpBDgjK7y7TUQ
  Cc: nm-l0cyMroinI0, t-kristo-l0cyMroinI0,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA

Hi Roger,

On Monday 30 June 2014 04:30 PM, Roger Quadros wrote:
> On some SoCs e.g. J6 the 3.3V supply to the USB2 PHY can be
> powered down when the PHY is not in use. Add regulator
> management code to control this power line.
> 
> Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
> ---
>  drivers/phy/phy-omap-usb2.c  | 25 +++++++++++++++++++++++++
>  include/linux/phy/omap_usb.h |  1 +
>  2 files changed, 26 insertions(+)
> 
> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
> index 7007c11..2afc79c 100644
> --- a/drivers/phy/phy-omap-usb2.c
> +++ b/drivers/phy/phy-omap-usb2.c
> @@ -30,6 +30,7 @@
>  #include <linux/phy/omap_control_phy.h>
>  #include <linux/phy/phy.h>
>  #include <linux/of_platform.h>
> +#include <linux/regulator/consumer.h>
>  
>  #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
>  #define USB2PHY_ANA_CONFIG1 0x4c
> @@ -107,6 +108,14 @@ static int omap_usb_power_off(struct phy *x)
>  
>  	omap_control_phy_power(phy->control_dev, 0);
>  
> +	if (phy->pwr) {
> +		int ret;
> +
> +		ret = regulator_disable(phy->pwr);
> +		if (ret)
> +			return ret;
> +	}
> +
>  	return 0;
>  }
>  
> @@ -114,6 +123,14 @@ static int omap_usb_power_on(struct phy *x)
>  {
>  	struct omap_usb *phy = phy_get_drvdata(x);
>  
> +	if (phy->pwr) {
> +		int ret;
> +
> +		ret = regulator_enable(phy->pwr);
> +		if (ret)
> +			return ret;
> +	}
> +

Shouldn't we do this in phy_power_on/phy_power_off in phy-core?

Cheers
Kishon

>  	omap_control_phy_power(phy->control_dev, 1);
>  
>  	return 0;
> @@ -253,6 +270,14 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  	phy->control_dev = &control_pdev->dev;
>  	omap_control_phy_power(phy->control_dev, 0);
>  
> +	/* phy-supply */
> +	phy->pwr = devm_regulator_get_optional(phy->dev, "phy");
> +	if (IS_ERR(phy->pwr)) {
> +		if (PTR_ERR(phy->pwr) == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;
> +		phy->pwr = NULL;
> +	}
> +
>  	otg->set_host		= omap_usb_set_host;
>  	otg->set_peripheral	= omap_usb_set_peripheral;
>  	if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS)
> diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h
> index dc2c541..e2c46df 100644
> --- a/include/linux/phy/omap_usb.h
> +++ b/include/linux/phy/omap_usb.h
> @@ -40,6 +40,7 @@ struct omap_usb {
>  	struct clk		*wkupclk;
>  	struct clk		*optclk;
>  	u8			flags;
> +	struct regulator	*pwr;
>  };
>  
>  struct usb_phy_data {
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator
       [not found]         ` <53B285DC.8070102-l0cyMroinI0@public.gmane.org>
@ 2014-07-01 10:13           ` Roger Quadros
  2014-07-01 10:20             ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 11+ messages in thread
From: Roger Quadros @ 2014-07-01 10:13 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, balbi-l0cyMroinI0, tony-4v6yS6AI5VpBDgjK7y7TUQ
  Cc: nm-l0cyMroinI0, t-kristo-l0cyMroinI0,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA

On 07/01/2014 12:56 PM, Kishon Vijay Abraham I wrote:
> Hi Roger,
> 
> On Monday 30 June 2014 04:30 PM, Roger Quadros wrote:
>> On some SoCs e.g. J6 the 3.3V supply to the USB2 PHY can be
>> powered down when the PHY is not in use. Add regulator
>> management code to control this power line.
>>
>> Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
>> ---
>>  drivers/phy/phy-omap-usb2.c  | 25 +++++++++++++++++++++++++
>>  include/linux/phy/omap_usb.h |  1 +
>>  2 files changed, 26 insertions(+)
>>
>> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
>> index 7007c11..2afc79c 100644
>> --- a/drivers/phy/phy-omap-usb2.c
>> +++ b/drivers/phy/phy-omap-usb2.c
>> @@ -30,6 +30,7 @@
>>  #include <linux/phy/omap_control_phy.h>
>>  #include <linux/phy/phy.h>
>>  #include <linux/of_platform.h>
>> +#include <linux/regulator/consumer.h>
>>  
>>  #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
>>  #define USB2PHY_ANA_CONFIG1 0x4c
>> @@ -107,6 +108,14 @@ static int omap_usb_power_off(struct phy *x)
>>  
>>  	omap_control_phy_power(phy->control_dev, 0);
>>  
>> +	if (phy->pwr) {
>> +		int ret;
>> +
>> +		ret = regulator_disable(phy->pwr);
>> +		if (ret)
>> +			return ret;
>> +	}
>> +
>>  	return 0;
>>  }
>>  
>> @@ -114,6 +123,14 @@ static int omap_usb_power_on(struct phy *x)
>>  {
>>  	struct omap_usb *phy = phy_get_drvdata(x);
>>  
>> +	if (phy->pwr) {
>> +		int ret;
>> +
>> +		ret = regulator_enable(phy->pwr);
>> +		if (ret)
>> +			return ret;
>> +	}
>> +
> 
> Shouldn't we do this in phy_power_on/phy_power_off in phy-core?

I thought about that earlier, but could not find a way to defer probing if the regulator is not-yet probed.
Any clues how it could be done in phy-core?

cheers,
-roger

> 
>>  	omap_control_phy_power(phy->control_dev, 1);
>>  
>>  	return 0;
>> @@ -253,6 +270,14 @@ static int omap_usb2_probe(struct platform_device *pdev)
>>  	phy->control_dev = &control_pdev->dev;
>>  	omap_control_phy_power(phy->control_dev, 0);
>>  
>> +	/* phy-supply */
>> +	phy->pwr = devm_regulator_get_optional(phy->dev, "phy");
>> +	if (IS_ERR(phy->pwr)) {
>> +		if (PTR_ERR(phy->pwr) == -EPROBE_DEFER)
>> +			return -EPROBE_DEFER;
>> +		phy->pwr = NULL;
>> +	}
>> +
>>  	otg->set_host		= omap_usb_set_host;
>>  	otg->set_peripheral	= omap_usb_set_peripheral;
>>  	if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS)
>> diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h
>> index dc2c541..e2c46df 100644
>> --- a/include/linux/phy/omap_usb.h
>> +++ b/include/linux/phy/omap_usb.h
>> @@ -40,6 +40,7 @@ struct omap_usb {
>>  	struct clk		*wkupclk;
>>  	struct clk		*optclk;
>>  	u8			flags;
>> +	struct regulator	*pwr;
>>  };
>>  
>>  struct usb_phy_data {
>>

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator
  2014-07-01 10:13           ` Roger Quadros
@ 2014-07-01 10:20             ` Kishon Vijay Abraham I
  2014-07-01 10:25               ` Roger Quadros
  0 siblings, 1 reply; 11+ messages in thread
From: Kishon Vijay Abraham I @ 2014-07-01 10:20 UTC (permalink / raw)
  To: Roger Quadros, balbi, tony; +Cc: nm, t-kristo, linux-omap, linux-usb

Hi,

On Tuesday 01 July 2014 03:43 PM, Roger Quadros wrote:
> On 07/01/2014 12:56 PM, Kishon Vijay Abraham I wrote:
>> Hi Roger,
>>
>> On Monday 30 June 2014 04:30 PM, Roger Quadros wrote:
>>> On some SoCs e.g. J6 the 3.3V supply to the USB2 PHY can be
>>> powered down when the PHY is not in use. Add regulator
>>> management code to control this power line.
>>>
>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>> ---
>>>  drivers/phy/phy-omap-usb2.c  | 25 +++++++++++++++++++++++++
>>>  include/linux/phy/omap_usb.h |  1 +
>>>  2 files changed, 26 insertions(+)
>>>
>>> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
>>> index 7007c11..2afc79c 100644
>>> --- a/drivers/phy/phy-omap-usb2.c
>>> +++ b/drivers/phy/phy-omap-usb2.c
>>> @@ -30,6 +30,7 @@
>>>  #include <linux/phy/omap_control_phy.h>
>>>  #include <linux/phy/phy.h>
>>>  #include <linux/of_platform.h>
>>> +#include <linux/regulator/consumer.h>
>>>  
>>>  #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
>>>  #define USB2PHY_ANA_CONFIG1 0x4c
>>> @@ -107,6 +108,14 @@ static int omap_usb_power_off(struct phy *x)
>>>  
>>>  	omap_control_phy_power(phy->control_dev, 0);
>>>  
>>> +	if (phy->pwr) {
>>> +		int ret;
>>> +
>>> +		ret = regulator_disable(phy->pwr);
>>> +		if (ret)
>>> +			return ret;
>>> +	}
>>> +
>>>  	return 0;
>>>  }
>>>  
>>> @@ -114,6 +123,14 @@ static int omap_usb_power_on(struct phy *x)
>>>  {
>>>  	struct omap_usb *phy = phy_get_drvdata(x);
>>>  
>>> +	if (phy->pwr) {
>>> +		int ret;
>>> +
>>> +		ret = regulator_enable(phy->pwr);
>>> +		if (ret)
>>> +			return ret;
>>> +	}
>>> +
>>
>> Shouldn't we do this in phy_power_on/phy_power_off in phy-core?
> 
> I thought about that earlier, but could not find a way to defer probing if the regulator is not-yet probed.
> Any clues how it could be done in phy-core?

We can try to do regulator_get in phy_create and return EPROBE_DEFER if the
regulator_get returns EPROBE_DEFER no?

Cheers
Kishon

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

* Re: [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator
  2014-07-01 10:20             ` Kishon Vijay Abraham I
@ 2014-07-01 10:25               ` Roger Quadros
       [not found]                 ` <53B28CB5.1070306-l0cyMroinI0@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Roger Quadros @ 2014-07-01 10:25 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, balbi, tony; +Cc: nm, t-kristo, linux-omap, linux-usb

On 07/01/2014 01:20 PM, Kishon Vijay Abraham I wrote:
> Hi,
> 
> On Tuesday 01 July 2014 03:43 PM, Roger Quadros wrote:
>> On 07/01/2014 12:56 PM, Kishon Vijay Abraham I wrote:
>>> Hi Roger,
>>>
>>> On Monday 30 June 2014 04:30 PM, Roger Quadros wrote:
>>>> On some SoCs e.g. J6 the 3.3V supply to the USB2 PHY can be
>>>> powered down when the PHY is not in use. Add regulator
>>>> management code to control this power line.
>>>>
>>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>>> ---
>>>>  drivers/phy/phy-omap-usb2.c  | 25 +++++++++++++++++++++++++
>>>>  include/linux/phy/omap_usb.h |  1 +
>>>>  2 files changed, 26 insertions(+)
>>>>
>>>> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
>>>> index 7007c11..2afc79c 100644
>>>> --- a/drivers/phy/phy-omap-usb2.c
>>>> +++ b/drivers/phy/phy-omap-usb2.c
>>>> @@ -30,6 +30,7 @@
>>>>  #include <linux/phy/omap_control_phy.h>
>>>>  #include <linux/phy/phy.h>
>>>>  #include <linux/of_platform.h>
>>>> +#include <linux/regulator/consumer.h>
>>>>  
>>>>  #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
>>>>  #define USB2PHY_ANA_CONFIG1 0x4c
>>>> @@ -107,6 +108,14 @@ static int omap_usb_power_off(struct phy *x)
>>>>  
>>>>  	omap_control_phy_power(phy->control_dev, 0);
>>>>  
>>>> +	if (phy->pwr) {
>>>> +		int ret;
>>>> +
>>>> +		ret = regulator_disable(phy->pwr);
>>>> +		if (ret)
>>>> +			return ret;
>>>> +	}
>>>> +
>>>>  	return 0;
>>>>  }
>>>>  
>>>> @@ -114,6 +123,14 @@ static int omap_usb_power_on(struct phy *x)
>>>>  {
>>>>  	struct omap_usb *phy = phy_get_drvdata(x);
>>>>  
>>>> +	if (phy->pwr) {
>>>> +		int ret;
>>>> +
>>>> +		ret = regulator_enable(phy->pwr);
>>>> +		if (ret)
>>>> +			return ret;
>>>> +	}
>>>> +
>>>
>>> Shouldn't we do this in phy_power_on/phy_power_off in phy-core?
>>
>> I thought about that earlier, but could not find a way to defer probing if the regulator is not-yet probed.
>> Any clues how it could be done in phy-core?
> 
> We can try to do regulator_get in phy_create and return EPROBE_DEFER if the
> regulator_get returns EPROBE_DEFER no?

Yes indeed, we can. I missed the phy_create() and was only looking at phy_init() and phy_power_*() :P.
I'll post a v2 soon.

cheers,
-roger

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

* Re: [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator
       [not found]                 ` <53B28CB5.1070306-l0cyMroinI0@public.gmane.org>
@ 2014-07-01 10:37                   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 11+ messages in thread
From: Kishon Vijay Abraham I @ 2014-07-01 10:37 UTC (permalink / raw)
  To: Roger Quadros, balbi-l0cyMroinI0, tony-4v6yS6AI5VpBDgjK7y7TUQ
  Cc: nm-l0cyMroinI0, t-kristo-l0cyMroinI0,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA



On Tuesday 01 July 2014 03:55 PM, Roger Quadros wrote:
> On 07/01/2014 01:20 PM, Kishon Vijay Abraham I wrote:
>> Hi,
>>
>> On Tuesday 01 July 2014 03:43 PM, Roger Quadros wrote:
>>> On 07/01/2014 12:56 PM, Kishon Vijay Abraham I wrote:
>>>> Hi Roger,
>>>>
>>>> On Monday 30 June 2014 04:30 PM, Roger Quadros wrote:
>>>>> On some SoCs e.g. J6 the 3.3V supply to the USB2 PHY can be
>>>>> powered down when the PHY is not in use. Add regulator
>>>>> management code to control this power line.
>>>>>
>>>>> Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
>>>>> ---
>>>>>  drivers/phy/phy-omap-usb2.c  | 25 +++++++++++++++++++++++++
>>>>>  include/linux/phy/omap_usb.h |  1 +
>>>>>  2 files changed, 26 insertions(+)
>>>>>
>>>>> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
>>>>> index 7007c11..2afc79c 100644
>>>>> --- a/drivers/phy/phy-omap-usb2.c
>>>>> +++ b/drivers/phy/phy-omap-usb2.c
>>>>> @@ -30,6 +30,7 @@
>>>>>  #include <linux/phy/omap_control_phy.h>
>>>>>  #include <linux/phy/phy.h>
>>>>>  #include <linux/of_platform.h>
>>>>> +#include <linux/regulator/consumer.h>
>>>>>  
>>>>>  #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
>>>>>  #define USB2PHY_ANA_CONFIG1 0x4c
>>>>> @@ -107,6 +108,14 @@ static int omap_usb_power_off(struct phy *x)
>>>>>  
>>>>>  	omap_control_phy_power(phy->control_dev, 0);
>>>>>  
>>>>> +	if (phy->pwr) {
>>>>> +		int ret;
>>>>> +
>>>>> +		ret = regulator_disable(phy->pwr);
>>>>> +		if (ret)
>>>>> +			return ret;
>>>>> +	}
>>>>> +
>>>>>  	return 0;
>>>>>  }
>>>>>  
>>>>> @@ -114,6 +123,14 @@ static int omap_usb_power_on(struct phy *x)
>>>>>  {
>>>>>  	struct omap_usb *phy = phy_get_drvdata(x);
>>>>>  
>>>>> +	if (phy->pwr) {
>>>>> +		int ret;
>>>>> +
>>>>> +		ret = regulator_enable(phy->pwr);
>>>>> +		if (ret)
>>>>> +			return ret;
>>>>> +	}
>>>>> +
>>>>
>>>> Shouldn't we do this in phy_power_on/phy_power_off in phy-core?
>>>
>>> I thought about that earlier, but could not find a way to defer probing if the regulator is not-yet probed.
>>> Any clues how it could be done in phy-core?
>>
>> We can try to do regulator_get in phy_create and return EPROBE_DEFER if the
>> regulator_get returns EPROBE_DEFER no?
> 
> Yes indeed, we can. I missed the phy_create() and was only looking at phy_init() and phy_power_*() :P.
> I'll post a v2 soon.

cool. Thanks :-)

-Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 3/3] ARM: dts: dra7-evm: Add regulator information to USB2 PHYs
  2014-06-30 11:00 ` [PATCH 3/3] ARM: dts: dra7-evm: Add regulator information to USB2 PHYs Roger Quadros
@ 2014-07-09 11:56   ` Tony Lindgren
  0 siblings, 0 replies; 11+ messages in thread
From: Tony Lindgren @ 2014-07-09 11:56 UTC (permalink / raw)
  To: Roger Quadros; +Cc: kishon, balbi, nm, t-kristo, linux-omap, linux-usb

* Roger Quadros <rogerq@ti.com> [140630 04:02]:
> The ldousb_reg regulator provides power to the USB1 and USB2
> High Speed PHYs.

Applying this one into omap-for-v3.17/dt thanks.

Tony

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

end of thread, other threads:[~2014-07-09 11:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-30 11:00 [PATCH 0/3] PHY: ti-pipe3: Manage 3.3V PHY regulator Roger Quadros
     [not found] ` <1404126038-19974-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2014-06-30 11:00   ` [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator Roger Quadros
     [not found]     ` <1404126038-19974-2-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2014-06-30 17:09       ` Felipe Balbi
2014-07-01  9:56       ` Kishon Vijay Abraham I
     [not found]         ` <53B285DC.8070102-l0cyMroinI0@public.gmane.org>
2014-07-01 10:13           ` Roger Quadros
2014-07-01 10:20             ` Kishon Vijay Abraham I
2014-07-01 10:25               ` Roger Quadros
     [not found]                 ` <53B28CB5.1070306-l0cyMroinI0@public.gmane.org>
2014-07-01 10:37                   ` Kishon Vijay Abraham I
2014-06-30 11:00   ` [PATCH 2/3] phy: omap-usb2: Add PHY regulator to DT binding documentation Roger Quadros
2014-06-30 11:00 ` [PATCH 3/3] ARM: dts: dra7-evm: Add regulator information to USB2 PHYs Roger Quadros
2014-07-09 11:56   ` Tony Lindgren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.