mbox series

[v3,00/12] Series to deliver Ethernets for STM32MP13

Message ID 20230928151512.322016-1-christophe.roullier@foss.st.com
Headers show
Series Series to deliver Ethernets for STM32MP13 | expand

Message

Christophe ROULLIER Sept. 28, 2023, 3:15 p.m. UTC
STM32MP13 is STM32 SOC with 2 GMACs instances
This board have 2 RMII phy:
  -Ethernet1: RMII with crystal
  -Ethernet2: RMII without crystal
Rework dwmac glue to simplify management for next stm32

-V2: Update from remark of Andrew Lunn (split commit into a number of smaller patches)
     Update from Conor Dooley (yaml documentation)
-V3: bad indentation for yaml (sorry)

Christophe Roullier (12):
  dt-bindings: net: add STM32MP13 compatible in documentation for stm32
  dt-bindings: net: add new property st,ext-phyclk in documentation for
    stm32
  dt-bindings: net: add phy-supply property for stm32
  net: ethernet: stmmac: rework glue to simplify management for next
    stm32
  net: ethernet: stmmac: add management of stm32mp13 for stm32
  net: ethernet: stmmac: stm32: update config management for phy wo
    cristal
  net: ethernet: stm32: clean the way to manage wol irqwake
  net: ethernet: stmmac: stm32: support the phy-supply regulator binding
  ARM: dts: stm32: add ethernet1 and ethernet2 support on stm32mp13
  ARM: dts: stm32: add ethernet1/2 RMII pins for STM32MP13F-DK board
  ARM: dts: stm32: add ethernet1 and ethernet2 for STM32MP135F-DK board
  ARM: multi_v7_defconfig: Add MCP23S08 pinctrl support

 .../devicetree/bindings/net/stm32-dwmac.yaml  |  90 ++++++-
 arch/arm/boot/dts/st/stm32mp13-pinctrl.dtsi   |  71 ++++++
 arch/arm/boot/dts/st/stm32mp131.dtsi          |  31 +++
 arch/arm/boot/dts/st/stm32mp133.dtsi          |  30 +++
 arch/arm/boot/dts/st/stm32mp135f-dk.dts       |  48 ++++
 arch/arm/configs/multi_v7_defconfig           |   1 +
 .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 229 +++++++++++++-----
 7 files changed, 425 insertions(+), 75 deletions(-)

Comments

Ben Wolsieffer Sept. 28, 2023, 3:45 p.m. UTC | #1
Hello,

On Thu, Sep 28, 2023 at 05:15:08PM +0200, Christophe Roullier wrote:
> From: Christophe Roullier <christophe.roullier@st.com>
> 
> 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 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.

> -- 
> 2.25.1
> 

Thanks, Ben
Andrew Lunn Sept. 28, 2023, 6 p.m. UTC | #2
On Thu, Sep 28, 2023 at 05:15:00PM +0200, Christophe Roullier wrote:

You sent v2 at "Thu, 28 Sep 2023 14:24:15 +0200"

The netdev FAQ

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#netdev-faq

says:

don't repost your patches within one 24h period

There is a danger you ignore comments made on version N-1 because you
post version N too fast. It can also waste reviewer time.

     Andrew
Christophe ROULLIER Oct. 5, 2023, 11:27 a.m. UTC | #3
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@st.com>
>>
>> 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 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 ;-)

Thanks

Christophe

>> -- 
>> 2.25.1
>>
> Thanks, Ben
Alexandre TORGUE Oct. 6, 2023, 11:53 a.m. UTC | #4
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@st.com>
>>>
>>> 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 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