netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/6] net: stmmac: cleanups
@ 2024-05-29  8:40 Russell King (Oracle)
  2024-05-29  8:40 ` [PATCH net-next v2 1/6] net: stmmac: Drop TBI/RTBI PCS flags Russell King
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Russell King (Oracle) @ 2024-05-29  8:40 UTC (permalink / raw)
  To: Serge Semin
  Cc: Andrew Halaney, Alexandre Torgue, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Jose Abreu, linux-arm-kernel, linux-stm32,
	Maxime Coquelin, netdev, Paolo Abeni, Vinod Koul

Hi,

This series removes various redundant items in the stmmac driver:

- the unused TBI and RTBI PCS flags
- the NULL pointer initialisations for PCS methods in dwxgmac2
- the stmmac_pcs_rane() method which is never called, and it's
  associated implementations
- the redundant netif_carrier_off()s

Finally, it replaces asm/io.h with the preferred linux/io.h.

Changes since v1:
 - Fix patch 1 "Drop TBI/RTBI flags" which didn't transfer correctly
   between my internal trees!
 - Update patch 5 to address all the asm/io.h in stmmac
 - Add Andrew Halaney's reviewed-by
 - Add patch 6 cleaning up qcom-ethqos phy speed setting

 drivers/net/ethernet/stmicro/stmmac/common.h       |  2 --
 .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c    | 24 +++++++-------
 .../net/ethernet/stmicro/stmmac/dwmac1000_core.c   |  8 +----
 .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c    |  2 +-
 .../net/ethernet/stmicro/stmmac/dwmac100_core.c    |  2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c |  2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c  |  8 -----
 .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c    |  6 ----
 drivers/net/ethernet/stmicro/stmmac/hwif.h         |  3 --
 .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |  2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 38 +++++-----------------
 drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h   | 17 ----------
 12 files changed, 26 insertions(+), 88 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] 10+ messages in thread

* [PATCH net-next v2 1/6] net: stmmac: Drop TBI/RTBI PCS flags
  2024-05-29  8:40 [PATCH net-next v2 0/6] net: stmmac: cleanups Russell King (Oracle)
@ 2024-05-29  8:40 ` Russell King
  2024-05-29  8:40 ` [PATCH net-next v2 2/6] net: stmmac: dwxgmac2: remove useless NULL pointer initialisations Russell King (Oracle)
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Russell King @ 2024-05-29  8:40 UTC (permalink / raw)
  To: Serge Semin
  Cc: Andrew Halaney, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	netdev, linux-stm32, linux-arm-kernel

From: Serge Semin <fancer.lancer@gmail.com>

First of all the flags are never set by any of the driver parts. If nobody
have them set then the respective statements will always have the same
result. Thus the statements can be simplified or even dropped with no risk
to break things.

Secondly shall any of the TBI or RTBI flag is set the MDIO-bus
registration will be bypassed. Why? It really seems weird. It's perfectly
fine to have a TBI/RTBI-capable PHY configured over the MDIO bus
interface.

Based on the notes above the TBI/RTBI PCS flags can be freely dropped thus
simplifying the driver code.

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/common.h  |  2 --
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 35 +++++--------------
 2 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 9cd62b2110a1..cd36ff4da68c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -271,8 +271,6 @@ struct stmmac_safety_stats {
 /* PCS defines */
 #define STMMAC_PCS_RGMII	(1 << 0)
 #define STMMAC_PCS_SGMII	(1 << 1)
-#define STMMAC_PCS_TBI		(1 << 2)
-#define STMMAC_PCS_RTBI		(1 << 3)
 
 #define SF_DMA_MODE 1		/* DMA STORE-AND-FORWARD Operation Mode */
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b3afc7cb7d72..3ab93f89be90 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -471,13 +471,6 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
 {
 	int eee_tw_timer = priv->eee_tw_timer;
 
-	/* Using PCS we cannot dial with the phy registers at this stage
-	 * so we do not support extra feature like EEE.
-	 */
-	if (priv->hw->pcs == STMMAC_PCS_TBI ||
-	    priv->hw->pcs == STMMAC_PCS_RTBI)
-		return false;
-
 	/* Check if MAC core supports the EEE feature. */
 	if (!priv->dma_cap.eee)
 		return false;
@@ -3953,9 +3946,7 @@ static int __stmmac_open(struct net_device *dev,
 	if (ret < 0)
 		return ret;
 
-	if (priv->hw->pcs != STMMAC_PCS_TBI &&
-	    priv->hw->pcs != STMMAC_PCS_RTBI &&
-	    (!priv->hw->xpcs ||
+	if ((!priv->hw->xpcs ||
 	     xpcs_get_an_mode(priv->hw->xpcs, mode) != DW_AN_C73)) {
 		ret = stmmac_init_phy(dev);
 		if (ret) {
@@ -7739,16 +7730,12 @@ int stmmac_dvr_probe(struct device *device,
 	if (!pm_runtime_enabled(device))
 		pm_runtime_enable(device);
 
-	if (priv->hw->pcs != STMMAC_PCS_TBI &&
-	    priv->hw->pcs != STMMAC_PCS_RTBI) {
-		/* MDIO bus Registration */
-		ret = stmmac_mdio_register(ndev);
-		if (ret < 0) {
-			dev_err_probe(priv->device, ret,
-				      "%s: MDIO bus (id: %d) registration failed\n",
-				      __func__, priv->plat->bus_id);
-			goto error_mdio_register;
-		}
+	ret = stmmac_mdio_register(ndev);
+	if (ret < 0) {
+		dev_err_probe(priv->device, ret,
+			      "MDIO bus (id: %d) registration failed\n",
+			      priv->plat->bus_id);
+		goto error_mdio_register;
 	}
 
 	if (priv->plat->speed_mode_2500)
@@ -7790,9 +7777,7 @@ int stmmac_dvr_probe(struct device *device,
 error_phy_setup:
 	stmmac_pcs_clean(ndev);
 error_pcs_setup:
-	if (priv->hw->pcs != STMMAC_PCS_TBI &&
-	    priv->hw->pcs != STMMAC_PCS_RTBI)
-		stmmac_mdio_unregister(ndev);
+	stmmac_mdio_unregister(ndev);
 error_mdio_register:
 	stmmac_napi_del(ndev);
 error_hw_init:
@@ -7833,10 +7818,8 @@ void stmmac_dvr_remove(struct device *dev)
 	reset_control_assert(priv->plat->stmmac_ahb_rst);
 
 	stmmac_pcs_clean(ndev);
+	stmmac_mdio_unregister(ndev);
 
-	if (priv->hw->pcs != STMMAC_PCS_TBI &&
-	    priv->hw->pcs != STMMAC_PCS_RTBI)
-		stmmac_mdio_unregister(ndev);
 	destroy_workqueue(priv->wq);
 	mutex_destroy(&priv->lock);
 	bitmap_free(priv->af_xdp_zc_qps);
-- 
2.30.2


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

* [PATCH net-next v2 2/6] net: stmmac: dwxgmac2: remove useless NULL pointer initialisations
  2024-05-29  8:40 [PATCH net-next v2 0/6] net: stmmac: cleanups Russell King (Oracle)
  2024-05-29  8:40 ` [PATCH net-next v2 1/6] net: stmmac: Drop TBI/RTBI PCS flags Russell King
@ 2024-05-29  8:40 ` Russell King (Oracle)
  2024-05-29  8:40 ` [PATCH net-next v2 3/6] net: stmmac: remove pcs_rane() method Russell King (Oracle)
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Russell King (Oracle) @ 2024-05-29  8:40 UTC (permalink / raw)
  To: Serge Semin
  Cc: Andrew Halaney, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	netdev, linux-stm32, linux-arm-kernel

Remove useless NULL pointer initialisations for "PCS" methods from the
dwxgmac2 code.

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
index f8e7775bb633..6a987cf598e4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
@@ -1554,9 +1554,6 @@ const struct stmmac_ops dwxgmac210_ops = {
 	.reset_eee_mode = dwxgmac2_reset_eee_mode,
 	.set_eee_timer = dwxgmac2_set_eee_timer,
 	.set_eee_pls = dwxgmac2_set_eee_pls,
-	.pcs_ctrl_ane = NULL,
-	.pcs_rane = NULL,
-	.pcs_get_adv_lp = NULL,
 	.debug = NULL,
 	.set_filter = dwxgmac2_set_filter,
 	.safety_feat_config = dwxgmac3_safety_feat_config,
@@ -1614,9 +1611,6 @@ const struct stmmac_ops dwxlgmac2_ops = {
 	.reset_eee_mode = dwxgmac2_reset_eee_mode,
 	.set_eee_timer = dwxgmac2_set_eee_timer,
 	.set_eee_pls = dwxgmac2_set_eee_pls,
-	.pcs_ctrl_ane = NULL,
-	.pcs_rane = NULL,
-	.pcs_get_adv_lp = NULL,
 	.debug = NULL,
 	.set_filter = dwxgmac2_set_filter,
 	.safety_feat_config = dwxgmac3_safety_feat_config,
-- 
2.30.2


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

* [PATCH net-next v2 3/6] net: stmmac: remove pcs_rane() method
  2024-05-29  8:40 [PATCH net-next v2 0/6] net: stmmac: cleanups Russell King (Oracle)
  2024-05-29  8:40 ` [PATCH net-next v2 1/6] net: stmmac: Drop TBI/RTBI PCS flags Russell King
  2024-05-29  8:40 ` [PATCH net-next v2 2/6] net: stmmac: dwxgmac2: remove useless NULL pointer initialisations Russell King (Oracle)
@ 2024-05-29  8:40 ` Russell King (Oracle)
  2024-05-29  8:40 ` [PATCH net-next v2 4/6] net: stmmac: remove unnecessary netif_carrier_off() Russell King (Oracle)
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Russell King (Oracle) @ 2024-05-29  8:40 UTC (permalink / raw)
  To: Serge Semin
  Cc: Andrew Halaney, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	netdev, linux-stm32, linux-arm-kernel

The pcs_rane() method is not called, so lets just remove this
redundant code.

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 .../ethernet/stmicro/stmmac/dwmac1000_core.c    |  6 ------
 .../net/ethernet/stmicro/stmmac/dwmac4_core.c   |  8 --------
 drivers/net/ethernet/stmicro/stmmac/hwif.h      |  3 ---
 .../net/ethernet/stmicro/stmmac/stmmac_pcs.h    | 17 -----------------
 4 files changed, 34 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index 8555299443f4..d0c7c2320d8d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -404,11 +404,6 @@ static void dwmac1000_ctrl_ane(void __iomem *ioaddr, bool ane, bool srgmi_ral,
 	dwmac_ctrl_ane(ioaddr, GMAC_PCS_BASE, ane, srgmi_ral, loopback);
 }
 
-static void dwmac1000_rane(void __iomem *ioaddr, bool restart)
-{
-	dwmac_rane(ioaddr, GMAC_PCS_BASE, restart);
-}
-
 static void dwmac1000_get_adv_lp(void __iomem *ioaddr, struct rgmii_adv *adv)
 {
 	dwmac_get_adv_lp(ioaddr, GMAC_PCS_BASE, adv);
@@ -519,7 +514,6 @@ const struct stmmac_ops dwmac1000_ops = {
 	.set_eee_pls = dwmac1000_set_eee_pls,
 	.debug = dwmac1000_debug,
 	.pcs_ctrl_ane = dwmac1000_ctrl_ane,
-	.pcs_rane = dwmac1000_rane,
 	.pcs_get_adv_lp = dwmac1000_get_adv_lp,
 	.set_mac_loopback = dwmac1000_set_mac_loopback,
 };
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index b25774d69195..dbd9f93b2460 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -758,11 +758,6 @@ static void dwmac4_ctrl_ane(void __iomem *ioaddr, bool ane, bool srgmi_ral,
 	dwmac_ctrl_ane(ioaddr, GMAC_PCS_BASE, ane, srgmi_ral, loopback);
 }
 
-static void dwmac4_rane(void __iomem *ioaddr, bool restart)
-{
-	dwmac_rane(ioaddr, GMAC_PCS_BASE, restart);
-}
-
 static void dwmac4_get_adv_lp(void __iomem *ioaddr, struct rgmii_adv *adv)
 {
 	dwmac_get_adv_lp(ioaddr, GMAC_PCS_BASE, adv);
@@ -1215,7 +1210,6 @@ const struct stmmac_ops dwmac4_ops = {
 	.set_eee_timer = dwmac4_set_eee_timer,
 	.set_eee_pls = dwmac4_set_eee_pls,
 	.pcs_ctrl_ane = dwmac4_ctrl_ane,
-	.pcs_rane = dwmac4_rane,
 	.pcs_get_adv_lp = dwmac4_get_adv_lp,
 	.debug = dwmac4_debug,
 	.set_filter = dwmac4_set_filter,
@@ -1260,7 +1254,6 @@ const struct stmmac_ops dwmac410_ops = {
 	.set_eee_timer = dwmac4_set_eee_timer,
 	.set_eee_pls = dwmac4_set_eee_pls,
 	.pcs_ctrl_ane = dwmac4_ctrl_ane,
-	.pcs_rane = dwmac4_rane,
 	.pcs_get_adv_lp = dwmac4_get_adv_lp,
 	.debug = dwmac4_debug,
 	.set_filter = dwmac4_set_filter,
@@ -1309,7 +1302,6 @@ const struct stmmac_ops dwmac510_ops = {
 	.set_eee_timer = dwmac4_set_eee_timer,
 	.set_eee_pls = dwmac4_set_eee_pls,
 	.pcs_ctrl_ane = dwmac4_ctrl_ane,
-	.pcs_rane = dwmac4_rane,
 	.pcs_get_adv_lp = dwmac4_get_adv_lp,
 	.debug = dwmac4_debug,
 	.set_filter = dwmac4_set_filter,
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h
index 90384db228b5..97934ccba5b1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
@@ -370,7 +370,6 @@ struct stmmac_ops {
 	/* PCS calls */
 	void (*pcs_ctrl_ane)(void __iomem *ioaddr, bool ane, bool srgmi_ral,
 			     bool loopback);
-	void (*pcs_rane)(void __iomem *ioaddr, bool restart);
 	void (*pcs_get_adv_lp)(void __iomem *ioaddr, struct rgmii_adv *adv);
 	/* Safety Features */
 	int (*safety_feat_config)(void __iomem *ioaddr, unsigned int asp,
@@ -484,8 +483,6 @@ struct stmmac_ops {
 	stmmac_do_void_callback(__priv, mac, debug, __priv, __args)
 #define stmmac_pcs_ctrl_ane(__priv, __args...) \
 	stmmac_do_void_callback(__priv, mac, pcs_ctrl_ane, __args)
-#define stmmac_pcs_rane(__priv, __args...) \
-	stmmac_do_void_callback(__priv, mac, pcs_rane, __priv, __args)
 #define stmmac_pcs_get_adv_lp(__priv, __args...) \
 	stmmac_do_void_callback(__priv, mac, pcs_get_adv_lp, __args)
 #define stmmac_safety_feat_config(__priv, __args...) \
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
index 13a30e6df4c1..1bdf87b237c4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h
@@ -74,23 +74,6 @@ static inline void dwmac_pcs_isr(void __iomem *ioaddr, u32 reg,
 	}
 }
 
-/**
- * dwmac_rane - To restart ANE
- * @ioaddr: IO registers pointer
- * @reg: Base address of the AN Control Register.
- * @restart: to restart ANE
- * Description: this is to just restart the Auto-Negotiation.
- */
-static inline void dwmac_rane(void __iomem *ioaddr, u32 reg, bool restart)
-{
-	u32 value = readl(ioaddr + GMAC_AN_CTRL(reg));
-
-	if (restart)
-		value |= GMAC_AN_CTRL_RAN;
-
-	writel(value, ioaddr + GMAC_AN_CTRL(reg));
-}
-
 /**
  * dwmac_ctrl_ane - To program the AN Control Register.
  * @ioaddr: IO registers pointer
-- 
2.30.2


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

* [PATCH net-next v2 4/6] net: stmmac: remove unnecessary netif_carrier_off()
  2024-05-29  8:40 [PATCH net-next v2 0/6] net: stmmac: cleanups Russell King (Oracle)
                   ` (2 preceding siblings ...)
  2024-05-29  8:40 ` [PATCH net-next v2 3/6] net: stmmac: remove pcs_rane() method Russell King (Oracle)
@ 2024-05-29  8:40 ` Russell King (Oracle)
  2024-05-29  8:40 ` [PATCH net-next v2 5/6] net: stmmac: include linux/io.h rather than asm/io.h Russell King (Oracle)
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Russell King (Oracle) @ 2024-05-29  8:40 UTC (permalink / raw)
  To: Serge Semin
  Cc: Andrew Halaney, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	netdev, linux-stm32, linux-arm-kernel

It is incorrect to call netif_carrier_off(), or in fact any driver
teardown, before unregister_netdev() has been called.

unregister_netdev() unpublishes the network device from userspace, and
takes the interface down if it was up prior to returning. Therefore,
once the call has returned, we are guaranteed that .ndo_stop() will
have been called for an interface that was up. Phylink will take the
carrier down via phylink_stop(), making any manipulation of the carrier
in the remove path unnecessary.

In the stmmac_release() path, the netif_carrier_off() call follows the
call to phylink_stop(), so this call is redundant.

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 3ab93f89be90..ca19b232431a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4088,8 +4088,6 @@ static int stmmac_release(struct net_device *dev)
 	if (priv->plat->serdes_powerdown)
 		priv->plat->serdes_powerdown(dev, priv->plat->bsp_priv);
 
-	netif_carrier_off(dev);
-
 	stmmac_release_ptp(priv);
 
 	pm_runtime_put(priv->device);
@@ -7806,7 +7804,6 @@ void stmmac_dvr_remove(struct device *dev)
 
 	stmmac_stop_all_dma(priv);
 	stmmac_mac_set(priv, priv->ioaddr, false);
-	netif_carrier_off(ndev);
 	unregister_netdev(ndev);
 
 #ifdef CONFIG_DEBUG_FS
-- 
2.30.2


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

* [PATCH net-next v2 5/6] net: stmmac: include linux/io.h rather than asm/io.h
  2024-05-29  8:40 [PATCH net-next v2 0/6] net: stmmac: cleanups Russell King (Oracle)
                   ` (3 preceding siblings ...)
  2024-05-29  8:40 ` [PATCH net-next v2 4/6] net: stmmac: remove unnecessary netif_carrier_off() Russell King (Oracle)
@ 2024-05-29  8:40 ` Russell King (Oracle)
  2024-05-29  8:40 ` [PATCH net-next v2 6/6] net: stmmac: ethqos: clean up setting serdes speed Russell King (Oracle)
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Russell King (Oracle) @ 2024-05-29  8:40 UTC (permalink / raw)
  To: Serge Semin
  Cc: Andrew Halaney, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	netdev, linux-stm32, linux-arm-kernel

Include linux/io.h instead of asm/io.h since linux/ includes are
preferred.

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c  | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c  | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c   | 2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index d0c7c2320d8d..d413d76a8936 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -15,7 +15,7 @@
 #include <linux/crc32.h>
 #include <linux/slab.h>
 #include <linux/ethtool.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include "stmmac.h"
 #include "stmmac_pcs.h"
 #include "dwmac1000.h"
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
index daf79cdbd3ec..adccdd816ea9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
@@ -12,7 +12,7 @@
   Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
 *******************************************************************************/
 
-#include <asm/io.h>
+#include <linux/io.h>
 #include "dwmac1000.h"
 #include "dwmac_dma.h"
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
index 7667d103cd0e..14e847c0e1a9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
@@ -15,7 +15,7 @@
 *******************************************************************************/
 
 #include <linux/crc32.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include "stmmac.h"
 #include "dwmac100.h"
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
index dea270f60cc3..b402fb54f613 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
@@ -14,7 +14,7 @@
   Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
 *******************************************************************************/
 
-#include <asm/io.h>
+#include <linux/io.h>
 #include "dwmac100.h"
 #include "dwmac_dma.h"
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 542e2633a6f5..18468c0228f0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -11,10 +11,10 @@
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
 #include <linux/interrupt.h>
+#include <linux/io.h>
 #include <linux/mii.h>
 #include <linux/phylink.h>
 #include <linux/net_tstamp.h>
-#include <asm/io.h>
 
 #include "stmmac.h"
 #include "dwmac_dma.h"
-- 
2.30.2


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

* [PATCH net-next v2 6/6] net: stmmac: ethqos: clean up setting serdes speed
  2024-05-29  8:40 [PATCH net-next v2 0/6] net: stmmac: cleanups Russell King (Oracle)
                   ` (4 preceding siblings ...)
  2024-05-29  8:40 ` [PATCH net-next v2 5/6] net: stmmac: include linux/io.h rather than asm/io.h Russell King (Oracle)
@ 2024-05-29  8:40 ` Russell King (Oracle)
  2024-05-29 21:44   ` Andrew Halaney
  2024-05-29  9:05 ` [PATCH net-next v2 0/6] net: stmmac: cleanups Serge Semin
  2024-05-31  1:40 ` patchwork-bot+netdevbpf
  7 siblings, 1 reply; 10+ messages in thread
From: Russell King (Oracle) @ 2024-05-29  8:40 UTC (permalink / raw)
  To: Serge Semin
  Cc: Andrew Halaney, Vinod Koul, Alexandre Torgue, Jose Abreu,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, netdev, linux-arm-msm, linux-stm32,
	linux-arm-kernel

There are four repititions of the same sequence of code, three of which
are identical. Pull these out into a separate function to improve
readability.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 .../stmicro/stmmac/dwmac-qcom-ethqos.c        | 24 +++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index e254b21fdb59..d9eed415b0b7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -605,6 +605,14 @@ static int ethqos_configure_rgmii(struct qcom_ethqos *ethqos)
 	return 0;
 }
 
+static void ethqos_set_serdes_speed(struct qcom_ethqos *ethqos, int speed)
+{
+	if (ethqos->serdes_speed != speed) {
+		phy_set_speed(ethqos->serdes_phy, speed);
+		ethqos->serdes_speed = speed;
+	}
+}
+
 /* On interface toggle MAC registers gets reset.
  * Configure MAC block for SGMII on ethernet phy link up
  */
@@ -622,9 +630,7 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos)
 		rgmii_updatel(ethqos, RGMII_CONFIG2_RGMII_CLK_SEL_CFG,
 			      RGMII_CONFIG2_RGMII_CLK_SEL_CFG,
 			      RGMII_IO_MACRO_CONFIG2);
-		if (ethqos->serdes_speed != SPEED_2500)
-			phy_set_speed(ethqos->serdes_phy, SPEED_2500);
-		ethqos->serdes_speed = SPEED_2500;
+		ethqos_set_serdes_speed(ethqos, SPEED_2500);
 		stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 0, 0, 0);
 		break;
 	case SPEED_1000:
@@ -632,16 +638,12 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos)
 		rgmii_updatel(ethqos, RGMII_CONFIG2_RGMII_CLK_SEL_CFG,
 			      RGMII_CONFIG2_RGMII_CLK_SEL_CFG,
 			      RGMII_IO_MACRO_CONFIG2);
-		if (ethqos->serdes_speed != SPEED_1000)
-			phy_set_speed(ethqos->serdes_phy, SPEED_1000);
-		ethqos->serdes_speed = SPEED_1000;
+		ethqos_set_serdes_speed(ethqos, SPEED_1000);
 		stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
 		break;
 	case SPEED_100:
 		val |= ETHQOS_MAC_CTRL_PORT_SEL | ETHQOS_MAC_CTRL_SPEED_MODE;
-		if (ethqos->serdes_speed != SPEED_1000)
-			phy_set_speed(ethqos->serdes_phy, SPEED_1000);
-		ethqos->serdes_speed = SPEED_1000;
+		ethqos_set_serdes_speed(ethqos, SPEED_1000);
 		stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
 		break;
 	case SPEED_10:
@@ -651,9 +653,7 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos)
 			      FIELD_PREP(RGMII_CONFIG_SGMII_CLK_DVDR,
 					 SGMII_10M_RX_CLK_DVDR),
 			      RGMII_IO_MACRO_CONFIG);
-		if (ethqos->serdes_speed != SPEED_1000)
-			phy_set_speed(ethqos->serdes_phy, ethqos->speed);
-		ethqos->serdes_speed = SPEED_1000;
+		ethqos_set_serdes_speed(ethqos, SPEED_1000);
 		stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
 		break;
 	}
-- 
2.30.2


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

* Re: [PATCH net-next v2 0/6] net: stmmac: cleanups
  2024-05-29  8:40 [PATCH net-next v2 0/6] net: stmmac: cleanups Russell King (Oracle)
                   ` (5 preceding siblings ...)
  2024-05-29  8:40 ` [PATCH net-next v2 6/6] net: stmmac: ethqos: clean up setting serdes speed Russell King (Oracle)
@ 2024-05-29  9:05 ` Serge Semin
  2024-05-31  1:40 ` patchwork-bot+netdevbpf
  7 siblings, 0 replies; 10+ messages in thread
From: Serge Semin @ 2024-05-29  9:05 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Andrew Halaney, Alexandre Torgue, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Jose Abreu, linux-arm-kernel, linux-stm32,
	Maxime Coquelin, netdev, Paolo Abeni, Vinod Koul

Hi Russell

On Wed, May 29, 2024 at 09:40:15AM +0100, Russell King (Oracle) wrote:
> Hi,
> 
> This series removes various redundant items in the stmmac driver:
> 
> - the unused TBI and RTBI PCS flags
> - the NULL pointer initialisations for PCS methods in dwxgmac2
> - the stmmac_pcs_rane() method which is never called, and it's
>   associated implementations
> - the redundant netif_carrier_off()s
> 
> Finally, it replaces asm/io.h with the preferred linux/io.h.
> 
> Changes since v1:
>  - Fix patch 1 "Drop TBI/RTBI flags" which didn't transfer correctly
>    between my internal trees!
>  - Update patch 5 to address all the asm/io.h in stmmac
>  - Add Andrew Halaney's reviewed-by
>  - Add patch 6 cleaning up qcom-ethqos phy speed setting

Thanks for the series. For all patches:

Reviewed-by: Serge Semin <fancer.lancer@gmail.com>

* Note I've got your messages regarding the STMMAC driver and
RGMII/SGMII/etc PCS. I do remember about that and will respond to all
of them either later today or tomorrow. Currently busy with my long
lasting DW XPCS series.

-Serge(y)

> 
>  drivers/net/ethernet/stmicro/stmmac/common.h       |  2 --
>  .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c    | 24 +++++++-------
>  .../net/ethernet/stmicro/stmmac/dwmac1000_core.c   |  8 +----
>  .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c    |  2 +-
>  .../net/ethernet/stmicro/stmmac/dwmac100_core.c    |  2 +-
>  drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c |  2 +-
>  drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c  |  8 -----
>  .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c    |  6 ----
>  drivers/net/ethernet/stmicro/stmmac/hwif.h         |  3 --
>  .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |  2 +-
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 38 +++++-----------------
>  drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h   | 17 ----------
>  12 files changed, 26 insertions(+), 88 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] 10+ messages in thread

* Re: [PATCH net-next v2 6/6] net: stmmac: ethqos: clean up setting serdes speed
  2024-05-29  8:40 ` [PATCH net-next v2 6/6] net: stmmac: ethqos: clean up setting serdes speed Russell King (Oracle)
@ 2024-05-29 21:44   ` Andrew Halaney
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Halaney @ 2024-05-29 21:44 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Serge Semin, Vinod Koul, Alexandre Torgue, Jose Abreu,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, netdev, linux-arm-msm, linux-stm32,
	linux-arm-kernel

On Wed, May 29, 2024 at 09:40:59AM GMT, Russell King (Oracle) wrote:
> There are four repititions of the same sequence of code, three of which
> are identical. Pull these out into a separate function to improve
> readability.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>


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

* Re: [PATCH net-next v2 0/6] net: stmmac: cleanups
  2024-05-29  8:40 [PATCH net-next v2 0/6] net: stmmac: cleanups Russell King (Oracle)
                   ` (6 preceding siblings ...)
  2024-05-29  9:05 ` [PATCH net-next v2 0/6] net: stmmac: cleanups Serge Semin
@ 2024-05-31  1:40 ` patchwork-bot+netdevbpf
  7 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-31  1:40 UTC (permalink / raw)
  To: Russell King
  Cc: fancer.lancer, ahalaney, alexandre.torgue, davem, edumazet, kuba,
	joabreu, linux-arm-kernel, linux-stm32, mcoquelin.stm32, netdev,
	pabeni, vkoul

Hello:

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

On Wed, 29 May 2024 09:40:15 +0100 you wrote:
> Hi,
> 
> This series removes various redundant items in the stmmac driver:
> 
> - the unused TBI and RTBI PCS flags
> - the NULL pointer initialisations for PCS methods in dwxgmac2
> - the stmmac_pcs_rane() method which is never called, and it's
>   associated implementations
> - the redundant netif_carrier_off()s
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/6] net: stmmac: Drop TBI/RTBI PCS flags
    https://git.kernel.org/netdev/net-next/c/482b3c3ba757
  - [net-next,v2,2/6] net: stmmac: dwxgmac2: remove useless NULL pointer initialisations
    https://git.kernel.org/netdev/net-next/c/4af90c0f4844
  - [net-next,v2,3/6] net: stmmac: remove pcs_rane() method
    https://git.kernel.org/netdev/net-next/c/3277407e5e82
  - [net-next,v2,4/6] net: stmmac: remove unnecessary netif_carrier_off()
    https://git.kernel.org/netdev/net-next/c/aee04f4bb44d
  - [net-next,v2,5/6] net: stmmac: include linux/io.h rather than asm/io.h
    https://git.kernel.org/netdev/net-next/c/cd56ff75ccfc
  - [net-next,v2,6/6] net: stmmac: ethqos: clean up setting serdes speed
    https://git.kernel.org/netdev/net-next/c/7efc70657704

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] 10+ messages in thread

end of thread, other threads:[~2024-05-31  1:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-29  8:40 [PATCH net-next v2 0/6] net: stmmac: cleanups Russell King (Oracle)
2024-05-29  8:40 ` [PATCH net-next v2 1/6] net: stmmac: Drop TBI/RTBI PCS flags Russell King
2024-05-29  8:40 ` [PATCH net-next v2 2/6] net: stmmac: dwxgmac2: remove useless NULL pointer initialisations Russell King (Oracle)
2024-05-29  8:40 ` [PATCH net-next v2 3/6] net: stmmac: remove pcs_rane() method Russell King (Oracle)
2024-05-29  8:40 ` [PATCH net-next v2 4/6] net: stmmac: remove unnecessary netif_carrier_off() Russell King (Oracle)
2024-05-29  8:40 ` [PATCH net-next v2 5/6] net: stmmac: include linux/io.h rather than asm/io.h Russell King (Oracle)
2024-05-29  8:40 ` [PATCH net-next v2 6/6] net: stmmac: ethqos: clean up setting serdes speed Russell King (Oracle)
2024-05-29 21:44   ` Andrew Halaney
2024-05-29  9:05 ` [PATCH net-next v2 0/6] net: stmmac: cleanups Serge Semin
2024-05-31  1:40 ` 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).