Re: [PATCH v3 08/12] net: ethernet: stmmac: stm32: support the phy-supply regulator binding

From: Alexandre TORGUE
Date: Fri Oct 06 2023 - 07:53:56 EST


On 10/5/23 13:27, Christophe ROULLIER wrote:

On 9/28/23 17:45, Ben Wolsieffer wrote:
Hello,

On Thu, Sep 28, 2023 at 05:15:08PM +0200, Christophe Roullier wrote:
From: Christophe Roullier <christophe.roullier@xxxxxx>

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

Signed-off-by: Christophe Roullier <christophe.roullier@xxxxxxxxxxx>
---
  .../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 72dda71850d75..31e3abd2caeaa 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
... snip ...
  static int stm32mp1_suspend(struct stm32_dwmac *dwmac)
@@ -455,12 +496,20 @@ static int stm32mp1_suspend(struct stm32_dwmac *dwmac)
      if (dwmac->enable_eth_ck)
          clk_disable_unprepare(dwmac->clk_eth_ck);
+    /* Keep the PHY up if we use Wake-on-Lan. */
+    if (!device_may_wakeup(dwmac->dev))
+        phy_power_on(dwmac, false);
+
      return ret;
  }
  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 int stm32mcu_suspend(struct stm32_dwmac *dwmac)
Why only turn off the regulator in suspend on the STM32MP1 and not STM32
MCUs? It seems like this could just go in stm32_dwmac_suspend/resume().

Selfishly, I have a use case for this on an STM32F746 platform, so I
would like to see support for it and would test an updated version.

Hi,

I'm working on MPU boards, I do not have MCU board, so feel free to contribute on MCU part ;-)

Christophe,

The point here is to manage regulator for MPU and MCU. If you don't have MCU board it doesn't seem to be an issue as Ben proposed to test the patch for you.


Thanks

Christophe

--
2.25.1

Thanks, Ben