]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: stmmac: Limit max speeds of XGMAC if asked to
authorJose Abreu <Jose.Abreu@synopsys.com>
Fri, 6 Sep 2019 07:41:17 +0000 (09:41 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 7 Sep 2019 15:57:41 +0000 (17:57 +0200)
We may have some SoCs that can't achieve XGMAC max speed. Limit it if
asked to.

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index c3baca9f587bda6b25c66a2b81ba603c62d17ba4..686b820681422bed8d986557d3124c2bcd76780a 100644 (file)
@@ -831,15 +831,22 @@ static void stmmac_validate(struct phylink_config *config,
                phylink_set(mask, 1000baseT_Full);
                phylink_set(mask, 1000baseX_Full);
        } else if (priv->plat->has_xgmac) {
-               phylink_set(mac_supported, 2500baseT_Full);
-               phylink_set(mac_supported, 5000baseT_Full);
-               phylink_set(mac_supported, 10000baseSR_Full);
-               phylink_set(mac_supported, 10000baseLR_Full);
-               phylink_set(mac_supported, 10000baseER_Full);
-               phylink_set(mac_supported, 10000baseLRM_Full);
-               phylink_set(mac_supported, 10000baseT_Full);
-               phylink_set(mac_supported, 10000baseKX4_Full);
-               phylink_set(mac_supported, 10000baseKR_Full);
+               if (!max_speed || (max_speed >= 2500)) {
+                       phylink_set(mac_supported, 2500baseT_Full);
+                       phylink_set(mac_supported, 2500baseX_Full);
+               }
+               if (!max_speed || (max_speed >= 5000)) {
+                       phylink_set(mac_supported, 5000baseT_Full);
+               }
+               if (!max_speed || (max_speed >= 10000)) {
+                       phylink_set(mac_supported, 10000baseSR_Full);
+                       phylink_set(mac_supported, 10000baseLR_Full);
+                       phylink_set(mac_supported, 10000baseER_Full);
+                       phylink_set(mac_supported, 10000baseLRM_Full);
+                       phylink_set(mac_supported, 10000baseT_Full);
+                       phylink_set(mac_supported, 10000baseKX4_Full);
+                       phylink_set(mac_supported, 10000baseKR_Full);
+               }
        }
 
        /* Half-Duplex can only work with single queue */