net: xpcs: convert to phylink managed EEE
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Mon, 10 Feb 2025 10:53:55 +0000 (10:53 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 14 Feb 2025 21:42:51 +0000 (13:42 -0800)
Convert XPCS to use the new pcs_disable_eee() and pcs_enable_eee()
methods. Since stmmac is the only user of xpcs_config_eee(), we can
make this a no-op along with this change.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1thRQJ-003w7C-6v@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/pcs/pcs-xpcs.c

index 91ce4b13df327b7a514164fb0bc035a1f3f78c79..1f312b5589a395b2a8979e07c803712ab0d09346 100644 (file)
@@ -602,7 +602,8 @@ static void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces)
                __set_bit(compat->interface, interfaces);
 }
 
-int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable)
+static int __xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns,
+                            int enable)
 {
        u16 mask, val;
        int ret;
@@ -630,6 +631,11 @@ int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable)
                           DW_VR_MII_EEE_TRN_LPI,
                           enable ? DW_VR_MII_EEE_TRN_LPI : 0);
 }
+
+int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable)
+{
+       return 0;
+}
 EXPORT_SYMBOL_GPL(xpcs_config_eee);
 
 static void xpcs_pre_config(struct phylink_pcs *pcs, phy_interface_t interface)
@@ -1193,6 +1199,20 @@ static void xpcs_an_restart(struct phylink_pcs *pcs)
                    BMCR_ANRESTART);
 }
 
+static void xpcs_disable_eee(struct phylink_pcs *pcs)
+{
+       struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);
+
+       __xpcs_config_eee(xpcs, 0, false);
+}
+
+static void xpcs_enable_eee(struct phylink_pcs *pcs)
+{
+       struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);
+
+       __xpcs_config_eee(xpcs, xpcs->eee_mult_fact, true);
+}
+
 /**
  * xpcs_config_eee_mult_fact() - set the EEE clock multiplying factor
  * @xpcs: pointer to a &struct dw_xpcs instance
@@ -1355,6 +1375,8 @@ static const struct phylink_pcs_ops xpcs_phylink_ops = {
        .pcs_get_state = xpcs_get_state,
        .pcs_an_restart = xpcs_an_restart,
        .pcs_link_up = xpcs_link_up,
+       .pcs_disable_eee = xpcs_disable_eee,
+       .pcs_enable_eee = xpcs_enable_eee,
 };
 
 static int xpcs_identify(struct dw_xpcs *xpcs)