PHY: ti-pipe3: Manage 3.3V PHY regulator
Subsystems (2)
cover PHY: ti-pipe3: Manage 3.3V PHY regulator
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(+)
Signature · 6 lines
1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1404126038-19974-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org
PATCH 1/3 phy: omap-usb2: Manage PHY 3.3V supply regulator
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.
--- drivers/phy/phy-omap-usb2.c | 25 +++++++++++++++++++++++++ include/linux/phy/omap_usb.h | 1 + 2 files changed, 26 insertions(+)
drivers/phy/phy-omap-usb2.c +25 -0
@@ -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 )
include/linux/phy/omap_usb.h +1 -0
@@ -40,6 +40,7 @@ struct omap_usb {struct clk *wkupclk;struct clk *optclk;u8 flags; +struct regulator *pwr; };struct usb_phy_data {
Signature · 6 lines
1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1404126038-19974-2-git-send-email-rogerq-l0cyMroinI0@public.gmane.org
Felipe Balbi
Reviewed-byRe: [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator
Hi,
Quoted 5 lines · 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 <[email protected]>
Quoted 77 lines
--- drivers/phy/phy-omap-usb2.c | 25 +++++++++++++++++++++++++ include/linux/phy/omap_usb.h | 1 + 2 files changed, 26 insertions(+)drivers/phy/phy-omap-usb2.c +25
-0@@ -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 )include/linux/phy/omap_usb.h +1
-0@@ -40,6 +40,7 @@ struct omap_usb {struct clk *wkupclk;struct clk *optclk;u8 flags; +struct regulator *pwr; };struct usb_phy_data {Signature · 1 line
1.8.3.2
Signature · 1 line
balbi
Re: [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator
In reply to a message not in the archiveHi Roger,
Quoted 39 lines · 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 <[email protected]>--- drivers/phy/phy-omap-usb2.c | 25 +++++++++++++++++++++++++ include/linux/phy/omap_usb.h | 1 + 2 files changed, 26 insertions(+)drivers/phy/phy-omap-usb2.c +9
-0@@ -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) {
drivers/phy/phy-omap-usb2.c static int omap_usb_power_on(struct phy *x) · line 133
Quoted 10 lines
drivers/phy/phy-omap-usb2.c +8
-0struct 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
Quoted 24 lines
drivers/phy/phy-omap-usb2.c +8
-0omap_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 )include/linux/phy/omap_usb.h +0
-0
include/linux/phy/omap_usb.h struct omap_usb { · line 46
Quoted 7 lines
include/linux/phy/omap_usb.h +1
-0@@ -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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator
Quoted 44 lines · Kishon Vijay Abraham I
Hi Roger,
Quoted 41 lines · 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 <[email protected]>--- drivers/phy/phy-omap-usb2.c | 25 +++++++++++++++++++++++++ include/linux/phy/omap_usb.h | 1 + 2 files changed, 26 insertions(+)drivers/phy/phy-omap-usb2.c +9
-0@@ -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);
Quoted 10 lines
drivers/phy/phy-omap-usb2.c static int omap_usb_power_on(struct phy *x) · line 133
Quoted 8 lines
drivers/phy/phy-omap-usb2.c +8
-0+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
Quoted 30 lines
Quoted 30 lines
drivers/phy/phy-omap-usb2.c +8
-0omap_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 )include/linux/phy/omap_usb.h +1
-0@@ -40,6 +40,7 @@ struct omap_usb {struct clk *wkupclk;struct clk *optclk;u8 flags; +struct regulator *pwr; };
Quoted 2 lines
include/linux/phy/omap_usb.h struct omap_usb { · line 46
Quoted 2 lines
include/linux/phy/omap_usb.h +0
-0struct usb_phy_data {
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator
Hi,
Quoted 56 lines · Roger Quadros
Quoted 44 lines · Kishon Vijay Abraham I
Hi Roger,
Quoted 41 lines · 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 <[email protected]>--- drivers/phy/phy-omap-usb2.c | 25 +++++++++++++++++++++++++ include/linux/phy/omap_usb.h | 1 + 2 files changed, 26 insertions(+)drivers/phy/phy-omap-usb2.c +9
-0@@ -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);Quoted 10 lines
drivers/phy/phy-omap-usb2.c static int omap_usb_power_on(struct phy *x) · line 133
Quoted 8 lines
drivers/phy/phy-omap-usb2.c +8
-0+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?
Quoted 2 lines
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
Re: [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator
Quoted 59 lines · Kishon Vijay Abraham I
Hi,
Quoted 56 lines · Roger Quadros
Quoted 54 lines · Kishon Vijay Abraham I
Hi Roger,
Quoted 39 lines · 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 <[email protected]>--- drivers/phy/phy-omap-usb2.c | 25 +++++++++++++++++++++++++ include/linux/phy/omap_usb.h | 1 + 2 files changed, 26 insertions(+)drivers/phy/phy-omap-usb2.c +9
-0@@ -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) {drivers/phy/phy-omap-usb2.c static int omap_usb_power_on(struct phy *x) · line 133
Quoted 10 lines
drivers/phy/phy-omap-usb2.c +8
-0struct 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?
Quoted 5 lines
Quoted 2 lines
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_getinphy_createand returnEPROBE_DEFERif theregulator_getreturnsEPROBE_DEFERno?
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
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator
Quoted 60 lines · Roger Quadros
Quoted 59 lines · Kishon Vijay Abraham I
Hi,
Quoted 56 lines · Roger Quadros
Quoted 54 lines · Kishon Vijay Abraham I
Hi Roger,
Quoted 39 lines · 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 <[email protected]>--- drivers/phy/phy-omap-usb2.c | 25 +++++++++++++++++++++++++ include/linux/phy/omap_usb.h | 1 + 2 files changed, 26 insertions(+)drivers/phy/phy-omap-usb2.c +9
-0@@ -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) {drivers/phy/phy-omap-usb2.c static int omap_usb_power_on(struct phy *x) · line 133
Quoted 10 lines
drivers/phy/phy-omap-usb2.c +8
-0struct 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?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
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_getinphy_createand returnEPROBE_DEFERif theregulator_getreturnsEPROBE_DEFERno?Yes indeed, we can. I missed the
phy_create()and was only looking atphy_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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/3 phy: omap-usb2: Add PHY regulator to DT binding documentation
In reply to a message not in the archiveThe PHY driver can manage a regulator that supplies power to the USB2 PHY. Add DT binding information for that.
--- Documentation/devicetree/bindings/phy/ti-phy.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/phy/ti-phy.txt +1 -0
@@ -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.
Signature · 6 lines
1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/3 ARM: dts: dra7-evm: Add regulator information to USB2 PHYs
In reply to Roger QuadrosThe ldousb_reg regulator provides power to the USB1 and USB2 High Speed PHYs.
--- arch/arm/boot/dts/dra7-evm.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/dra7-evm.dts +8 -0
@@ -495,3 +495,11 @@ }; }; }; + +&usb2_phy1 { + phy-supply = <&ldousb_reg>; +}; + +&usb2_phy2 { + phy-supply = <&ldousb_reg>; +};
Signature · 1 line
1.8.3.2
Re: [PATCH 3/3] ARM: dts: dra7-evm: Add regulator information to USB2 PHYs
Quoted 2 lines · Roger Quadros
The
ldousb_regregulator provides power to the USB1 and USB2 High Speed PHYs.
Applying this one into omap-for-v3.17/dt thanks.
Tony