From: Russell King (Oracle) Date: Thu, 24 Aug 2023 13:38:19 +0000 (+0100) Subject: net: stmmac: provide stmmac_mac_phylink_get_caps() X-Git-Tag: v6.6.7~2079^2~20^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d42ca04e044891c9cf2e5a8dbcef85dd57f94827;p=platform%2Fkernel%2Flinux-starfive.git net: stmmac: provide stmmac_mac_phylink_get_caps() Allow MACs to provide their own capabilities via the MAC operations struct. Signed-off-by: Russell King (Oracle) Link: https://lore.kernel.org/r/E1qZAXT-005pUD-Aj@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index 238f17c..b95d3e1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -300,6 +300,8 @@ struct stmmac_est; struct stmmac_ops { /* MAC core initialization */ void (*core_init)(struct mac_device_info *hw, struct net_device *dev); + /* Get phylink capabilities */ + void (*phylink_get_caps)(struct stmmac_priv *priv); /* Enable the MAC RX/TX */ void (*set_mac)(void __iomem *ioaddr, bool enable); /* Enable and verify that the IPC module is supported */ @@ -419,6 +421,8 @@ struct stmmac_ops { #define stmmac_core_init(__priv, __args...) \ stmmac_do_void_callback(__priv, mac, core_init, __args) +#define stmmac_mac_phylink_get_caps(__priv) \ + stmmac_do_void_callback(__priv, mac, phylink_get_caps, __priv) #define stmmac_mac_set(__priv, __args...) \ stmmac_do_void_callback(__priv, mac, set_mac, __args) #define stmmac_rx_ipc(__priv, __args...) \ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 30a085f..a9cf6ae 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1224,6 +1224,9 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) priv->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000; + /* Get the MAC specific capabilities */ + stmmac_mac_phylink_get_caps(priv); + if (priv->plat->has_gmac4) { priv->phylink_config.mac_capabilities |= MAC_2500FD; } else if (priv->plat->has_xgmac) {