* [PATCH v2 0/4] net: stmmac: dwmac-rk: Fix phy regulator issues @ 2015-01-20 7:09 Romain Perier [not found] ` <1421737780-1533-1-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ` (4 more replies) 0 siblings, 5 replies; 8+ messages in thread From: Romain Perier @ 2015-01-20 7:09 UTC (permalink / raw) To: peppe.cavallaro-qxv4g6HH51o Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, heiko-4mtYJXux2i+zQB+pC5nmwQ, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA, roger.chen-TNX95d0MmH7DzftRWevZcw 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(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" 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] 8+ messages in thread
[parent not found: <1421737780-1533-1-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* [PATCH v2 1/4] net: stmmac: dwmac-rk: Don't set the regulator voltage for phy from the driver [not found] ` <1421737780-1533-1-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2015-01-20 7:09 ` Romain Perier [not found] ` <1421737780-1533-2-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-01-21 8:32 ` [PATCH v2 0/4] net: stmmac: dwmac-rk: Fix phy regulator issues Heiko Stübner 1 sibling, 1 reply; 8+ messages in thread From: Romain Perier @ 2015-01-20 7:09 UTC (permalink / raw) To: peppe.cavallaro-qxv4g6HH51o Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, heiko-4mtYJXux2i+zQB+pC5nmwQ, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA, roger.chen-TNX95d0MmH7DzftRWevZcw 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. Signed-off-by: Romain Perier <romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index 35f9b86..06e1637 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c @@ -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", -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" 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] 8+ messages in thread
[parent not found: <1421737780-1533-2-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH v2 1/4] net: stmmac: dwmac-rk: Don't set the regulator voltage for phy from the driver [not found] ` <1421737780-1533-2-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2015-01-24 10:17 ` Heiko Stübner 0 siblings, 0 replies; 8+ messages in thread From: Heiko Stübner @ 2015-01-24 10:17 UTC (permalink / raw) To: Romain Perier Cc: peppe.cavallaro-qxv4g6HH51o, netdev-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA, roger.chen-TNX95d0MmH7DzftRWevZcw Am Dienstag, 20. Januar 2015, 07:09:37 schrieb Romain Perier: > 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. > > Signed-off-by: Romain Perier <romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Romain suggested to resend my tags against a real patch of the series, so it turns up in patchwork, so This series Tested-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org> Reviewed-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org> @Dave: as said in the v1 mail, this would be nice to have for 3.20 Heiko -- To unsubscribe from this list: send the line "unsubscribe devicetree" 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] 8+ messages in thread
* Re: [PATCH v2 0/4] net: stmmac: dwmac-rk: Fix phy regulator issues [not found] ` <1421737780-1533-1-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-01-20 7:09 ` [PATCH v2 1/4] net: stmmac: dwmac-rk: Don't set the regulator voltage for phy from the driver Romain Perier @ 2015-01-21 8:32 ` Heiko Stübner 1 sibling, 0 replies; 8+ messages in thread From: Heiko Stübner @ 2015-01-21 8:32 UTC (permalink / raw) To: Romain Perier, David Miller Cc: peppe.cavallaro-qxv4g6HH51o, netdev-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree-u79uwXL29TY76Z2rM5mHXA, roger.chen-TNX95d0MmH7DzftRWevZcw Am Dienstag, 20. Januar 2015, 07:09:36 schrieb Romain Perier: > 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. This series Tested-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org> Reviewed-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org> @Dave: as said in the v1 mail, this would be nice to have for 3.20 -- To unsubscribe from this list: send the line "unsubscribe devicetree" 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] 8+ messages in thread
* [PATCH v2 2/4] ARM: dts: Add regulator voltage settings for vcc_phy in rk3288-evb.dtsi 2015-01-20 7:09 [PATCH v2 0/4] net: stmmac: dwmac-rk: Fix phy regulator issues Romain Perier [not found] ` <1421737780-1533-1-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2015-01-20 7:09 ` Romain Perier 2015-01-20 7:09 ` [PATCH v2 3/4] net: stmmac: dwmac-rk: Use standard devicetree property for phy regulator Romain Perier ` (2 subsequent siblings) 4 siblings, 0 replies; 8+ messages in thread From: Romain Perier @ 2015-01-20 7:09 UTC (permalink / raw) To: peppe.cavallaro Cc: netdev, linux-kernel, heiko, linux-rockchip, linux-arm-kernel, devicetree, roger.chen Signed-off-by: Romain Perier <romain.perier@gmail.com> --- arch/arm/boot/dts/rk3288-evb.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/rk3288-evb.dtsi b/arch/arm/boot/dts/rk3288-evb.dtsi index 489643c..1c08eb0 100644 --- a/arch/arm/boot/dts/rk3288-evb.dtsi +++ b/arch/arm/boot/dts/rk3288-evb.dtsi @@ -98,6 +98,8 @@ pinctrl-names = "default"; pinctrl-0 = <ð_phy_pwr>; regulator-name = "vcc_phy"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; regulator-always-on; regulator-boot-on; }; -- 1.9.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/4] net: stmmac: dwmac-rk: Use standard devicetree property for phy regulator 2015-01-20 7:09 [PATCH v2 0/4] net: stmmac: dwmac-rk: Fix phy regulator issues Romain Perier [not found] ` <1421737780-1533-1-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-01-20 7:09 ` [PATCH v2 2/4] ARM: dts: Add regulator voltage settings for vcc_phy in rk3288-evb.dtsi Romain Perier @ 2015-01-20 7:09 ` Romain Perier 2015-01-20 7:09 ` [PATCH v2 4/4] dt-bindings: Document phy-supply property in rockchip-dwmac Romain Perier 2015-01-25 1:17 ` [PATCH v2 0/4] net: stmmac: dwmac-rk: Fix phy regulator issues David Miller 4 siblings, 0 replies; 8+ messages in thread From: Romain Perier @ 2015-01-20 7:09 UTC (permalink / raw) To: peppe.cavallaro Cc: devicetree, heiko, netdev, linux-kernel, linux-rockchip, roger.chen, linux-arm-kernel 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. Signed-off-by: Romain Perier <romain.perier@gmail.com> --- 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(-) diff --git a/arch/arm/boot/dts/rk3288-evb-rk808.dts b/arch/arm/boot/dts/rk3288-evb-rk808.dts index 831a7aa..e1d3eeb 100644 --- a/arch/arm/boot/dts/rk3288-evb-rk808.dts +++ b/arch/arm/boot/dts/rk3288-evb-rk808.dts @@ -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>; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index 06e1637..6249a4e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c @@ -32,7 +32,7 @@ struct rk_priv_data { struct platform_device *pdev; int phy_iface; - char regulator[32]; + struct regulator *regulator; bool clk_enabled; bool clock_input; @@ -287,46 +287,25 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable) static int phy_power_on(struct rk_priv_data *bsp_priv, bool enable) { - struct regulator *ldo; - char *ldostr = bsp_priv->regulator; + struct regulator *ldo = bsp_priv->regulator; int ret; struct device *dev = &bsp_priv->pdev->dev; - if (!ldostr) { - dev_err(dev, "%s: no ldo found\n", __func__); + if (!ldo) { + dev_err(dev, "%s: no regulator found\n", __func__); return -1; } - ldo = regulator_get(NULL, ldostr); - if (!ldo) { - dev_err(dev, "\n%s get ldo %s failed\n", __func__, ldostr); + if (enable) { + ret = regulator_enable(ldo); + if (ret) + dev_err(dev, "%s: fail to enable phy-supply\n", + __func__); } else { - if (enable) { - if (!regulator_is_enabled(ldo)) { - ret = regulator_enable(ldo); - if (ret != 0) - dev_err(dev, "%s: fail to enable %s\n", - __func__, ldostr); - else - dev_info(dev, "turn on ldo done.\n"); - } else { - dev_warn(dev, "%s is enabled before enable", - ldostr); - } - } else { - if (regulator_is_enabled(ldo)) { - ret = regulator_disable(ldo); - if (ret != 0) - dev_err(dev, "%s: fail to disable %s\n", - __func__, ldostr); - else - dev_info(dev, "turn off ldo done.\n"); - } else { - dev_warn(dev, "%s is disabled before disable", - ldostr); - } - } - regulator_put(ldo); + ret = regulator_disable(ldo); + if (ret) + dev_err(dev, "%s: fail to disable phy-supply\n", + __func__); } return 0; @@ -346,14 +325,14 @@ static void *rk_gmac_setup(struct platform_device *pdev) bsp_priv->phy_iface = of_get_phy_mode(dev->of_node); - ret = of_property_read_string(dev->of_node, "phy_regulator", &strings); - if (ret) { - dev_warn(dev, "%s: Can not read property: phy_regulator.\n", - __func__); - } else { - dev_info(dev, "%s: PHY power controlled by regulator(%s).\n", - __func__, strings); - strcpy(bsp_priv->regulator, strings); + bsp_priv->regulator = devm_regulator_get_optional(dev, "phy"); + if (IS_ERR(bsp_priv->regulator)) { + if (PTR_ERR(bsp_priv->regulator) == -EPROBE_DEFER) { + dev_err(dev, "phy regulator is not available yet, deferred probing\n"); + return ERR_PTR(-EPROBE_DEFER); + } + dev_err(dev, "no regulator found\n"); + bsp_priv->regulator = NULL; } ret = of_property_read_string(dev->of_node, "clock_in_out", &strings); -- 1.9.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 4/4] dt-bindings: Document phy-supply property in rockchip-dwmac 2015-01-20 7:09 [PATCH v2 0/4] net: stmmac: dwmac-rk: Fix phy regulator issues Romain Perier ` (2 preceding siblings ...) 2015-01-20 7:09 ` [PATCH v2 3/4] net: stmmac: dwmac-rk: Use standard devicetree property for phy regulator Romain Perier @ 2015-01-20 7:09 ` Romain Perier 2015-01-25 1:17 ` [PATCH v2 0/4] net: stmmac: dwmac-rk: Fix phy regulator issues David Miller 4 siblings, 0 replies; 8+ messages in thread From: Romain Perier @ 2015-01-20 7:09 UTC (permalink / raw) To: peppe.cavallaro Cc: netdev, linux-kernel, heiko, linux-rockchip, linux-arm-kernel, devicetree, roger.chen As no property for phy regulator was documented in this dt-binding documentation, this commit adds an entry for the optional property phy-supply. Signed-off-by: Romain Perier <romain.perier@gmail.com> --- Documentation/devicetree/bindings/net/rockchip-dwmac.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/net/rockchip-dwmac.txt b/Documentation/devicetree/bindings/net/rockchip-dwmac.txt index 2362dcd..21fd199 100644 --- a/Documentation/devicetree/bindings/net/rockchip-dwmac.txt +++ b/Documentation/devicetree/bindings/net/rockchip-dwmac.txt @@ -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: -- 1.9.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/4] net: stmmac: dwmac-rk: Fix phy regulator issues 2015-01-20 7:09 [PATCH v2 0/4] net: stmmac: dwmac-rk: Fix phy regulator issues Romain Perier ` (3 preceding siblings ...) 2015-01-20 7:09 ` [PATCH v2 4/4] dt-bindings: Document phy-supply property in rockchip-dwmac Romain Perier @ 2015-01-25 1:17 ` David Miller 4 siblings, 0 replies; 8+ messages in thread From: David Miller @ 2015-01-25 1:17 UTC (permalink / raw) To: romain.perier Cc: peppe.cavallaro, netdev, linux-kernel, heiko, linux-rockchip, linux-arm-kernel, devicetree, roger.chen From: Romain Perier <romain.perier@gmail.com> Date: Tue, 20 Jan 2015 07:09:36 +0000 > 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. Series applied to net-next, thanks. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-01-25 1:17 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-01-20 7:09 [PATCH v2 0/4] net: stmmac: dwmac-rk: Fix phy regulator issues Romain Perier [not found] ` <1421737780-1533-1-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-01-20 7:09 ` [PATCH v2 1/4] net: stmmac: dwmac-rk: Don't set the regulator voltage for phy from the driver Romain Perier [not found] ` <1421737780-1533-2-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-01-24 10:17 ` Heiko Stübner 2015-01-21 8:32 ` [PATCH v2 0/4] net: stmmac: dwmac-rk: Fix phy regulator issues Heiko Stübner 2015-01-20 7:09 ` [PATCH v2 2/4] ARM: dts: Add regulator voltage settings for vcc_phy in rk3288-evb.dtsi Romain Perier 2015-01-20 7:09 ` [PATCH v2 3/4] net: stmmac: dwmac-rk: Use standard devicetree property for phy regulator Romain Perier 2015-01-20 7:09 ` [PATCH v2 4/4] dt-bindings: Document phy-supply property in rockchip-dwmac Romain Perier 2015-01-25 1:17 ` [PATCH v2 0/4] net: stmmac: dwmac-rk: Fix phy regulator issues David Miller
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).