From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
To: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Conor Dooley <conor+dt@kernel.org>,
Conor Dooley <conor@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
devicetree@vger.kernel.org,
Emil Renner Berthing <kernel@esmil.dk>,
Eric Dumazet <edumazet@google.com>,
Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Jakub Kicinski <kuba@kernel.org>,
Jose Abreu <joabreu@synopsys.com>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
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>,
Rob Herring <robh@kernel.org>
Subject: Re: [PATCH net-next 1/7] net: stmmac: allow platforms to use PHY tx clock stop capability
Date: Tue, 11 Mar 2025 13:20:02 +0000 [thread overview]
Message-ID: <CA+V-a8sCxs4MFZgo0q=0HmpyWXk7hYSGq0awm2YuAFZk+x6BEA@mail.gmail.com> (raw)
In-Reply-To: <E1trIA0-005ntK-FS@rmk-PC.armlinux.org.uk>
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
>
next prev parent reply other threads:[~2025-03-11 13:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+V-a8sCxs4MFZgo0q=0HmpyWXk7hYSGq0awm2YuAFZk+x6BEA@mail.gmail.com' \
--to=prabhakar.csengg@gmail.com \
--cc=alex@ghiti.fr \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=aou@eecs.berkeley.edu \
--cc=conor+dt@kernel.org \
--cc=conor@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=joabreu@synopsys.com \
--cc=kernel@esmil.dk \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=minda.chen@starfivetech.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=peppe.cavallaro@st.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).