aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/amd-xgbe-phy.c77
1 files changed, 38 insertions, 39 deletions
diff --git a/drivers/net/phy/amd-xgbe-phy.c b/drivers/net/phy/amd-xgbe-phy.c
index 32efbd48f326..acb444928c76 100644
--- a/drivers/net/phy/amd-xgbe-phy.c
+++ b/drivers/net/phy/amd-xgbe-phy.c
@@ -932,8 +932,8 @@ static enum amd_xgbe_phy_an amd_xgbe_an_incompat_link(struct phy_device *phydev)
932 if (amd_xgbe_phy_in_kr_mode(phydev)) { 932 if (amd_xgbe_phy_in_kr_mode(phydev)) {
933 priv->kr_state = AMD_XGBE_RX_ERROR; 933 priv->kr_state = AMD_XGBE_RX_ERROR;
934 934
935 if (!(phydev->supported & SUPPORTED_1000baseKX_Full) && 935 if (!(phydev->advertising & SUPPORTED_1000baseKX_Full) &&
936 !(phydev->supported & SUPPORTED_2500baseX_Full)) 936 !(phydev->advertising & SUPPORTED_2500baseX_Full))
937 return AMD_XGBE_AN_NO_LINK; 937 return AMD_XGBE_AN_NO_LINK;
938 938
939 if (priv->kx_state != AMD_XGBE_RX_BPA) 939 if (priv->kx_state != AMD_XGBE_RX_BPA)
@@ -941,7 +941,7 @@ static enum amd_xgbe_phy_an amd_xgbe_an_incompat_link(struct phy_device *phydev)
941 } else { 941 } else {
942 priv->kx_state = AMD_XGBE_RX_ERROR; 942 priv->kx_state = AMD_XGBE_RX_ERROR;
943 943
944 if (!(phydev->supported & SUPPORTED_10000baseKR_Full)) 944 if (!(phydev->advertising & SUPPORTED_10000baseKR_Full))
945 return AMD_XGBE_AN_NO_LINK; 945 return AMD_XGBE_AN_NO_LINK;
946 946
947 if (priv->kr_state != AMD_XGBE_RX_BPA) 947 if (priv->kr_state != AMD_XGBE_RX_BPA)
@@ -1101,7 +1101,7 @@ static int amd_xgbe_an_init(struct phy_device *phydev)
1101 if (ret < 0) 1101 if (ret < 0)
1102 return ret; 1102 return ret;
1103 1103
1104 if (phydev->supported & SUPPORTED_10000baseR_FEC) 1104 if (phydev->advertising & SUPPORTED_10000baseR_FEC)
1105 ret |= 0xc000; 1105 ret |= 0xc000;
1106 else 1106 else
1107 ret &= ~0xc000; 1107 ret &= ~0xc000;
@@ -1113,13 +1113,13 @@ static int amd_xgbe_an_init(struct phy_device *phydev)
1113 if (ret < 0) 1113 if (ret < 0)
1114 return ret; 1114 return ret;
1115 1115
1116 if (phydev->supported & SUPPORTED_10000baseKR_Full) 1116 if (phydev->advertising & SUPPORTED_10000baseKR_Full)
1117 ret |= 0x80; 1117 ret |= 0x80;
1118 else 1118 else
1119 ret &= ~0x80; 1119 ret &= ~0x80;
1120 1120
1121 if ((phydev->supported & SUPPORTED_1000baseKX_Full) || 1121 if ((phydev->advertising & SUPPORTED_1000baseKX_Full) ||
1122 (phydev->supported & SUPPORTED_2500baseX_Full)) 1122 (phydev->advertising & SUPPORTED_2500baseX_Full))
1123 ret |= 0x20; 1123 ret |= 0x20;
1124 else 1124 else
1125 ret &= ~0x20; 1125 ret &= ~0x20;
@@ -1131,12 +1131,12 @@ static int amd_xgbe_an_init(struct phy_device *phydev)
1131 if (ret < 0) 1131 if (ret < 0)
1132 return ret; 1132 return ret;
1133 1133
1134 if (phydev->supported & SUPPORTED_Pause) 1134 if (phydev->advertising & SUPPORTED_Pause)
1135 ret |= 0x400; 1135 ret |= 0x400;
1136 else 1136 else
1137 ret &= ~0x400; 1137 ret &= ~0x400;
1138 1138
1139 if (phydev->supported & SUPPORTED_Asym_Pause) 1139 if (phydev->advertising & SUPPORTED_Asym_Pause)
1140 ret |= 0x800; 1140 ret |= 0x800;
1141 else 1141 else
1142 ret &= ~0x800; 1142 ret &= ~0x800;
@@ -1212,38 +1212,14 @@ static int amd_xgbe_phy_config_init(struct phy_device *phydev)
1212 priv->an_irq_allocated = 1; 1212 priv->an_irq_allocated = 1;
1213 } 1213 }
1214 1214
1215 ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_FEC_ABILITY);
1216 if (ret < 0)
1217 return ret;
1218 priv->fec_ability = ret & XGBE_PHY_FEC_MASK;
1219
1220 /* Initialize supported features */
1221 phydev->supported = SUPPORTED_Autoneg;
1222 phydev->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
1223 phydev->supported |= SUPPORTED_Backplane;
1224 phydev->supported |= SUPPORTED_10000baseKR_Full;
1225 switch (priv->speed_set) {
1226 case AMD_XGBE_PHY_SPEEDSET_1000_10000:
1227 phydev->supported |= SUPPORTED_1000baseKX_Full;
1228 break;
1229 case AMD_XGBE_PHY_SPEEDSET_2500_10000:
1230 phydev->supported |= SUPPORTED_2500baseX_Full;
1231 break;
1232 }
1233
1234 if (priv->fec_ability & XGBE_PHY_FEC_ENABLE)
1235 phydev->supported |= SUPPORTED_10000baseR_FEC;
1236
1237 phydev->advertising = phydev->supported;
1238
1239 /* Set initial mode - call the mode setting routines 1215 /* Set initial mode - call the mode setting routines
1240 * directly to insure we are properly configured 1216 * directly to insure we are properly configured
1241 */ 1217 */
1242 if (phydev->supported & SUPPORTED_10000baseKR_Full) 1218 if (phydev->advertising & SUPPORTED_10000baseKR_Full)
1243 ret = amd_xgbe_phy_xgmii_mode(phydev); 1219 ret = amd_xgbe_phy_xgmii_mode(phydev);
1244 else if (phydev->supported & SUPPORTED_1000baseKX_Full) 1220 else if (phydev->advertising & SUPPORTED_1000baseKX_Full)
1245 ret = amd_xgbe_phy_gmii_mode(phydev); 1221 ret = amd_xgbe_phy_gmii_mode(phydev);
1246 else if (phydev->supported & SUPPORTED_2500baseX_Full) 1222 else if (phydev->advertising & SUPPORTED_2500baseX_Full)
1247 ret = amd_xgbe_phy_gmii_2500_mode(phydev); 1223 ret = amd_xgbe_phy_gmii_2500_mode(phydev);
1248 else 1224 else
1249 ret = -EINVAL; 1225 ret = -EINVAL;
@@ -1315,10 +1291,10 @@ static int __amd_xgbe_phy_config_aneg(struct phy_device *phydev)
1315 disable_irq(priv->an_irq); 1291 disable_irq(priv->an_irq);
1316 1292
1317 /* Start auto-negotiation in a supported mode */ 1293 /* Start auto-negotiation in a supported mode */
1318 if (phydev->supported & SUPPORTED_10000baseKR_Full) 1294 if (phydev->advertising & SUPPORTED_10000baseKR_Full)
1319 ret = amd_xgbe_phy_set_mode(phydev, AMD_XGBE_MODE_KR); 1295 ret = amd_xgbe_phy_set_mode(phydev, AMD_XGBE_MODE_KR);
1320 else if ((phydev->supported & SUPPORTED_1000baseKX_Full) || 1296 else if ((phydev->advertising & SUPPORTED_1000baseKX_Full) ||
1321 (phydev->supported & SUPPORTED_2500baseX_Full)) 1297 (phydev->advertising & SUPPORTED_2500baseX_Full))
1322 ret = amd_xgbe_phy_set_mode(phydev, AMD_XGBE_MODE_KX); 1298 ret = amd_xgbe_phy_set_mode(phydev, AMD_XGBE_MODE_KX);
1323 else 1299 else
1324 ret = -EINVAL; 1300 ret = -EINVAL;
@@ -1746,6 +1722,29 @@ static int amd_xgbe_phy_probe(struct phy_device *phydev)
1746 sizeof(priv->serdes_dfe_tap_ena)); 1722 sizeof(priv->serdes_dfe_tap_ena));
1747 } 1723 }
1748 1724
1725 /* Initialize supported features */
1726 phydev->supported = SUPPORTED_Autoneg;
1727 phydev->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
1728 phydev->supported |= SUPPORTED_Backplane;
1729 phydev->supported |= SUPPORTED_10000baseKR_Full;
1730 switch (priv->speed_set) {
1731 case AMD_XGBE_PHY_SPEEDSET_1000_10000:
1732 phydev->supported |= SUPPORTED_1000baseKX_Full;
1733 break;
1734 case AMD_XGBE_PHY_SPEEDSET_2500_10000:
1735 phydev->supported |= SUPPORTED_2500baseX_Full;
1736 break;
1737 }
1738
1739 ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_FEC_ABILITY);
1740 if (ret < 0)
1741 return ret;
1742 priv->fec_ability = ret & XGBE_PHY_FEC_MASK;
1743 if (priv->fec_ability & XGBE_PHY_FEC_ENABLE)
1744 phydev->supported |= SUPPORTED_10000baseR_FEC;
1745
1746 phydev->advertising = phydev->supported;
1747
1749 phydev->priv = priv; 1748 phydev->priv = priv;
1750 1749
1751 if (!priv->adev || acpi_disabled) 1750 if (!priv->adev || acpi_disabled)