Skip to contentSkip to conversation

net: stmmac: dwmac-rk: Fix phy regulator issues

PATCH In review Romain Perier 3 participants 8 messages Jan 20, 2015 – Jan 25, 2015

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v2 cover net: stmmac: dwmac-rk: Fix phy regulator issues

This series fixes few issues in dwmac-rk:

1. Voltage settings was hardcoded into the driver for the phy regulator.
The driver now uses the default voltage settings found in the devicetree, which are applied throught the regulator framework.
2. The regulator name used to power on or power off the phy was put in the devicetree variable "phy_regulator", which is not standard and added a lot of code for nothing. The driver now uses the devicetree property "phy-supply" and the corresponding functions to manipulate this regulator.

The corresponding devicetree files are also updated. As this new binding for rk3288 has not been released with any official kernel yet (not until 3.20), I don't need to care about keeping compatibility with the old non standard property.

Romain Perier (4):
net: stmmac: dwmac-rk: Don't set the regulator voltage for phy from
the driver
ARM: dts: Add regulator voltage settings for vcc_phy in

    rk3288-evb.dtsi

net: stmmac: dwmac-rk: Use standard devicetree property for phy
regulator
dt-bindings: Document phy-supply property in rockchip-dwmac

 .../devicetree/bindings/net/rockchip-dwmac.txt     |  1 +
 arch/arm/boot/dts/rk3288-evb-rk808.dts             |  2 +-
 arch/arm/boot/dts/rk3288-evb.dtsi                  |  2 +
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 64 +++++++---------------
 4 files changed, 25 insertions(+), 44 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/4 net: stmmac: dwmac-rk: Don't set the regulator voltage for phy from the driver

As these settings can be directly expressed from devicetree for both fixed regulators and pmic-integrated regulators, it is more standard to set them from dts and let the regulator framework use the right voltage informations when it is used in the driver.

---
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +0 -1
index 35f9b86..06e1637 100644
@@ -303,7 +303,6 @@ static int phy_power_on(struct rk_priv_data *bsp_priv, bool enable)
 	} else {
 		if (enable) {
 			if (!regulator_is_enabled(ldo)) {
-				regulator_set_voltage(ldo, 3300000, 3300000);
 				ret = regulator_enable(ldo);
 				if (ret != 0)
 					dev_err(dev, "%s: fail to enable %s\n",
Signature · 1 line
1.9.1
maintainer Tested-by Reviewed-by on v2 1/4
#2 lore raw

Re: [PATCH v2 1/4] net: stmmac: dwmac-rk: Don't set the regulator voltage for phy from the driver

Am Dienstag, 20. Januar 2015, 07:09:37 schrieb Romain Perier:

Quoted 6 lines

As these settings can be directly expressed from devicetree for both fixed regulators and pmic-integrated regulators, it is more standard to set them from dts and let the regulator framework use the right voltage informations when it is used in the driver.

Romain suggested to resend my tags against a real patch of the series, so it turns up in patchwork, so

This series

@Dave: as said in the v1 mail, this would be nice to have for 3.20

Heiko

#3 lore raw

PATCH v2 2/4 ARM: dts: Add regulator voltage settings for vcc_phy in rk3288-evb.dtsi

In reply to Romain Perier
---
 arch/arm/boot/dts/rk3288-evb.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/boot/dts/rk3288-evb.dtsi +2 -0
index 489643c..1c08eb0 100644
@@ -98,6 +98,8 @@
 		pinctrl-names = "default";
 		pinctrl-0 = <&eth_phy_pwr>;
 		regulator-name = "vcc_phy";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
 		regulator-always-on;
 		regulator-boot-on;
 	};
Signature · 1 line
1.9.1
#4 lore raw

PATCH v2 3/4 net: stmmac: dwmac-rk: Use standard devicetree property for phy regulator

In reply to Romain Perier

Currently, dwmac-rk uses a custom propety "phy_regulator" to get the name of the right regulator to use to power on or power off the phy. This commit converts the driver to use phy-supply devicetree property and the corresponding API, it cleans the code a bit and make it simpler to maintain. This also replaces the property phy_regulator by the standard property phy-supply in rk3288-evb-rk808.dts.

---
 arch/arm/boot/dts/rk3288-evb-rk808.dts         |  2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 63 +++++++++-----------------
 2 files changed, 22 insertions(+), 43 deletions(-)
arch/arm/boot/dts/rk3288-evb-rk808.dts +1 -1
index 831a7aa..e1d3eeb 100644
@@ -161,7 +161,7 @@
 };
 
 &gmac {
-	phy_regulator = "vcc_phy";
+	phy-supply = <&vcc_phy>;
 	phy-mode = "rgmii";
 	clock_in_out = "input";
 	snps,reset-gpio = <&gpio4 7 0>;
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +21 -42

88 lines not on this page · raw message

Signature · 1 line
1.9.1
#5 lore raw

PATCH v2 4/4 dt-bindings: Document phy-supply property in rockchip-dwmac

In reply to Romain Perier

As no property for phy regulator was documented in this dt-binding documentation, this commit adds an entry for the optional property phy-supply.

---
 Documentation/devicetree/bindings/net/rockchip-dwmac.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/rockchip-dwmac.txt +1 -0
index 2362dcd..21fd199 100644
@@ -33,6 +33,7 @@ Required properties:
 Optional properties:
  - tx_delay: Delay value for TXD timing. Range value is 0~0x7F, 0x30 as default.
  - rx_delay: Delay value for RXD timing. Range value is 0~0x7F, 0x10 as default.
+ - phy-supply: phandle to a regulator if the PHY needs one
 
 Example:
 
Signature · 1 line
1.9.1
maintainer Tested-by Reviewed-by on the v2 series
#6 lore raw
In reply to Romain Perier

Am Dienstag, 20. Januar 2015, 07:09:36 schrieb Romain Perier:

Quoted 10 lines

This series fixes few issues in dwmac-rk:

1. Voltage settings was hardcoded into the driver for the phy regulator. The driver now uses the default voltage settings found in the devicetree,
which are applied throught the regulator framework.
2. The regulator name used to power on or power off the phy was put in the devicetree variable "phy_regulator", which is not standard and added a lot of code for nothing. The driver now uses the devicetree property "phy-supply" and the corresponding functions to manipulate this regulator.

Quoted 4 lines

The corresponding devicetree files are also updated. As this new binding for rk3288 has not been released with any official kernel yet (not until 3.20), I don't need to care about keeping compatibility with the old non standard property.

This series

@Dave: as said in the v1 mail, this would be nice to have for 3.20

maintainer
#7 lore raw
In reply to Romain Perier

From: Romain Perier <[email protected]>
Date: Tue, 20 Jan 2015 07:09:36 +0000

Quoted 10 lines

This series fixes few issues in dwmac-rk:

1. Voltage settings was hardcoded into the driver for the phy regulator.
The driver now uses the default voltage settings found in the devicetree, which are applied throught the regulator framework.
2. The regulator name used to power on or power off the phy was put in the devicetree variable "phy_regulator", which is not standard and added a lot of code for nothing. The driver now uses the devicetree property "phy-supply" and the corresponding functions to manipulate this regulator.

Quoted 3 lines

The corresponding devicetree files are also updated. As this new binding for rk3288 has not been released with any official kernel yet (not until 3.20), I don't need to care about keeping compatibility with the old non standard property.

Series applied to net-next, thanks.