Devicetree
 help / color / mirror / Atom feed
* [net-next,PATCH v2 0/5] Some improve for STM32MP2X
@ 2026-08-12  9:11 Christophe Roullier
  2026-08-12  9:11 ` [net-next,PATCH v2 1/5] dt-bindings: net: add phy-supply property for stm32 Christophe Roullier
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Christophe Roullier @ 2026-08-12  9:11 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Maxime Coquelin, Alexandre Torgue, linusw, Maxime Chevallier,
	Vladimir Oltean, Christophe Roullier
  Cc: netdev, devicetree, linux-stm32, linux-arm-kernel, linux-kernel

Add PHY Regu for MP23/MP25-DK
Increase deassert value for PHY Reset for MP25-EV1
Add support of phy-supply regulator
Remove commit "net: stmmac: manage error case during stmmac_dvr_probe" 
from my series to push in net-next networking tree

v2: Add reviewed-by from Linus
    Add missing commit to manage phy-supply property 
    (yaml and glue support)


Christophe Roullier (5):
  dt-bindings: net: add phy-supply property for stm32
  net: ethernet: stmmac: stm32: support the phy-supply regulator binding
  arm64: dts: st: add 3v3 regulator to ethernet on stm32mp235f-dk
  arm64: dts: st: add 3v3 regulator to ethernet on stm32mp257f-dk
  arm64: dts: st: increase deassert of PHY reset in stm32mp257f-ev1

 .../devicetree/bindings/net/stm32-dwmac.yaml  |  3 ++
 arch/arm64/boot/dts/st/stm32mp235f-dk.dts     |  1 +
 arch/arm64/boot/dts/st/stm32mp257f-dk.dts     |  1 +
 arch/arm64/boot/dts/st/stm32mp257f-ev1.dts    |  2 +-
 .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 51 ++++++++++++++++++-
 5 files changed, 56 insertions(+), 2 deletions(-)

-- 
2.43.0


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

* [net-next,PATCH v2 1/5] dt-bindings: net: add phy-supply property for stm32
  2026-08-12  9:11 [net-next,PATCH v2 0/5] Some improve for STM32MP2X Christophe Roullier
@ 2026-08-12  9:11 ` Christophe Roullier
  2026-08-12 19:58   ` Rob Herring
  2026-08-12  9:11 ` [net-next,PATCH v2 2/5] net: ethernet: stmmac: stm32: support the phy-supply regulator binding Christophe Roullier
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Christophe Roullier @ 2026-08-12  9:11 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Maxime Coquelin, Alexandre Torgue, linusw, Maxime Chevallier,
	Vladimir Oltean, Christophe Roullier
  Cc: netdev, devicetree, linux-stm32, linux-arm-kernel, linux-kernel

Phandle to a regulator that provides power to the PHY. This
regulator will be managed during the PHY power on/off sequence.

Signed-off-by: Christophe Roullier <christophe.roullier@foss.st.com>
---
 Documentation/devicetree/bindings/net/stm32-dwmac.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/stm32-dwmac.yaml b/Documentation/devicetree/bindings/net/stm32-dwmac.yaml
index 987254900d0da..0c7eb1ccadd47 100644
--- a/Documentation/devicetree/bindings/net/stm32-dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/stm32-dwmac.yaml
@@ -99,6 +99,9 @@ properties:
       encompases the glue register, the offset of the control register and
       the mask to set bitfield in control register
 
+  phy-supply:
+    description: PHY regulator
+
   st,ext-phyclk:
     description:
       set this property in RMII mode when you have PHY without crystal 50MHz and want to
-- 
2.43.0


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

* [net-next,PATCH v2 2/5] net: ethernet: stmmac: stm32: support the phy-supply regulator binding
  2026-08-12  9:11 [net-next,PATCH v2 0/5] Some improve for STM32MP2X Christophe Roullier
  2026-08-12  9:11 ` [net-next,PATCH v2 1/5] dt-bindings: net: add phy-supply property for stm32 Christophe Roullier
@ 2026-08-12  9:11 ` Christophe Roullier
  2026-08-12  9:11 ` [net-next,PATCH v2 3/5] arm64: dts: st: add 3v3 regulator to ethernet on stm32mp235f-dk Christophe Roullier
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Christophe Roullier @ 2026-08-12  9:11 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Maxime Coquelin, Alexandre Torgue, linusw, Maxime Chevallier,
	Vladimir Oltean, Christophe Roullier
  Cc: netdev, devicetree, linux-stm32, linux-arm-kernel, linux-kernel

Configure the phy regulator if defined by the "phy-supply" DT phandle.

Signed-off-by: Christophe Roullier <christophe.roullier@foss.st.com>
---
 .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 51 ++++++++++++++++++-
 1 file changed, 50 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
index e1b260ed4790b..4597f605ec1bb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
@@ -14,6 +14,7 @@
 #include <linux/of_net.h>
 #include <linux/phy.h>
 #include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
 #include <linux/pm_wakeirq.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
@@ -98,6 +99,7 @@ struct stm32_dwmac {
 	u32 mode_reg;		 /* MAC glue-logic mode register */
 	u32 mode_mask;
 	struct regmap *regmap;
+	struct regulator *regulator;
 	u32 speed;
 	const struct stm32_ops *ops;
 	struct device *dev;
@@ -423,6 +425,16 @@ static int stm32_dwmac_parse_data(struct stm32_dwmac *dwmac,
 	if (IS_ERR(dwmac->regmap))
 		return PTR_ERR(dwmac->regmap);
 
+	dwmac->regulator = devm_regulator_get_optional(dev, "phy");
+	if (IS_ERR(dwmac->regulator)) {
+		if (PTR_ERR(dwmac->regulator) == -EPROBE_DEFER) {
+			dev_dbg(dev, "phy regulator is not available yet, deferred probing\n");
+			return -EPROBE_DEFER;
+		}
+		dev_dbg(dev, "no regulator found\n");
+		dwmac->regulator = NULL;
+	}
+
 	if (dwmac->ops->is_mp2)
 		return 0;
 
@@ -522,6 +534,27 @@ static int stm32_dwmac_resume(struct device *dev, void *bsp_priv)
 	return stm32_dwmac_init(priv->plat);
 }
 
+static int phy_power_on(struct stm32_dwmac *bsp_priv, bool enable)
+{
+	int ret;
+	struct device *dev = bsp_priv->dev;
+
+	if (!bsp_priv->regulator)
+		return 0;
+
+	if (enable) {
+		ret = regulator_enable(bsp_priv->regulator);
+		if (ret)
+			dev_err(dev, "fail to enable phy-supply\n");
+	} else {
+		ret = regulator_disable(bsp_priv->regulator);
+		if (ret)
+			dev_err(dev, "fail to disable phy-supply\n");
+	}
+
+	return 0;
+}
+
 static int stm32_dwmac_probe(struct platform_device *pdev)
 {
 	struct plat_stmmacenet_data *plat_dat;
@@ -576,12 +609,18 @@ static int stm32_dwmac_probe(struct platform_device *pdev)
 			goto err_clk_disable;
 	}
 
-	ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
+	ret = phy_power_on(plat_dat->bsp_priv, true);
 	if (ret)
 		goto err_clk_disable_suspend;
 
+	ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
+	if (ret)
+		goto err_gmac_powerdown;
+
 	return 0;
 
+err_gmac_powerdown:
+	phy_power_on(plat_dat->bsp_priv, false);
 err_clk_disable_suspend:
 	if (dwmac->ops->clk_rx_enable_in_suspend)
 		clk_disable_unprepare(dwmac->clk_rx);
@@ -614,16 +653,26 @@ static void stm32_dwmac_remove(struct platform_device *pdev)
 		dev_pm_clear_wake_irq(&pdev->dev);
 		device_init_wakeup(&pdev->dev, false);
 	}
+
+	phy_power_on(priv->plat->bsp_priv, false);
 }
 
 static int stm32mp1_suspend(struct stm32_dwmac *dwmac)
 {
+	/* Keep the PHY up if we use Wake-on-Lan. */
+	if (!device_may_wakeup(dwmac->dev))
+		phy_power_on(dwmac, false);
+
 	return clk_prepare_enable(dwmac->clk_ethstp);
 }
 
 static void stm32mp1_resume(struct stm32_dwmac *dwmac)
 {
 	clk_disable_unprepare(dwmac->clk_ethstp);
+
+	/* The PHY was up for Wake-on-Lan. */
+	if (!device_may_wakeup(dwmac->dev))
+		phy_power_on(dwmac, true);
 }
 
 static struct stm32_ops stm32mcu_dwmac_data = {
-- 
2.43.0


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

* [net-next,PATCH v2 3/5] arm64: dts: st: add 3v3 regulator to ethernet on stm32mp235f-dk
  2026-08-12  9:11 [net-next,PATCH v2 0/5] Some improve for STM32MP2X Christophe Roullier
  2026-08-12  9:11 ` [net-next,PATCH v2 1/5] dt-bindings: net: add phy-supply property for stm32 Christophe Roullier
  2026-08-12  9:11 ` [net-next,PATCH v2 2/5] net: ethernet: stmmac: stm32: support the phy-supply regulator binding Christophe Roullier
@ 2026-08-12  9:11 ` Christophe Roullier
  2026-08-12  9:11 ` [net-next,PATCH v2 4/5] arm64: dts: st: add 3v3 regulator to ethernet on stm32mp257f-dk Christophe Roullier
  2026-08-12  9:11 ` [net-next,PATCH v2 5/5] arm64: dts: st: increase deassert of PHY reset in stm32mp257f-ev1 Christophe Roullier
  4 siblings, 0 replies; 7+ messages in thread
From: Christophe Roullier @ 2026-08-12  9:11 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Maxime Coquelin, Alexandre Torgue, linusw, Maxime Chevallier,
	Vladimir Oltean, Christophe Roullier
  Cc: netdev, devicetree, linux-stm32, linux-arm-kernel, linux-kernel

The Ethernet PHY is supplied by 3v3 PMIC regulator, add it to Ethernet
node.

Signed-off-by: Christophe Roullier <christophe.roullier@foss.st.com>
---
 arch/arm64/boot/dts/st/stm32mp235f-dk.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/st/stm32mp235f-dk.dts b/arch/arm64/boot/dts/st/stm32mp235f-dk.dts
index dd4efbe5a46e8..fb49cd2da2c69 100644
--- a/arch/arm64/boot/dts/st/stm32mp235f-dk.dts
+++ b/arch/arm64/boot/dts/st/stm32mp235f-dk.dts
@@ -137,6 +137,7 @@ &ethernet1 {
 	pinctrl-names = "default", "sleep";
 	phy-handle = <&phy1_eth1>;
 	phy-mode = "rgmii-id";
+	phy-supply = <&scmi_v3v3>;
 	status = "okay";
 
 	mdio {
-- 
2.43.0


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

* [net-next,PATCH v2 4/5] arm64: dts: st: add 3v3 regulator to ethernet on stm32mp257f-dk
  2026-08-12  9:11 [net-next,PATCH v2 0/5] Some improve for STM32MP2X Christophe Roullier
                   ` (2 preceding siblings ...)
  2026-08-12  9:11 ` [net-next,PATCH v2 3/5] arm64: dts: st: add 3v3 regulator to ethernet on stm32mp235f-dk Christophe Roullier
@ 2026-08-12  9:11 ` Christophe Roullier
  2026-08-12  9:11 ` [net-next,PATCH v2 5/5] arm64: dts: st: increase deassert of PHY reset in stm32mp257f-ev1 Christophe Roullier
  4 siblings, 0 replies; 7+ messages in thread
From: Christophe Roullier @ 2026-08-12  9:11 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Maxime Coquelin, Alexandre Torgue, linusw, Maxime Chevallier,
	Vladimir Oltean, Christophe Roullier
  Cc: netdev, devicetree, linux-stm32, linux-arm-kernel, linux-kernel

The Ethernet PHY is supplied by 3v3 PMIC regulator, add it to Ethernet
node.

Signed-off-by: Christophe Roullier <christophe.roullier@foss.st.com>
---
 arch/arm64/boot/dts/st/stm32mp257f-dk.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/st/stm32mp257f-dk.dts b/arch/arm64/boot/dts/st/stm32mp257f-dk.dts
index 8daf3dfd51339..e98a773448ee9 100644
--- a/arch/arm64/boot/dts/st/stm32mp257f-dk.dts
+++ b/arch/arm64/boot/dts/st/stm32mp257f-dk.dts
@@ -144,6 +144,7 @@ &ethernet1 {
 	pinctrl-names = "default", "sleep";
 	phy-handle = <&phy1_eth1>;
 	phy-mode = "rgmii-id";
+	phy-supply = <&scmi_v3v3>;
 	status = "okay";
 
 	mdio {
-- 
2.43.0


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

* [net-next,PATCH v2 5/5] arm64: dts: st: increase deassert of PHY reset in stm32mp257f-ev1
  2026-08-12  9:11 [net-next,PATCH v2 0/5] Some improve for STM32MP2X Christophe Roullier
                   ` (3 preceding siblings ...)
  2026-08-12  9:11 ` [net-next,PATCH v2 4/5] arm64: dts: st: add 3v3 regulator to ethernet on stm32mp257f-dk Christophe Roullier
@ 2026-08-12  9:11 ` Christophe Roullier
  4 siblings, 0 replies; 7+ messages in thread
From: Christophe Roullier @ 2026-08-12  9:11 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Maxime Coquelin, Alexandre Torgue, linusw, Maxime Chevallier,
	Vladimir Oltean, Christophe Roullier
  Cc: netdev, devicetree, linux-stm32, linux-arm-kernel, linux-kernel

The RTL8211F has a PHYRSTB pin to reset the chip.
For a complete PHY reset, this pin must be asserted low for
at least 10ms for the internal regulator.
Wait for at least 80ms (for internal circuits setting time) before
accessing the PHY register.
All registers will return to default values after a hardware reset

Signed-off-by: Christophe Roullier <christophe.roullier@foss.st.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
---
 arch/arm64/boot/dts/st/stm32mp257f-ev1.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts b/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
index 14e033f365e39..a41ab55aa8cb5 100644
--- a/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
+++ b/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
@@ -247,7 +247,7 @@ phy0_eth2: ethernet-phy@1 {
 			compatible = "ethernet-phy-id001c.c916";
 			reg = <1>;
 			reset-assert-us = <10000>;
-			reset-deassert-us = <300>;
+			reset-deassert-us = <80000>;
 			reset-gpios = <&gpiog 6 GPIO_ACTIVE_LOW>;
 		};
 	};
-- 
2.43.0


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

* Re: [net-next,PATCH v2 1/5] dt-bindings: net: add phy-supply property for stm32
  2026-08-12  9:11 ` [net-next,PATCH v2 1/5] dt-bindings: net: add phy-supply property for stm32 Christophe Roullier
@ 2026-08-12 19:58   ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2026-08-12 19:58 UTC (permalink / raw)
  To: Christophe Roullier
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue, linusw, Maxime Chevallier, Vladimir Oltean,
	netdev, devicetree, linux-stm32, linux-arm-kernel, linux-kernel

On Wed, Aug 12, 2026 at 11:11:18AM +0200, Christophe Roullier wrote:
> Phandle to a regulator that provides power to the PHY. This
> regulator will be managed during the PHY power on/off sequence.
> 
> Signed-off-by: Christophe Roullier <christophe.roullier@foss.st.com>
> ---
>  Documentation/devicetree/bindings/net/stm32-dwmac.yaml | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/stm32-dwmac.yaml b/Documentation/devicetree/bindings/net/stm32-dwmac.yaml
> index 987254900d0da..0c7eb1ccadd47 100644
> --- a/Documentation/devicetree/bindings/net/stm32-dwmac.yaml
> +++ b/Documentation/devicetree/bindings/net/stm32-dwmac.yaml
> @@ -99,6 +99,9 @@ properties:
>        encompases the glue register, the offset of the control register and
>        the mask to set bitfield in control register
>  
> +  phy-supply:
> +    description: PHY regulator

Which phy? There can be multiple for ethernet. In any case, doesn't 
really matter because either is wrong. The supply(ies) for a device go 
in that device's DT node. This node is not a PHY.

Rob

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

end of thread, other threads:[~2026-08-12 19:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-12  9:11 [net-next,PATCH v2 0/5] Some improve for STM32MP2X Christophe Roullier
2026-08-12  9:11 ` [net-next,PATCH v2 1/5] dt-bindings: net: add phy-supply property for stm32 Christophe Roullier
2026-08-12 19:58   ` Rob Herring
2026-08-12  9:11 ` [net-next,PATCH v2 2/5] net: ethernet: stmmac: stm32: support the phy-supply regulator binding Christophe Roullier
2026-08-12  9:11 ` [net-next,PATCH v2 3/5] arm64: dts: st: add 3v3 regulator to ethernet on stm32mp235f-dk Christophe Roullier
2026-08-12  9:11 ` [net-next,PATCH v2 4/5] arm64: dts: st: add 3v3 regulator to ethernet on stm32mp257f-dk Christophe Roullier
2026-08-12  9:11 ` [net-next,PATCH v2 5/5] arm64: dts: st: increase deassert of PHY reset in stm32mp257f-ev1 Christophe Roullier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox