* [PATCH net-next 0/7] net: stmmac: deprecate "snps,en-tx-lpi-clockgating" property
@ 2025-03-09 15:01 Russell King (Oracle)
2025-03-09 15:01 ` [PATCH net-next 1/7] net: stmmac: allow platforms to use PHY tx clock stop capability Russell King (Oracle)
` (7 more replies)
0 siblings, 8 replies; 14+ messages in thread
From: Russell King (Oracle) @ 2025-03-09 15:01 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Albert Ou, Alexandre Ghiti, Alexandre Torgue, Andrew Lunn,
Christophe Roullier, Conor Dooley, Conor Dooley, David S. Miller,
devicetree, Emil Renner Berthing, Eric Dumazet,
Giuseppe Cavallaro, Jakub Kicinski, Jose Abreu,
Krzysztof Kozlowski,
Lad,linux-arm-kernel@lists.infradead.org,linux-riscv@lists.infradead.org,linux-stm32@st-md-mailman.stormreply.com,Maxime Coquelin <mcoquelin.stm32@gmail.com>,Minda Chen <minda.chen@starfivetech.com>,netdev@vger.kernel.org,Palmer Dabbelt <palmer@dabbelt.com>,Paolo Abeni <pabeni@redhat.com>,Paul Walmsley <paul.walmsley@sifive.com>,Prabhakar,
Rob Herring, Samin Guo
Hi,
This series deprecates the "snps,en-tx-lpi-clockgating" property for
stmmac.
MII Transmit clock gating, where the MAC hardware supports gating this
clock, is a function of the connected PHY capabilities, which it
reports through its status register.
GMAC versions that support transmit clock gating twiddle the LPITCSE
bit accordingly in the LPI control/status register, which is handled
by the GMAC core specific code.
So, "snps,en-tx-lpi-clockgating" not something that is a GMAC property,
but is a work-around for phylib not providing an interface to determine
whether the PHY allows the transmit clock to be disabled.
This series converts the two SoCs that make use of this property (which,
I hasten to add, is set in the SoC code) to use the PHY capability bit
instead of a DT property, then removes the DT property from the .dtsi,
deprecates it in the snps,dwmac binding, and finally in the stmmac code.
I am expecting some discussion on how to merge this, as I think the
order in which these changes is made is important - we don't want to
deprecate the old way until the new code has landed.
Documentation/devicetree/bindings/net/snps,dwmac.yaml | 1 +
arch/arm/boot/dts/st/stm32mp151.dtsi | 1 -
arch/riscv/boot/dts/starfive/jh7110.dtsi | 2 --
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c | 1 +
drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c | 1 +
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 +
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 16 ++++++++++++----
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 5 ++++-
include/linux/stmmac.h | 3 ++-
9 files changed, 22 insertions(+), 9 deletions(-)
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH net-next 1/7] net: stmmac: allow platforms to use PHY tx clock stop capability
2025-03-09 15:01 [PATCH net-next 0/7] net: stmmac: deprecate "snps,en-tx-lpi-clockgating" property Russell King (Oracle)
@ 2025-03-09 15:01 ` Russell King (Oracle)
2025-03-11 13:20 ` Lad, Prabhakar
2025-03-09 15:01 ` [PATCH net-next 2/7] net: stmmac: starfive: use PHY capability for TX clock stop Russell King (Oracle)
` (6 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Russell King (Oracle) @ 2025-03-09 15:01 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Albert Ou, Alexandre Ghiti, Alexandre Torgue, Andrew Lunn,
Conor Dooley, Conor Dooley, David S. Miller, devicetree,
Emil Renner Berthing, Eric Dumazet, Giuseppe Cavallaro,
Jakub Kicinski, Jose Abreu, Krzysztof Kozlowski, Lad, Prabhakar,
linux-arm-kernel, linux-riscv, linux-stm32, Maxime Coquelin,
Minda Chen, netdev, Palmer Dabbelt, Paolo Abeni, Paul Walmsley,
Rob Herring
Allow platform glue to instruct stmmac to make use of the PHY transmit
clock stop capability when deciding whether to allow the transmit clock
from the DWMAC core to be stopped.
Cc: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 +
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 16 ++++++++++++----
include/linux/stmmac.h | 3 ++-
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index d87275c1cf23..bddfa0f4aa21 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -306,6 +306,7 @@ struct stmmac_priv {
struct timer_list eee_ctrl_timer;
int lpi_irq;
u32 tx_lpi_timer;
+ bool tx_lpi_clk_stop;
bool eee_enabled;
bool eee_active;
bool eee_sw_timer_en;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index fa1d7d3a2f43..6f29804148b6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -457,8 +457,7 @@ static void stmmac_try_to_start_sw_lpi(struct stmmac_priv *priv)
/* Check and enter in LPI mode */
if (!priv->tx_path_in_lpi_mode)
stmmac_set_lpi_mode(priv, priv->hw, STMMAC_LPI_FORCED,
- priv->plat->flags & STMMAC_FLAG_EN_TX_LPI_CLOCKGATING,
- 0);
+ priv->tx_lpi_clk_stop, 0);
}
/**
@@ -1104,13 +1103,18 @@ static int stmmac_mac_enable_tx_lpi(struct phylink_config *config, u32 timer,
priv->eee_enabled = true;
+ /* Update the transmit clock stop according to PHY capability if
+ * the platform allows
+ */
+ if (priv->plat->flags & STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP)
+ priv->tx_lpi_clk_stop = tx_clk_stop;
+
stmmac_set_eee_timer(priv, priv->hw, STMMAC_DEFAULT_LIT_LS,
STMMAC_DEFAULT_TWT_LS);
/* Try to cnfigure the hardware timer. */
ret = stmmac_set_lpi_mode(priv, priv->hw, STMMAC_LPI_TIMER,
- priv->plat->flags & STMMAC_FLAG_EN_TX_LPI_CLOCKGATING,
- priv->tx_lpi_timer);
+ priv->tx_lpi_clk_stop, priv->tx_lpi_timer);
if (ret) {
/* Hardware timer mode not supported, or value out of range.
@@ -1269,6 +1273,10 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
if (!(priv->plat->flags & STMMAC_FLAG_RX_CLK_RUNS_IN_LPI))
priv->phylink_config.eee_rx_clk_stop_enable = true;
+ /* Set the default transmit clock stop bit based on the platform glue */
+ priv->tx_lpi_clk_stop = priv->plat->flags &
+ STMMAC_FLAG_EN_TX_LPI_CLOCKGATING;
+
mdio_bus_data = priv->plat->mdio_bus_data;
if (mdio_bus_data)
priv->phylink_config.default_an_inband =
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index b6f03ab12595..c4ec8bb8144e 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -183,7 +183,8 @@ struct dwmac4_addrs {
#define STMMAC_FLAG_INT_SNAPSHOT_EN BIT(9)
#define STMMAC_FLAG_RX_CLK_RUNS_IN_LPI BIT(10)
#define STMMAC_FLAG_EN_TX_LPI_CLOCKGATING BIT(11)
-#define STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY BIT(12)
+#define STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP BIT(12)
+#define STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY BIT(13)
struct plat_stmmacenet_data {
int bus_id;
--
2.30.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next 2/7] net: stmmac: starfive: use PHY capability for TX clock stop
2025-03-09 15:01 [PATCH net-next 0/7] net: stmmac: deprecate "snps,en-tx-lpi-clockgating" property Russell King (Oracle)
2025-03-09 15:01 ` [PATCH net-next 1/7] net: stmmac: allow platforms to use PHY tx clock stop capability Russell King (Oracle)
@ 2025-03-09 15:01 ` Russell King (Oracle)
2025-03-09 15:01 ` [PATCH net-next 3/7] net: stmmac: stm32: " Russell King (Oracle)
` (5 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Russell King (Oracle) @ 2025-03-09 15:01 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Albert Ou, Alexandre Ghiti, Alexandre Torgue, Andrew Lunn,
Conor Dooley, Conor Dooley, David S. Miller, devicetree,
Emil Renner Berthing, Eric Dumazet, Giuseppe Cavallaro,
Jakub Kicinski, Jose Abreu, Krzysztof Kozlowski, linux-arm-kernel,
linux-riscv, linux-stm32, Maxime Coquelin, Minda Chen, netdev,
Palmer Dabbelt, Paolo Abeni, Paul Walmsley, Rob Herring,
Samin Guo
Whether the MII transmit clock can be stopped is primarily a property
of the PHY (there is a capability bit that should be checked first.)
Whether the MAC is capable of stopping the transmit clock is a separate
issue, but this is already handled by the core DesignWare MAC code.
Add the flag to allow the stmmac core to use the PHY capability.
Cc: Samin Guo <samin.guo@starfivetech.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
index 5e31cb3bb4b8..2013d7477eb7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
@@ -124,6 +124,7 @@ static int starfive_dwmac_probe(struct platform_device *pdev)
plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate;
dwmac->dev = &pdev->dev;
+ plat_dat->flags |= STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP;
plat_dat->bsp_priv = dwmac;
plat_dat->dma_cfg->dche = true;
--
2.30.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next 3/7] net: stmmac: stm32: use PHY capability for TX clock stop
2025-03-09 15:01 [PATCH net-next 0/7] net: stmmac: deprecate "snps,en-tx-lpi-clockgating" property Russell King (Oracle)
2025-03-09 15:01 ` [PATCH net-next 1/7] net: stmmac: allow platforms to use PHY tx clock stop capability Russell King (Oracle)
2025-03-09 15:01 ` [PATCH net-next 2/7] net: stmmac: starfive: use PHY capability for TX clock stop Russell King (Oracle)
@ 2025-03-09 15:01 ` Russell King (Oracle)
2025-03-09 15:02 ` [PATCH net-next 4/7] riscv: dts: starfive: remove "snps,en-tx-lpi-clockgating" property Russell King (Oracle)
` (4 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Russell King (Oracle) @ 2025-03-09 15:01 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Albert Ou, Alexandre Ghiti, Alexandre Torgue, Andrew Lunn,
Christophe Roullier, Conor Dooley, Conor Dooley, David S. Miller,
devicetree, Emil Renner Berthing, Eric Dumazet,
Giuseppe Cavallaro, Jakub Kicinski, Jose Abreu,
Krzysztof Kozlowski, linux-arm-kernel, linux-riscv, linux-stm32,
Maxime Coquelin, Minda Chen, netdev, Palmer Dabbelt, Paolo Abeni,
Paul Walmsley, Rob Herring
Whether the MII transmit clock can be stopped is primarily a property
of the PHY (there is a capability bit that should be checked first.)
Whether the MAC is capable of stopping the transmit clock is a separate
issue, but this is already handled by the core DesignWare MAC code.
Add the flag to allow the stmmac core to use the PHY capability.
Cc: Christophe Roullier <christophe.roullier@st.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
index 1fcb74e9e3ff..c3d321192581 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
@@ -538,6 +538,7 @@ static int stm32_dwmac_probe(struct platform_device *pdev)
return ret;
}
+ plat_dat->flags |= STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP;
plat_dat->bsp_priv = dwmac;
ret = stm32_dwmac_init(plat_dat, false);
--
2.30.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next 4/7] riscv: dts: starfive: remove "snps,en-tx-lpi-clockgating" property
2025-03-09 15:01 [PATCH net-next 0/7] net: stmmac: deprecate "snps,en-tx-lpi-clockgating" property Russell King (Oracle)
` (2 preceding siblings ...)
2025-03-09 15:01 ` [PATCH net-next 3/7] net: stmmac: stm32: " Russell King (Oracle)
@ 2025-03-09 15:02 ` Russell King (Oracle)
2025-03-10 16:37 ` Conor Dooley
2025-03-09 15:02 ` [PATCH net-next 5/7] ARM: dts: stm32: " Russell King (Oracle)
` (3 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Russell King (Oracle) @ 2025-03-09 15:02 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Albert Ou, Alexandre Ghiti, Alexandre Torgue, Andrew Lunn,
Conor Dooley, Conor Dooley, David S. Miller, devicetree,
Emil Renner Berthing, Eric Dumazet, Giuseppe Cavallaro,
Jakub Kicinski, Jose Abreu, Krzysztof Kozlowski, linux-arm-kernel,
linux-riscv, linux-stm32, Maxime Coquelin, Minda Chen, netdev,
Palmer Dabbelt, Paolo Abeni, Paul Walmsley, Rob Herring,
Samin Guo
Whether the MII transmit clock can be stopped is primarily a property
of the PHY (there is a capability bit that should be checked first.)
Whether the MAC is capable of stopping the transmit clock is a separate
issue, but this is already handled by the core DesignWare MAC code.
As commit "net: stmmac: starfive: use PHY capability for TX clock stop"
adds the flag to use the PHY capability, remove the DT property that is
now unecessary.
Cc: Samin Guo <samin.guo@starfivetech.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
arch/riscv/boot/dts/starfive/jh7110.dtsi | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi
index 0d8339357bad..a7aed4a21b65 100644
--- a/arch/riscv/boot/dts/starfive/jh7110.dtsi
+++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi
@@ -1022,7 +1022,6 @@ gmac0: ethernet@16030000 {
snps,force_thresh_dma_mode;
snps,axi-config = <&stmmac_axi_setup>;
snps,tso;
- snps,en-tx-lpi-clockgating;
snps,txpbl = <16>;
snps,rxpbl = <16>;
starfive,syscon = <&aon_syscon 0xc 0x12>;
@@ -1053,7 +1052,6 @@ gmac1: ethernet@16040000 {
snps,force_thresh_dma_mode;
snps,axi-config = <&stmmac_axi_setup>;
snps,tso;
- snps,en-tx-lpi-clockgating;
snps,txpbl = <16>;
snps,rxpbl = <16>;
starfive,syscon = <&sys_syscon 0x90 0x2>;
--
2.30.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next 5/7] ARM: dts: stm32: remove "snps,en-tx-lpi-clockgating" property
2025-03-09 15:01 [PATCH net-next 0/7] net: stmmac: deprecate "snps,en-tx-lpi-clockgating" property Russell King (Oracle)
` (3 preceding siblings ...)
2025-03-09 15:02 ` [PATCH net-next 4/7] riscv: dts: starfive: remove "snps,en-tx-lpi-clockgating" property Russell King (Oracle)
@ 2025-03-09 15:02 ` Russell King (Oracle)
2025-03-09 15:02 ` [PATCH net-next 6/7] dt-bindings: deprecate " Russell King (Oracle)
` (2 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Russell King (Oracle) @ 2025-03-09 15:02 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Albert Ou, Alexandre Ghiti, Alexandre Torgue, Andrew Lunn,
Conor Dooley, Conor Dooley, David S. Miller, devicetree,
Emil Renner Berthing, Eric Dumazet, Giuseppe Cavallaro,
Jakub Kicinski, Jose Abreu, Krzysztof Kozlowski, linux-arm-kernel,
linux-riscv, linux-stm32, Maxime Coquelin, Minda Chen, netdev,
Palmer Dabbelt, Paolo Abeni, Paul Walmsley, Rob Herring,
Samin Guo
Whether the MII transmit clock can be stopped is primarily a property
of the PHY (there is a capability bit that should be checked first.)
Whether the MAC is capable of stopping the transmit clock is a separate
issue, but this is already handled by the core DesignWare MAC code.
As commit "net: stmmac: stm32: use PHY capability for TX clock stop"
adds the flag to use the PHY capability, remove the DT property that is
now unecessary.
Cc: Samin Guo <samin.guo@starfivetech.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
arch/arm/boot/dts/st/stm32mp151.dtsi | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/arm/boot/dts/st/stm32mp151.dtsi b/arch/arm/boot/dts/st/stm32mp151.dtsi
index b9a87fbe971d..0daa8ffe2ff5 100644
--- a/arch/arm/boot/dts/st/stm32mp151.dtsi
+++ b/arch/arm/boot/dts/st/stm32mp151.dtsi
@@ -1781,7 +1781,6 @@ ethernet0: ethernet@5800a000 {
st,syscon = <&syscfg 0x4>;
snps,mixed-burst;
snps,pbl = <2>;
- snps,en-tx-lpi-clockgating;
snps,axi-config = <&stmmac_axi_config_0>;
snps,tso;
access-controllers = <&etzpc 94>;
--
2.30.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next 6/7] dt-bindings: deprecate "snps,en-tx-lpi-clockgating" property
2025-03-09 15:01 [PATCH net-next 0/7] net: stmmac: deprecate "snps,en-tx-lpi-clockgating" property Russell King (Oracle)
` (4 preceding siblings ...)
2025-03-09 15:02 ` [PATCH net-next 5/7] ARM: dts: stm32: " Russell King (Oracle)
@ 2025-03-09 15:02 ` Russell King (Oracle)
2025-03-10 12:53 ` Rob Herring (Arm)
2025-03-11 13:30 ` Lad, Prabhakar
2025-03-09 15:02 ` [PATCH net-next 7/7] net: stmmac: " Russell King (Oracle)
2025-03-10 16:35 ` [PATCH net-next 0/7] " Conor Dooley
7 siblings, 2 replies; 14+ messages in thread
From: Russell King (Oracle) @ 2025-03-09 15:02 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Albert Ou, Alexandre Ghiti, Alexandre Torgue, Andrew Lunn,
Conor Dooley, Conor Dooley, David S. Miller, devicetree,
Emil Renner Berthing, Eric Dumazet, Giuseppe Cavallaro,
Jakub Kicinski, Jose Abreu, Krzysztof Kozlowski, linux-arm-kernel,
linux-riscv, linux-stm32, Maxime Coquelin, Minda Chen, netdev,
Palmer Dabbelt, Paolo Abeni, Paul Walmsley, Rob Herring
Whether the MII transmit clock can be stopped is primarily a property
of the PHY (there is a capability bit that should be checked first.)
Whether the MAC is capable of stopping the transmit clock is a separate
issue, but this is already handled by the core DesignWare MAC code.
Therefore, snps,en-tx-lpi-clockgating is technically incorrect, so this
commit deprecates the property in the binding.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Documentation/devicetree/bindings/net/snps,dwmac.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 3f0aa46d798e..78b3030dc56d 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -494,6 +494,7 @@ title: Synopsys DesignWare MAC
snps,en-tx-lpi-clockgating:
$ref: /schemas/types.yaml#/definitions/flag
+ deprecated: true
description:
Enable gating of the MAC TX clock during TX low-power mode
--
2.30.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next 7/7] net: stmmac: deprecate "snps,en-tx-lpi-clockgating" property
2025-03-09 15:01 [PATCH net-next 0/7] net: stmmac: deprecate "snps,en-tx-lpi-clockgating" property Russell King (Oracle)
` (5 preceding siblings ...)
2025-03-09 15:02 ` [PATCH net-next 6/7] dt-bindings: deprecate " Russell King (Oracle)
@ 2025-03-09 15:02 ` Russell King (Oracle)
2025-03-10 16:35 ` [PATCH net-next 0/7] " Conor Dooley
7 siblings, 0 replies; 14+ messages in thread
From: Russell King (Oracle) @ 2025-03-09 15:02 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Albert Ou, Alexandre Ghiti, Alexandre Torgue, Andrew Lunn,
Conor Dooley, Conor Dooley, David S. Miller, devicetree,
Emil Renner Berthing, Eric Dumazet, Giuseppe Cavallaro,
Jakub Kicinski, Jose Abreu, Krzysztof Kozlowski, linux-arm-kernel,
linux-riscv, linux-stm32, Maxime Coquelin, Minda Chen, netdev,
Palmer Dabbelt, Paolo Abeni, Paul Walmsley, Rob Herring
Whether the MII transmit clock can be stopped is primarily a property
of the PHY (there is a capability bit that should be checked first.)
Whether the MAC is capable of stopping the transmit clock is a separate
issue, but this is already handled by the core DesignWare MAC code.
Therefore, snps,en-tx-lpi-clockgating is technically incorrect, and
this commit adds a warning should a DT be encountered with the property
present.
However, we keep backwards compatibility.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 8dc3bd6946c6..c73eff6a56b8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -497,8 +497,11 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
plat->force_sf_dma_mode =
of_property_read_bool(np, "snps,force_sf_dma_mode");
- if (of_property_read_bool(np, "snps,en-tx-lpi-clockgating"))
+ if (of_property_read_bool(np, "snps,en-tx-lpi-clockgating")) {
+ dev_warn(&pdev->dev,
+ "OF property snps,en-tx-lpi-clockgating is deprecated, please convert driver to use STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP\n");
plat->flags |= STMMAC_FLAG_EN_TX_LPI_CLOCKGATING;
+ }
/* Set the maxmtu to a default of JUMBO_LEN in case the
* parameter is not present in the device tree.
--
2.30.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 6/7] dt-bindings: deprecate "snps,en-tx-lpi-clockgating" property
2025-03-09 15:02 ` [PATCH net-next 6/7] dt-bindings: deprecate " Russell King (Oracle)
@ 2025-03-10 12:53 ` Rob Herring (Arm)
2025-03-11 13:30 ` Lad, Prabhakar
1 sibling, 0 replies; 14+ messages in thread
From: Rob Herring (Arm) @ 2025-03-10 12:53 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Albert Ou, Alexandre Ghiti, David S. Miller, Emil Renner Berthing,
Conor Dooley, Alexandre Torgue, linux-stm32, Jakub Kicinski,
Palmer Dabbelt, Minda Chen, Maxime Coquelin, Krzysztof Kozlowski,
devicetree, Jose Abreu, Paolo Abeni, Heiner Kallweit,
linux-arm-kernel, Paul Walmsley, Andrew Lunn, linux-riscv,
Andrew Lunn, Eric Dumazet, Conor Dooley, Giuseppe Cavallaro,
netdev
On Sun, 09 Mar 2025 15:02:14 +0000, Russell King (Oracle) wrote:
> Whether the MII transmit clock can be stopped is primarily a property
> of the PHY (there is a capability bit that should be checked first.)
> Whether the MAC is capable of stopping the transmit clock is a separate
> issue, but this is already handled by the core DesignWare MAC code.
>
> Therefore, snps,en-tx-lpi-clockgating is technically incorrect, so this
> commit deprecates the property in the binding.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Documentation/devicetree/bindings/net/snps,dwmac.yaml | 1 +
> 1 file changed, 1 insertion(+)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 0/7] net: stmmac: deprecate "snps,en-tx-lpi-clockgating" property
2025-03-09 15:01 [PATCH net-next 0/7] net: stmmac: deprecate "snps,en-tx-lpi-clockgating" property Russell King (Oracle)
` (6 preceding siblings ...)
2025-03-09 15:02 ` [PATCH net-next 7/7] net: stmmac: " Russell King (Oracle)
@ 2025-03-10 16:35 ` Conor Dooley
2025-03-10 16:37 ` Russell King (Oracle)
7 siblings, 1 reply; 14+ messages in thread
From: Conor Dooley @ 2025-03-10 16:35 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Heiner Kallweit, Albert Ou, Alexandre Ghiti,
Alexandre Torgue, Andrew Lunn, Christophe Roullier, Conor Dooley,
David S. Miller, devicetree, Emil Renner Berthing, Eric Dumazet,
Giuseppe Cavallaro, Jakub Kicinski, Jose Abreu,
Krzysztof Kozlowski,
Lad,linux-arm-kernel@lists.infradead.org,linux-riscv@lists.infradead.org,linux-stm32@st-md-mailman.stormreply.com,Maxime Coquelin <mcoquelin.stm32@gmail.com>,Minda Chen <minda.chen@starfivetech.com>,netdev@vger.kernel.org,Palmer Dabbelt <palmer@dabbelt.com>,Paolo Abeni <pabeni@redhat.com>,Paul Walmsley <paul.walmsley@sifive.com>,Prabhakar,
Rob Herring, Samin Guo
[-- Attachment #1: Type: text/plain, Size: 2229 bytes --]
On Sun, Mar 09, 2025 at 03:01:45PM +0000, Russell King (Oracle) wrote:
> Hi,
>
> This series deprecates the "snps,en-tx-lpi-clockgating" property for
> stmmac.
>
> MII Transmit clock gating, where the MAC hardware supports gating this
> clock, is a function of the connected PHY capabilities, which it
> reports through its status register.
>
> GMAC versions that support transmit clock gating twiddle the LPITCSE
> bit accordingly in the LPI control/status register, which is handled
> by the GMAC core specific code.
>
> So, "snps,en-tx-lpi-clockgating" not something that is a GMAC property,
> but is a work-around for phylib not providing an interface to determine
> whether the PHY allows the transmit clock to be disabled.
>
> This series converts the two SoCs that make use of this property (which,
> I hasten to add, is set in the SoC code) to use the PHY capability bit
> instead of a DT property, then removes the DT property from the .dtsi,
> deprecates it in the snps,dwmac binding, and finally in the stmmac code.
>
> I am expecting some discussion on how to merge this, as I think the
> order in which these changes is made is important - we don't want to
> deprecate the old way until the new code has landed.
I'm happy enough to have the jh7110 dtsi change go via netdev, rather
than sit on till the driver change propagates to my tree in a release's
time.
>
> Documentation/devicetree/bindings/net/snps,dwmac.yaml | 1 +
> arch/arm/boot/dts/st/stm32mp151.dtsi | 1 -
> arch/riscv/boot/dts/starfive/jh7110.dtsi | 2 --
> drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c | 1 +
> drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c | 1 +
> drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 +
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 16 ++++++++++++----
> drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 5 ++++-
> include/linux/stmmac.h | 3 ++-
> 9 files changed, 22 insertions(+), 9 deletions(-)
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 4/7] riscv: dts: starfive: remove "snps,en-tx-lpi-clockgating" property
2025-03-09 15:02 ` [PATCH net-next 4/7] riscv: dts: starfive: remove "snps,en-tx-lpi-clockgating" property Russell King (Oracle)
@ 2025-03-10 16:37 ` Conor Dooley
0 siblings, 0 replies; 14+ messages in thread
From: Conor Dooley @ 2025-03-10 16:37 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Heiner Kallweit, Albert Ou, Alexandre Ghiti,
Alexandre Torgue, Andrew Lunn, Conor Dooley, David S. Miller,
devicetree, Emil Renner Berthing, Eric Dumazet,
Giuseppe Cavallaro, Jakub Kicinski, Jose Abreu,
Krzysztof Kozlowski, linux-arm-kernel, linux-riscv, linux-stm32,
Maxime Coquelin, Minda Chen, netdev, Palmer Dabbelt, Paolo Abeni,
Paul Walmsley, Rob Herring, Samin Guo
[-- Attachment #1: Type: text/plain, Size: 712 bytes --]
On Sun, Mar 09, 2025 at 03:02:03PM +0000, Russell King (Oracle) wrote:
> Whether the MII transmit clock can be stopped is primarily a property
> of the PHY (there is a capability bit that should be checked first.)
> Whether the MAC is capable of stopping the transmit clock is a separate
> issue, but this is already handled by the core DesignWare MAC code.
>
> As commit "net: stmmac: starfive: use PHY capability for TX clock stop"
> adds the flag to use the PHY capability, remove the DT property that is
> now unecessary.
>
> Cc: Samin Guo <samin.guo@starfivetech.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 0/7] net: stmmac: deprecate "snps,en-tx-lpi-clockgating" property
2025-03-10 16:35 ` [PATCH net-next 0/7] " Conor Dooley
@ 2025-03-10 16:37 ` Russell King (Oracle)
0 siblings, 0 replies; 14+ messages in thread
From: Russell King (Oracle) @ 2025-03-10 16:37 UTC (permalink / raw)
To: Conor Dooley
Cc: Andrew Lunn, Heiner Kallweit, Albert Ou, Alexandre Ghiti,
Alexandre Torgue, Andrew Lunn, Christophe Roullier, Conor Dooley,
David S. Miller, devicetree, Emil Renner Berthing, Eric Dumazet,
Giuseppe Cavallaro, Jakub Kicinski, Jose Abreu,
Krzysztof Kozlowski,
Lad,linux-arm-kernel@lists.infradead.org,linux-riscv@lists.infradead.org,linux-stm32@st-md-mailman.stormreply.com,Maxime Coquelin <mcoquelin.stm32@gmail.com>,Minda Chen <minda.chen@starfivetech.com>,netdev@vger.kernel.org,Palmer Dabbelt <palmer@dabbelt.com>,Paolo Abeni <pabeni@redhat.com>,Paul Walmsley <paul.walmsley@sifive.com>,Prabhakar,
Rob Herring, Samin Guo
On Mon, Mar 10, 2025 at 04:35:55PM +0000, Conor Dooley wrote:
> On Sun, Mar 09, 2025 at 03:01:45PM +0000, Russell King (Oracle) wrote:
> > Hi,
> >
> > This series deprecates the "snps,en-tx-lpi-clockgating" property for
> > stmmac.
> >
> > MII Transmit clock gating, where the MAC hardware supports gating this
> > clock, is a function of the connected PHY capabilities, which it
> > reports through its status register.
> >
> > GMAC versions that support transmit clock gating twiddle the LPITCSE
> > bit accordingly in the LPI control/status register, which is handled
> > by the GMAC core specific code.
> >
> > So, "snps,en-tx-lpi-clockgating" not something that is a GMAC property,
> > but is a work-around for phylib not providing an interface to determine
> > whether the PHY allows the transmit clock to be disabled.
> >
> > This series converts the two SoCs that make use of this property (which,
> > I hasten to add, is set in the SoC code) to use the PHY capability bit
> > instead of a DT property, then removes the DT property from the .dtsi,
> > deprecates it in the snps,dwmac binding, and finally in the stmmac code.
> >
>
> > I am expecting some discussion on how to merge this, as I think the
> > order in which these changes is made is important - we don't want to
> > deprecate the old way until the new code has landed.
>
> I'm happy enough to have the jh7110 dtsi change go via netdev, rather
> than sit on till the driver change propagates to my tree in a release's
> time.
Thanks! Could I have a r-b or a-b for it please?
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 1/7] net: stmmac: allow platforms to use PHY tx clock stop capability
2025-03-09 15:01 ` [PATCH net-next 1/7] net: stmmac: allow platforms to use PHY tx clock stop capability Russell King (Oracle)
@ 2025-03-11 13:20 ` Lad, Prabhakar
0 siblings, 0 replies; 14+ messages in thread
From: Lad, Prabhakar @ 2025-03-11 13:20 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Heiner Kallweit, Albert Ou, Alexandre Ghiti,
Alexandre Torgue, Andrew Lunn, Conor Dooley, Conor Dooley,
David S. Miller, devicetree, Emil Renner Berthing, Eric Dumazet,
Giuseppe Cavallaro, Jakub Kicinski, Jose Abreu,
Krzysztof Kozlowski, linux-arm-kernel, linux-riscv, linux-stm32,
Maxime Coquelin, Minda Chen, netdev, Palmer Dabbelt, Paolo Abeni,
Paul Walmsley, Rob Herring
On Sun, Mar 9, 2025 at 3:02 PM Russell King (Oracle)
<rmk+kernel@armlinux.org.uk> wrote:
>
> Allow platform glue to instruct stmmac to make use of the PHY transmit
> clock stop capability when deciding whether to allow the transmit clock
> from the DWMAC core to be stopped.
>
> Cc: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 +
> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 16 ++++++++++++----
> include/linux/stmmac.h | 3 ++-
> 3 files changed, 15 insertions(+), 5 deletions(-)
>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cheers,
Prabhakar
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> index d87275c1cf23..bddfa0f4aa21 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> @@ -306,6 +306,7 @@ struct stmmac_priv {
> struct timer_list eee_ctrl_timer;
> int lpi_irq;
> u32 tx_lpi_timer;
> + bool tx_lpi_clk_stop;
> bool eee_enabled;
> bool eee_active;
> bool eee_sw_timer_en;
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index fa1d7d3a2f43..6f29804148b6 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -457,8 +457,7 @@ static void stmmac_try_to_start_sw_lpi(struct stmmac_priv *priv)
> /* Check and enter in LPI mode */
> if (!priv->tx_path_in_lpi_mode)
> stmmac_set_lpi_mode(priv, priv->hw, STMMAC_LPI_FORCED,
> - priv->plat->flags & STMMAC_FLAG_EN_TX_LPI_CLOCKGATING,
> - 0);
> + priv->tx_lpi_clk_stop, 0);
> }
>
> /**
> @@ -1104,13 +1103,18 @@ static int stmmac_mac_enable_tx_lpi(struct phylink_config *config, u32 timer,
>
> priv->eee_enabled = true;
>
> + /* Update the transmit clock stop according to PHY capability if
> + * the platform allows
> + */
> + if (priv->plat->flags & STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP)
> + priv->tx_lpi_clk_stop = tx_clk_stop;
> +
> stmmac_set_eee_timer(priv, priv->hw, STMMAC_DEFAULT_LIT_LS,
> STMMAC_DEFAULT_TWT_LS);
>
> /* Try to cnfigure the hardware timer. */
> ret = stmmac_set_lpi_mode(priv, priv->hw, STMMAC_LPI_TIMER,
> - priv->plat->flags & STMMAC_FLAG_EN_TX_LPI_CLOCKGATING,
> - priv->tx_lpi_timer);
> + priv->tx_lpi_clk_stop, priv->tx_lpi_timer);
>
> if (ret) {
> /* Hardware timer mode not supported, or value out of range.
> @@ -1269,6 +1273,10 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
> if (!(priv->plat->flags & STMMAC_FLAG_RX_CLK_RUNS_IN_LPI))
> priv->phylink_config.eee_rx_clk_stop_enable = true;
>
> + /* Set the default transmit clock stop bit based on the platform glue */
> + priv->tx_lpi_clk_stop = priv->plat->flags &
> + STMMAC_FLAG_EN_TX_LPI_CLOCKGATING;
> +
> mdio_bus_data = priv->plat->mdio_bus_data;
> if (mdio_bus_data)
> priv->phylink_config.default_an_inband =
> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
> index b6f03ab12595..c4ec8bb8144e 100644
> --- a/include/linux/stmmac.h
> +++ b/include/linux/stmmac.h
> @@ -183,7 +183,8 @@ struct dwmac4_addrs {
> #define STMMAC_FLAG_INT_SNAPSHOT_EN BIT(9)
> #define STMMAC_FLAG_RX_CLK_RUNS_IN_LPI BIT(10)
> #define STMMAC_FLAG_EN_TX_LPI_CLOCKGATING BIT(11)
> -#define STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY BIT(12)
> +#define STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP BIT(12)
> +#define STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY BIT(13)
>
> struct plat_stmmacenet_data {
> int bus_id;
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 6/7] dt-bindings: deprecate "snps,en-tx-lpi-clockgating" property
2025-03-09 15:02 ` [PATCH net-next 6/7] dt-bindings: deprecate " Russell King (Oracle)
2025-03-10 12:53 ` Rob Herring (Arm)
@ 2025-03-11 13:30 ` Lad, Prabhakar
1 sibling, 0 replies; 14+ messages in thread
From: Lad, Prabhakar @ 2025-03-11 13:30 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Heiner Kallweit, Albert Ou, Alexandre Ghiti,
Alexandre Torgue, Andrew Lunn, Conor Dooley, Conor Dooley,
David S. Miller, devicetree, Emil Renner Berthing, Eric Dumazet,
Giuseppe Cavallaro, Jakub Kicinski, Jose Abreu,
Krzysztof Kozlowski, linux-arm-kernel, linux-riscv, linux-stm32,
Maxime Coquelin, Minda Chen, netdev, Palmer Dabbelt, Paolo Abeni,
Paul Walmsley, Rob Herring
On Sun, Mar 9, 2025 at 3:13 PM Russell King (Oracle)
<rmk+kernel@armlinux.org.uk> wrote:
>
> Whether the MII transmit clock can be stopped is primarily a property
> of the PHY (there is a capability bit that should be checked first.)
> Whether the MAC is capable of stopping the transmit clock is a separate
> issue, but this is already handled by the core DesignWare MAC code.
>
> Therefore, snps,en-tx-lpi-clockgating is technically incorrect, so this
> commit deprecates the property in the binding.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Documentation/devicetree/bindings/net/snps,dwmac.yaml | 1 +
> 1 file changed, 1 insertion(+)
>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cheers,
Prabhakar
> diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> index 3f0aa46d798e..78b3030dc56d 100644
> --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> @@ -494,6 +494,7 @@ title: Synopsys DesignWare MAC
>
> snps,en-tx-lpi-clockgating:
> $ref: /schemas/types.yaml#/definitions/flag
> + deprecated: true
> description:
> Enable gating of the MAC TX clock during TX low-power mode
>
> --
> 2.30.2
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-03-11 13:30 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-09 15:01 [PATCH net-next 0/7] net: stmmac: deprecate "snps,en-tx-lpi-clockgating" property Russell King (Oracle)
2025-03-09 15:01 ` [PATCH net-next 1/7] net: stmmac: allow platforms to use PHY tx clock stop capability Russell King (Oracle)
2025-03-11 13:20 ` Lad, Prabhakar
2025-03-09 15:01 ` [PATCH net-next 2/7] net: stmmac: starfive: use PHY capability for TX clock stop Russell King (Oracle)
2025-03-09 15:01 ` [PATCH net-next 3/7] net: stmmac: stm32: " Russell King (Oracle)
2025-03-09 15:02 ` [PATCH net-next 4/7] riscv: dts: starfive: remove "snps,en-tx-lpi-clockgating" property Russell King (Oracle)
2025-03-10 16:37 ` Conor Dooley
2025-03-09 15:02 ` [PATCH net-next 5/7] ARM: dts: stm32: " Russell King (Oracle)
2025-03-09 15:02 ` [PATCH net-next 6/7] dt-bindings: deprecate " Russell King (Oracle)
2025-03-10 12:53 ` Rob Herring (Arm)
2025-03-11 13:30 ` Lad, Prabhakar
2025-03-09 15:02 ` [PATCH net-next 7/7] net: stmmac: " Russell King (Oracle)
2025-03-10 16:35 ` [PATCH net-next 0/7] " Conor Dooley
2025-03-10 16:37 ` Russell King (Oracle)
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).