]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: stmmac: dwmac-intel: provide a select_pcs() implementation
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thu, 13 Jun 2024 10:36:11 +0000 (11:36 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 15 Jun 2024 02:06:40 +0000 (19:06 -0700)
Move the code returning the XPCS into dwmac-intel, which is the only
user of XPCS. Fill in the select_pcs() implementation only when we are
going to setup the XPCS, thus when it should be present.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/E1sHhoR-00FetB-CP@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 56649edb18cd54c26bb0bd947c80edc10762efbc..094d34c4193c231bc4d26a9a6a9fb3c7d5db9fe4 100644 (file)
@@ -443,6 +443,16 @@ static void common_default_data(struct plat_stmmacenet_data *plat)
        plat->rx_queues_cfg[0].pkt_route = 0x0;
 }
 
+static struct phylink_pcs *intel_mgbe_select_pcs(struct stmmac_priv *priv,
+                                                phy_interface_t interface)
+{
+       /* plat->mdio_bus_data->has_xpcs has been set true, so there
+        * should always be an XPCS. The original code would always
+        * return this if present.
+        */
+       return &priv->hw->xpcs->pcs;
+}
+
 static int intel_mgbe_common_data(struct pci_dev *pdev,
                                  struct plat_stmmacenet_data *plat)
 {
@@ -587,6 +597,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
            plat->phy_interface == PHY_INTERFACE_MODE_1000BASEX) {
                plat->mdio_bus_data->has_xpcs = true;
                plat->mdio_bus_data->default_an_inband = true;
+               plat->select_pcs = intel_mgbe_select_pcs;
        }
 
        /* Ensure mdio bus scan skips intel serdes and pcs-xpcs */
index 302aa4080de3b78a9b35d767ed67e5bbcbb8ef2f..e9e2a95c91a32f4116b86e8b0a33a3b09e943588 100644 (file)
@@ -957,9 +957,6 @@ static struct phylink_pcs *stmmac_mac_select_pcs(struct phylink_config *config,
                        return pcs;
        }
 
-       if (priv->hw->xpcs)
-               return &priv->hw->xpcs->pcs;
-
        return priv->hw->phylink_pcs;
 }