netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/5] net: stmmac: remove unnecessary initialisation of 1µs TIC counter
@ 2025-04-12  8:05 Russell King (Oracle)
  2025-04-12  8:08 ` [PATCH net-next v2 1/5] net: stmmac: dwc-qos: remove tegra_eqos_init() Russell King (Oracle)
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Russell King (Oracle) @ 2025-04-12  8:05 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Jon Hunter, linux-arm-kernel, linux-stm32,
	Maxime Coquelin, netdev, Paolo Abeni, Philipp Zabel,
	Richard Cochran, Thierry Reding

Hi,

In commit 8efbdbfa9938 ("net: stmmac: Initialize MAC_ONEUS_TIC_COUNTER
register"), code to initialise the LPI 1us counter in dwmac4's
initialisation was added, making the initialisation in glue drivers
unnecessary. This series cleans up the now redundant initialisation.

 .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c    | 24 +---------------------
 .../net/ethernet/stmicro/stmmac/dwmac-intel-plat.c |  9 --------
 drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c  |  8 --------
 drivers/net/ethernet/stmicro/stmmac/dwmac4.h       |  1 -
 include/linux/stmmac.h                             |  1 -
 5 files changed, 1 insertion(+), 42 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] 7+ messages in thread

* [PATCH net-next v2 1/5] net: stmmac: dwc-qos: remove tegra_eqos_init()
  2025-04-12  8:05 [PATCH net-next v2 0/5] net: stmmac: remove unnecessary initialisation of 1µs TIC counter Russell King (Oracle)
@ 2025-04-12  8:08 ` Russell King (Oracle)
  2025-04-12  8:08 ` [PATCH net-next v2 2/5] net: stmmac: intel: remove eee_usecs_rate and hardware write Russell King (Oracle)
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Russell King (Oracle) @ 2025-04-12  8:08 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Jon Hunter, linux-arm-kernel, linux-stm32,
	Maxime Coquelin, netdev, Paolo Abeni, Philipp Zabel,
	Richard Cochran, Thierry Reding

tegra_eqos_init() initialises the 1US TIC counter for the EEE timers.
However, the DWGMAC core is reset after this write, which clears
this register to its default.

However, dwmac4_core_init() configures this register using the same
clock, which happens after reset - thus this is the write which
ensures that the register is correctly configured.

Therefore, tegra_eqos_init() is not required and is removed. This also
means eqos->clk_slave can also be removed.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 .../stmicro/stmmac/dwmac-dwc-qos-eth.c        | 24 +------------------
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index 5db318327d33..583b5c071cd1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -29,7 +29,6 @@ struct tegra_eqos {
 	void __iomem *regs;
 
 	struct reset_control *rst;
-	struct clk *clk_slave;
 
 	struct gpio_desc *reset;
 };
@@ -199,20 +198,6 @@ static void tegra_eqos_fix_speed(void *priv, int speed, unsigned int mode)
 	}
 }
 
-static int tegra_eqos_init(struct platform_device *pdev, void *priv)
-{
-	struct tegra_eqos *eqos = priv;
-	unsigned long rate;
-	u32 value;
-
-	rate = clk_get_rate(eqos->clk_slave);
-
-	value = (rate / 1000000) - 1;
-	writel(value, eqos->regs + GMAC_1US_TIC_COUNTER);
-
-	return 0;
-}
-
 static int tegra_eqos_probe(struct platform_device *pdev,
 			    struct plat_stmmacenet_data *plat_dat,
 			    struct stmmac_resources *res)
@@ -227,7 +212,6 @@ static int tegra_eqos_probe(struct platform_device *pdev,
 
 	eqos->dev = &pdev->dev;
 	eqos->regs = res->addr;
-	eqos->clk_slave = plat_dat->stmmac_clk;
 
 	if (!is_of_node(dev->fwnode))
 		goto bypass_clk_reset_gpio;
@@ -267,17 +251,11 @@ static int tegra_eqos_probe(struct platform_device *pdev,
 bypass_clk_reset_gpio:
 	plat_dat->fix_mac_speed = tegra_eqos_fix_speed;
 	plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate;
-	plat_dat->init = tegra_eqos_init;
 	plat_dat->bsp_priv = eqos;
 	plat_dat->flags |= STMMAC_FLAG_SPH_DISABLE;
 
-	err = tegra_eqos_init(pdev, eqos);
-	if (err < 0)
-		goto reset;
-
 	return 0;
-reset:
-	reset_control_assert(eqos->rst);
+
 reset_phy:
 	gpiod_set_value(eqos->reset, 1);
 
-- 
2.30.2


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

* [PATCH net-next v2 2/5] net: stmmac: intel: remove eee_usecs_rate and hardware write
  2025-04-12  8:05 [PATCH net-next v2 0/5] net: stmmac: remove unnecessary initialisation of 1µs TIC counter Russell King (Oracle)
  2025-04-12  8:08 ` [PATCH net-next v2 1/5] net: stmmac: dwc-qos: remove tegra_eqos_init() Russell King (Oracle)
@ 2025-04-12  8:08 ` Russell King (Oracle)
  2025-04-12  8:08 ` [PATCH net-next v2 3/5] net: stmmac: intel-plat: " Russell King (Oracle)
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Russell King (Oracle) @ 2025-04-12  8:08 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Jon Hunter, linux-arm-kernel, linux-stm32,
	Maxime Coquelin, netdev, Paolo Abeni, Philipp Zabel,
	Richard Cochran, Thierry Reding

Remove the write to GMAC_1US_TIC_COUNTER for two reasons:

1. during initialisation or reinitialisation of the DWMAC core, the
   core is reset, which sets this register back to its default value.
   Writing it prior to stmmac_dvr_probe() has no effect.

2. Since commit 8efbdbfa9938 ("net: stmmac: Initialize
   MAC_ONEUS_TIC_COUNTER register"), GMAC4/5 core code will set
   this register based on the rate of plat->stmmac_clk. This clock
   is created by the same code which initialises plat->eee_usecs_rate,
   which is also created to run at this same rate. Since Marek's
   commit, this will set this register appropriately using the
   rate of this clock.

Therefore, dwmac-intel.c writing GMAC_1US_TIC_COUNTER serves no
useful purpose and can be removed.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
index c8bb9265bbb4..54db5b778304 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
@@ -682,7 +682,6 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
 	plat->axi->axi_blen[2] = 16;
 
 	plat->ptp_max_adj = plat->clk_ptp_rate;
-	plat->eee_usecs_rate = plat->clk_ptp_rate;
 
 	/* Set system clock */
 	sprintf(clk_name, "%s-%s", "stmmac", pci_name(pdev));
@@ -1313,13 +1312,6 @@ static int intel_eth_pci_probe(struct pci_dev *pdev,
 	memset(&res, 0, sizeof(res));
 	res.addr = pcim_iomap_table(pdev)[0];
 
-	if (plat->eee_usecs_rate > 0) {
-		u32 tx_lpi_usec;
-
-		tx_lpi_usec = (plat->eee_usecs_rate / 1000000) - 1;
-		writel(tx_lpi_usec, res.addr + GMAC_1US_TIC_COUNTER);
-	}
-
 	ret = stmmac_config_multi_msi(pdev, plat, &res);
 	if (ret) {
 		ret = stmmac_config_single_msi(pdev, plat, &res);
-- 
2.30.2


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

* [PATCH net-next v2 3/5] net: stmmac: intel-plat: remove eee_usecs_rate and hardware write
  2025-04-12  8:05 [PATCH net-next v2 0/5] net: stmmac: remove unnecessary initialisation of 1µs TIC counter Russell King (Oracle)
  2025-04-12  8:08 ` [PATCH net-next v2 1/5] net: stmmac: dwc-qos: remove tegra_eqos_init() Russell King (Oracle)
  2025-04-12  8:08 ` [PATCH net-next v2 2/5] net: stmmac: intel: remove eee_usecs_rate and hardware write Russell King (Oracle)
@ 2025-04-12  8:08 ` Russell King (Oracle)
  2025-04-12  8:08 ` [PATCH net-next v2 4/5] net: stmmac: remove eee_usecs_rate Russell King (Oracle)
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Russell King (Oracle) @ 2025-04-12  8:08 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Jon Hunter, linux-arm-kernel, linux-stm32,
	Maxime Coquelin, netdev, Paolo Abeni, Philipp Zabel,
	Richard Cochran, Thierry Reding

Remove the write to GMAC_1US_TIC_COUNTER for two reasons:

1. during initialisation or reinitialisation of the DWMAC core, the
   core is reset, which sets this register back to its default value.
   Writing it prior to stmmac_dvr_probe() has no effect.

2. Since commit 8efbdbfa9938 ("net: stmmac: Initialize
   MAC_ONEUS_TIC_COUNTER register"), GMAC4/5 core code will set
   this register based on the rate of plat->stmmac_clk. This clock
   is fetched by devm_stmmac_probe_config_dt(), and plat->clk_ptp_rate
   will be set to its rate profided a "ptp_ref" clock is not provided.
   In any case, Marek's commit will set the effectual value of this
   register.

Therefore, dwmac-intel-plat.c writing GMAC_1US_TIC_COUNTER serves no
useful purpose and can be removed.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
index 599def7b3a64..4ea7b0a803d7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
@@ -113,16 +113,7 @@ static int intel_eth_plat_probe(struct platform_device *pdev)
 
 	plat_dat->clk_tx_i = dwmac->tx_clk;
 	plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate;
-
 	plat_dat->bsp_priv = dwmac;
-	plat_dat->eee_usecs_rate = plat_dat->clk_ptp_rate;
-
-	if (plat_dat->eee_usecs_rate > 0) {
-		u32 tx_lpi_usec;
-
-		tx_lpi_usec = (plat_dat->eee_usecs_rate / 1000000) - 1;
-		writel(tx_lpi_usec, stmmac_res.addr + GMAC_1US_TIC_COUNTER);
-	}
 
 	ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
 	if (ret)
-- 
2.30.2


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

* [PATCH net-next v2 4/5] net: stmmac: remove eee_usecs_rate
  2025-04-12  8:05 [PATCH net-next v2 0/5] net: stmmac: remove unnecessary initialisation of 1µs TIC counter Russell King (Oracle)
                   ` (2 preceding siblings ...)
  2025-04-12  8:08 ` [PATCH net-next v2 3/5] net: stmmac: intel-plat: " Russell King (Oracle)
@ 2025-04-12  8:08 ` Russell King (Oracle)
  2025-04-12  8:08 ` [PATCH net-next v2 5/5] net: stmmac: remove GMAC_1US_TIC_COUNTER definition Russell King (Oracle)
  2025-04-15  0:30 ` [PATCH net-next v2 0/5] net: stmmac: remove unnecessary initialisation of 1µs TIC counter patchwork-bot+netdevbpf
  5 siblings, 0 replies; 7+ messages in thread
From: Russell King (Oracle) @ 2025-04-12  8:08 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Jon Hunter, linux-arm-kernel, linux-stm32,
	Maxime Coquelin, netdev, Paolo Abeni, Philipp Zabel,
	Richard Cochran, Thierry Reding

plat_dat->eee_users_rate is now unused, so remove this member.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 include/linux/stmmac.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index c4ec8bb8144e..8aed09d65b4a 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -276,7 +276,6 @@ struct plat_stmmacenet_data {
 	int mac_port_sel_speed;
 	int has_xgmac;
 	u8 vlan_fail_q;
-	unsigned long eee_usecs_rate;
 	struct pci_dev *pdev;
 	int int_snapshot_num;
 	int msi_mac_vec;
-- 
2.30.2


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

* [PATCH net-next v2 5/5] net: stmmac: remove GMAC_1US_TIC_COUNTER definition
  2025-04-12  8:05 [PATCH net-next v2 0/5] net: stmmac: remove unnecessary initialisation of 1µs TIC counter Russell King (Oracle)
                   ` (3 preceding siblings ...)
  2025-04-12  8:08 ` [PATCH net-next v2 4/5] net: stmmac: remove eee_usecs_rate Russell King (Oracle)
@ 2025-04-12  8:08 ` Russell King (Oracle)
  2025-04-15  0:30 ` [PATCH net-next v2 0/5] net: stmmac: remove unnecessary initialisation of 1µs TIC counter patchwork-bot+netdevbpf
  5 siblings, 0 replies; 7+ messages in thread
From: Russell King (Oracle) @ 2025-04-12  8:08 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Jon Hunter, linux-arm-kernel, linux-stm32,
	Maxime Coquelin, netdev, Paolo Abeni, Philipp Zabel,
	Richard Cochran, Thierry Reding

GMAC_1US_TIC_COUNTER is now no longer used, so remove the definition.
This was duplicated by GMAC4_MAC_ONEUS_TIC_COUNTER further down in the
same file.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
index 42fe29a4e300..5f387ec27c8c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
@@ -31,7 +31,6 @@
 #define GMAC_RXQ_CTRL3			0x000000ac
 #define GMAC_INT_STATUS			0x000000b0
 #define GMAC_INT_EN			0x000000b4
-#define GMAC_1US_TIC_COUNTER		0x000000dc
 #define GMAC_PCS_BASE			0x000000e0
 #define GMAC_PHYIF_CONTROL_STATUS	0x000000f8
 #define GMAC_PMT			0x000000c0
-- 
2.30.2


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

* Re: [PATCH net-next v2 0/5] net: stmmac: remove unnecessary initialisation of 1µs TIC counter
  2025-04-12  8:05 [PATCH net-next v2 0/5] net: stmmac: remove unnecessary initialisation of 1µs TIC counter Russell King (Oracle)
                   ` (4 preceding siblings ...)
  2025-04-12  8:08 ` [PATCH net-next v2 5/5] net: stmmac: remove GMAC_1US_TIC_COUNTER definition Russell King (Oracle)
@ 2025-04-15  0:30 ` patchwork-bot+netdevbpf
  5 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-15  0:30 UTC (permalink / raw)
  To: Russell King
  Cc: andrew, hkallweit1, alexandre.torgue, andrew+netdev, davem,
	edumazet, kuba, jonathanh, linux-arm-kernel, linux-stm32,
	mcoquelin.stm32, netdev, pabeni, p.zabel, richardcochran, treding

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 12 Apr 2025 09:05:37 +0100 you wrote:
> Hi,
> 
> In commit 8efbdbfa9938 ("net: stmmac: Initialize MAC_ONEUS_TIC_COUNTER
> register"), code to initialise the LPI 1us counter in dwmac4's
> initialisation was added, making the initialisation in glue drivers
> unnecessary. This series cleans up the now redundant initialisation.
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/5] net: stmmac: dwc-qos: remove tegra_eqos_init()
    https://git.kernel.org/netdev/net-next/c/dadc3a6be469
  - [net-next,v2,2/5] net: stmmac: intel: remove eee_usecs_rate and hardware write
    https://git.kernel.org/netdev/net-next/c/17ec6dbaaed3
  - [net-next,v2,3/5] net: stmmac: intel-plat: remove eee_usecs_rate and hardware write
    https://git.kernel.org/netdev/net-next/c/35031c6256f1
  - [net-next,v2,4/5] net: stmmac: remove eee_usecs_rate
    https://git.kernel.org/netdev/net-next/c/651f88cb046c
  - [net-next,v2,5/5] net: stmmac: remove GMAC_1US_TIC_COUNTER definition
    https://git.kernel.org/netdev/net-next/c/25af74ed68c4

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-04-15  0:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-12  8:05 [PATCH net-next v2 0/5] net: stmmac: remove unnecessary initialisation of 1µs TIC counter Russell King (Oracle)
2025-04-12  8:08 ` [PATCH net-next v2 1/5] net: stmmac: dwc-qos: remove tegra_eqos_init() Russell King (Oracle)
2025-04-12  8:08 ` [PATCH net-next v2 2/5] net: stmmac: intel: remove eee_usecs_rate and hardware write Russell King (Oracle)
2025-04-12  8:08 ` [PATCH net-next v2 3/5] net: stmmac: intel-plat: " Russell King (Oracle)
2025-04-12  8:08 ` [PATCH net-next v2 4/5] net: stmmac: remove eee_usecs_rate Russell King (Oracle)
2025-04-12  8:08 ` [PATCH net-next v2 5/5] net: stmmac: remove GMAC_1US_TIC_COUNTER definition Russell King (Oracle)
2025-04-15  0:30 ` [PATCH net-next v2 0/5] net: stmmac: remove unnecessary initialisation of 1µs TIC counter patchwork-bot+netdevbpf

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).