Thread (4 messages) flat view 4 messages, 2 authors, 2021-11-17
DORMANTno replies

[PATCH RFC net-next 3/3] net: ag71xx: convert to phylink_get_linkmodes()

From: Russell King (Oracle) <hidden>
Date: 2021-11-17 15:29:37
Subsystem: atlx ethernet drivers, networking drivers, the rest · Maintainers: Chris Snook, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

ag71xx only supports MII port type, so can't use the generic phylink
validation callback. Update to use phylink_get_linkmodes() instead.

Signed-off-by: Russell King (Oracle) <redacted>
---
This implementation seems wrong. If it only supports the MII port type,
then it doesn't support fibre or twisted pair - yet it can as a PHY can
be connected. If this can be fixed, we can convert it to use
phylink_generic_validate() and get rid of ag71xx_mac_validate()
entirely.

 drivers/net/ethernet/atheros/ag71xx.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
index 20c2cfdc30da..2d2725b2a6ae 100644
--- a/drivers/net/ethernet/atheros/ag71xx.c
+++ b/drivers/net/ethernet/atheros/ag71xx.c
@@ -1032,20 +1032,8 @@ static void ag71xx_mac_validate(struct phylink_config *config,
 
 	phylink_set(mask, MII);
 
-	phylink_set(mask, Pause);
-	phylink_set(mask, Asym_Pause);
 	phylink_set(mask, Autoneg);
-	phylink_set(mask, 10baseT_Half);
-	phylink_set(mask, 10baseT_Full);
-	phylink_set(mask, 100baseT_Half);
-	phylink_set(mask, 100baseT_Full);
-
-	if (state->interface == PHY_INTERFACE_MODE_SGMII ||
-	    state->interface == PHY_INTERFACE_MODE_RGMII ||
-	    state->interface == PHY_INTERFACE_MODE_GMII) {
-		phylink_set(mask, 1000baseT_Full);
-		phylink_set(mask, 1000baseX_Full);
-	}
+	phylink_get_linkmodes(mask, state->interface, config->mac_capabilities);
 
 	linkmode_and(supported, supported, mask);
 	linkmode_and(state->advertising, state->advertising, mask);
@@ -1138,6 +1126,8 @@ static int ag71xx_phylink_setup(struct ag71xx *ag)
 
 	ag->phylink_config.dev = &ag->ndev->dev;
 	ag->phylink_config.type = PHYLINK_NETDEV;
+	ag->phylink_config.mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE |
+		MAC_10 | MAC_100 | MAC_1000FD;
 
 	if ((ag71xx_is(ag, AR9330) && ag->mac_idx == 0) ||
 	    ag71xx_is(ag, AR9340) ||
-- 
2.30.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help