Skip to contentSkip to conversation

net: stmmac: qcom-ethqos: add ethqos_pcs_set_inband()

PATCH Applied Russell King (Oracle) 4 participants 5 messages Jun 12, 2025 – Jun 16, 2025

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: stmmac: qcom-ethqos: add ethqos_pcs_set_inband()

Add ethqos_pcs_set_inband() to improve readability, and to allow future changes when phylink PCS support is properly merged.

---
 .../net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +9 -4
index e30bdf72331a..2e398574c7a7 100644
@@ -622,6 +622,11 @@ static void ethqos_set_serdes_speed(struct qcom_ethqos *ethqos, int speed)
 	}
 }
 
+static void ethqos_pcs_set_inband(struct stmmac_priv *priv, bool enable)
+{
+	stmmac_pcs_ctrl_ane(priv, priv->ioaddr, enable, 0, 0);
+}
+
 /* On interface toggle MAC registers gets reset.
  * Configure MAC block for SGMII on ethernet phy link up
  */
@@ -640,7 +645,7 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos, int speed)
 			      RGMII_CONFIG2_RGMII_CLK_SEL_CFG,
 			      RGMII_IO_MACRO_CONFIG2);
 		ethqos_set_serdes_speed(ethqos, SPEED_2500);
-		stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 0, 0, 0);
+		ethqos_pcs_set_inband(priv, false);
 		break;
 	case SPEED_1000:
 		val &= ~ETHQOS_MAC_CTRL_PORT_SEL;
@@ -648,12 +653,12 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos, int speed)
 			      RGMII_CONFIG2_RGMII_CLK_SEL_CFG,
 			      RGMII_IO_MACRO_CONFIG2);
 		ethqos_set_serdes_speed(ethqos, SPEED_1000);
-		stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
+		ethqos_pcs_set_inband(priv, true);
 		break;
 	case SPEED_100:
 		val |= ETHQOS_MAC_CTRL_PORT_SEL | ETHQOS_MAC_CTRL_SPEED_MODE;
 		ethqos_set_serdes_speed(ethqos, SPEED_1000);
-		stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
+		ethqos_pcs_set_inband(priv, true);
 		break;
 	case SPEED_10:
 		val |= ETHQOS_MAC_CTRL_PORT_SEL;
@@ -663,7 +668,7 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos, int speed)
 					 SGMII_10M_RX_CLK_DVDR),
 			      RGMII_IO_MACRO_CONFIG);
 		ethqos_set_serdes_speed(ethqos, SPEED_1000);
-		stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
+		ethqos_pcs_set_inband(priv, true);
 		break;
 	}
 
Signature · 1 line
2.30.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Russell King (Oracle)

Add ethqos_pcs_set_inband() to improve readability, and to allow future changes when phylink PCS support is properly merged.

Thanks Russell,

The nit below notwithstanding this looks good to me.

Quoted 9 lines
---
 .../net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +0 -0
index e30bdf72331a..2e398574c7a7 100644

drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c static void ethqos_set_serdes_speed(struct qcom_ethqos *ethqos, int speed) · line 627

Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +3 -0
@@ -622,6 +622,11 @@ static void ethqos_set_serdes_speed(struct qcom_ethqos *ethqos, int speed)
 	}
 }
 
+static void ethqos_pcs_set_inband(struct stmmac_priv *priv, bool enable)
+{
+	stmmac_pcs_ctrl_ane(priv, priv->ioaddr, enable, 0, 0);

FWIIW, I would have gone for the following, as all the type of three of the trailing parameters is bool.

	stmmac_pcs_ctrl_ane(priv, priv->ioaddr, enable, false, false);
Quoted 5 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +2 -0
+}
+
 /* On interface toggle MAC registers gets reset.
  * Configure MAC block for SGMII on ethernet phy link up
  */

...

#2 lore raw
Quoted 26 lines · Simon Horman
Quoted 6 lines · Russell King (Oracle)

Add ethqos_pcs_set_inband() to improve readability, and to allow future changes when phylink PCS support is properly merged.

Thanks Russell,

The nit below notwithstanding this looks good to me.

Quoted 12 lines
---
 .../net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +0 -0
index e30bdf72331a..2e398574c7a7 100644
@@ -622,6 +622,11 @@ static void ethqos_set_serdes_speed(struct qcom_ethqos *ethqos, int speed)
 	}
 }
 
Quoted 8 lines

drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c static void ethqos_set_serdes_speed(struct qcom_ethqos *ethqos, int speed) · line 627

Quoted 3 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +3 -0
+static void ethqos_pcs_set_inband(struct stmmac_priv *priv, bool enable)
+{
+	stmmac_pcs_ctrl_ane(priv, priv->ioaddr, enable, 0, 0);

FWIIW, I would have gone for the following, as all the type of three of the trailing parameters is bool.

	stmmac_pcs_ctrl_ane(priv, priv->ioaddr, enable, false, false);

So the original code:

            stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 0, 0, 0);
            stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
            stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
            stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);

While one could convert the last two arguments to true/false, I'd prefer leaving them as is, as less change means less chance to introduce a bug.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
reviewer
#3 lore raw
Quoted 38 lines · Russell King (Oracle)
Quoted 26 lines · Simon Horman
Quoted 6 lines · Russell King (Oracle)

Add ethqos_pcs_set_inband() to improve readability, and to allow future changes when phylink PCS support is properly merged.

Thanks Russell,

The nit below notwithstanding this looks good to me.

Quoted 12 lines
---
 .../net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +0 -0
index e30bdf72331a..2e398574c7a7 100644
@@ -622,6 +622,11 @@ static void ethqos_set_serdes_speed(struct qcom_ethqos *ethqos, int speed)
 	}
 }
 
Quoted 8 lines

drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c static void ethqos_set_serdes_speed(struct qcom_ethqos *ethqos, int speed) · line 627

Quoted 3 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +3 -0
+static void ethqos_pcs_set_inband(struct stmmac_priv *priv, bool enable)
+{
+	stmmac_pcs_ctrl_ane(priv, priv->ioaddr, enable, 0, 0);

FWIIW, I would have gone for the following, as all the type of three of the trailing parameters is bool.

	stmmac_pcs_ctrl_ane(priv, priv->ioaddr, enable, false, false);

So the original code:

Quoted 7 lines
            stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 0, 0, 0);
            stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
            stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);
            stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, 0, 0);

While one could convert the last two arguments to true/false, I'd prefer leaving them as is, as less change means less chance to introduce a bug.

Sure. No objections on my side.

#4 lore raw
In reply to Russell King (Oracle)
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 12 Jun 2025 17:16:30 +0100 you wrote:

Add ethqos_pcs_set_inband() to improve readability, and to allow future changes when phylink PCS support is properly merged.

[...]

Here is the summary with links:
- [net-next] net: stmmac: qcom-ethqos: add ethqos_pcs_set_inband()

    https://git.kernel.org/netdev/net-next/c/8909f5f4ecd5

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html