]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: pcs: xpcs: implement pcs_inband_caps() method
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thu, 5 Dec 2024 09:42:34 +0000 (09:42 +0000)
committerJakub Kicinski <kuba@kernel.org>
Sun, 8 Dec 2024 01:49:43 +0000 (17:49 -0800)
Report the PCS inband capabilities to phylink for XPCS.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1tJ8NW-006L5V-I9@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/pcs/pcs-xpcs.c

index 7246a910728d135f7871f023216e2310c129a42e..f70ca39f0905b2d70d3e5669551b7a77b22da751 100644 (file)
@@ -567,6 +567,33 @@ static int xpcs_validate(struct phylink_pcs *pcs, unsigned long *supported,
        return 0;
 }
 
+static unsigned int xpcs_inband_caps(struct phylink_pcs *pcs,
+                                    phy_interface_t interface)
+{
+       struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);
+       const struct dw_xpcs_compat *compat;
+
+       compat = xpcs_find_compat(xpcs, interface);
+       if (!compat)
+               return 0;
+
+       switch (compat->an_mode) {
+       case DW_AN_C73:
+               return LINK_INBAND_ENABLE;
+
+       case DW_AN_C37_SGMII:
+       case DW_AN_C37_1000BASEX:
+               return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE;
+
+       case DW_10GBASER:
+       case DW_2500BASEX:
+               return LINK_INBAND_DISABLE;
+
+       default:
+               return 0;
+       }
+}
+
 void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces)
 {
        const struct dw_xpcs_compat *compat;
@@ -1306,6 +1333,7 @@ static const struct dw_xpcs_desc xpcs_desc_list[] = {
 
 static const struct phylink_pcs_ops xpcs_phylink_ops = {
        .pcs_validate = xpcs_validate,
+       .pcs_inband_caps = xpcs_inband_caps,
        .pcs_pre_config = xpcs_pre_config,
        .pcs_config = xpcs_config,
        .pcs_get_state = xpcs_get_state,