]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: enetc: use phylink_generic_validate()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 16 Nov 2021 09:59:08 +0000 (09:59 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 17 Nov 2021 11:19:28 +0000 (11:19 +0000)
enetc has no special behaviour in its validation implementation, so can
be switched to phylink_generic_validate().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/enetc/enetc_pf.c

index 61f05a0217795536ac22d7e47703a6d02cd85167..fe6a544f37f054fabd31d7a0b04f61d74b86f4e3 100644 (file)
@@ -930,35 +930,6 @@ static void enetc_mdiobus_destroy(struct enetc_pf *pf)
        enetc_imdio_remove(pf);
 }
 
-static void enetc_pl_mac_validate(struct phylink_config *config,
-                                 unsigned long *supported,
-                                 struct phylink_link_state *state)
-{
-       __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
-
-       phylink_set_port_modes(mask);
-       phylink_set(mask, Autoneg);
-       phylink_set(mask, Pause);
-       phylink_set(mask, Asym_Pause);
-       phylink_set(mask, 10baseT_Half);
-       phylink_set(mask, 10baseT_Full);
-       phylink_set(mask, 100baseT_Half);
-       phylink_set(mask, 100baseT_Full);
-       phylink_set(mask, 100baseT_Half);
-       phylink_set(mask, 1000baseT_Half);
-       phylink_set(mask, 1000baseT_Full);
-
-       if (state->interface == PHY_INTERFACE_MODE_INTERNAL ||
-           state->interface == PHY_INTERFACE_MODE_2500BASEX ||
-           state->interface == PHY_INTERFACE_MODE_USXGMII) {
-               phylink_set(mask, 2500baseT_Full);
-               phylink_set(mask, 2500baseX_Full);
-       }
-
-       linkmode_and(supported, supported, mask);
-       linkmode_and(state->advertising, state->advertising, mask);
-}
-
 static void enetc_pl_mac_config(struct phylink_config *config,
                                unsigned int mode,
                                const struct phylink_link_state *state)
@@ -1086,7 +1057,7 @@ static void enetc_pl_mac_link_down(struct phylink_config *config,
 }
 
 static const struct phylink_mac_ops enetc_mac_phylink_ops = {
-       .validate = enetc_pl_mac_validate,
+       .validate = phylink_generic_validate,
        .mac_config = enetc_pl_mac_config,
        .mac_link_up = enetc_pl_mac_link_up,
        .mac_link_down = enetc_pl_mac_link_down,
@@ -1101,6 +1072,8 @@ static int enetc_phylink_create(struct enetc_ndev_priv *priv,
 
        pf->phylink_config.dev = &priv->ndev->dev;
        pf->phylink_config.type = PHYLINK_NETDEV;
+       pf->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
+               MAC_10 | MAC_100 | MAC_1000 | MAC_2500FD;
 
        __set_bit(PHY_INTERFACE_MODE_INTERNAL,
                  pf->phylink_config.supported_interfaces);