aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy_device.c
diff options
context:
space:
mode:
authorCristian Bercaru <cristian.bercaru@freescale.com>2014-02-25 03:22:48 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-25 18:39:09 -0500
commita4572e0c23266d01949a1c134475e3bfa7f788e1 (patch)
tree70b19b089b0c17e765544cf28bce98e4c913263b /drivers/net/phy/phy_device.c
parent46833a86f7ab30101096d81117dd250bfae74c6f (diff)
phy: unmask link partner capabilities
Masking the link partner's capabilities with local capabilities can be misleading in autonegotiation scenarios such as PAUSE frame autonegotiation. This patch calculates the join between the local capabilities and the link parner capabilities, when it determines the speed and duplex settings, but does not mask any of the link partner capabilities when it calculates PAUSE frame settings. Signed-off-by: Cristian Bercaru <cristian.bercaru@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r--drivers/net/phy/phy_device.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 82514e72b3d8..4b970f7624c0 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -916,6 +916,8 @@ int genphy_read_status(struct phy_device *phydev)
916 int err; 916 int err;
917 int lpa; 917 int lpa;
918 int lpagb = 0; 918 int lpagb = 0;
919 int common_adv;
920 int common_adv_gb = 0;
919 921
920 /* Update the link, but return if there was an error */ 922 /* Update the link, but return if there was an error */
921 err = genphy_update_link(phydev); 923 err = genphy_update_link(phydev);
@@ -937,7 +939,7 @@ int genphy_read_status(struct phy_device *phydev)
937 939
938 phydev->lp_advertising = 940 phydev->lp_advertising =
939 mii_stat1000_to_ethtool_lpa_t(lpagb); 941 mii_stat1000_to_ethtool_lpa_t(lpagb);
940 lpagb &= adv << 2; 942 common_adv_gb = lpagb & adv << 2;
941 } 943 }
942 944
943 lpa = phy_read(phydev, MII_LPA); 945 lpa = phy_read(phydev, MII_LPA);
@@ -950,25 +952,25 @@ int genphy_read_status(struct phy_device *phydev)
950 if (adv < 0) 952 if (adv < 0)
951 return adv; 953 return adv;
952 954
953 lpa &= adv; 955 common_adv = lpa & adv;
954 956
955 phydev->speed = SPEED_10; 957 phydev->speed = SPEED_10;
956 phydev->duplex = DUPLEX_HALF; 958 phydev->duplex = DUPLEX_HALF;
957 phydev->pause = 0; 959 phydev->pause = 0;
958 phydev->asym_pause = 0; 960 phydev->asym_pause = 0;
959 961
960 if (lpagb & (LPA_1000FULL | LPA_1000HALF)) { 962 if (common_adv_gb & (LPA_1000FULL | LPA_1000HALF)) {
961 phydev->speed = SPEED_1000; 963 phydev->speed = SPEED_1000;
962 964
963 if (lpagb & LPA_1000FULL) 965 if (common_adv_gb & LPA_1000FULL)
964 phydev->duplex = DUPLEX_FULL; 966 phydev->duplex = DUPLEX_FULL;
965 } else if (lpa & (LPA_100FULL | LPA_100HALF)) { 967 } else if (common_adv & (LPA_100FULL | LPA_100HALF)) {
966 phydev->speed = SPEED_100; 968 phydev->speed = SPEED_100;
967 969
968 if (lpa & LPA_100FULL) 970 if (common_adv & LPA_100FULL)
969 phydev->duplex = DUPLEX_FULL; 971 phydev->duplex = DUPLEX_FULL;
970 } else 972 } else
971 if (lpa & LPA_10FULL) 973 if (common_adv & LPA_10FULL)
972 phydev->duplex = DUPLEX_FULL; 974 phydev->duplex = DUPLEX_FULL;
973 975
974 if (phydev->duplex == DUPLEX_FULL) { 976 if (phydev->duplex == DUPLEX_FULL) {