aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>2014-08-26 03:26:52 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-27 19:29:39 -0400
commit7a4cecf74c165653b2d01301b301a8659438217e (patch)
tree26b0aa3fd7c4b63a98fcf830bcfba5a49c7ac20a /drivers
parent2d39d120781a5770573dc6ed672a5a562f541aea (diff)
phy: fix EEE checks inside the phy_init_eee.
According to the Std 802.3az if the EEE Adv (Reg 7.60), Link partner ability (Reg 7.61) and EEE capability (Register 3.20) bits return 0 this means no EEE is supported. So this patch fixes the checks inside the phy_init_eee function. Signed-off-by: Nandini Sharma <nandini.sharma@st.com> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/phy/phy.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index c94e2a27446a..a854d38c231d 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1036,31 +1036,31 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
1036 /* First check if the EEE ability is supported */ 1036 /* First check if the EEE ability is supported */
1037 eee_cap = phy_read_mmd_indirect(phydev, MDIO_PCS_EEE_ABLE, 1037 eee_cap = phy_read_mmd_indirect(phydev, MDIO_PCS_EEE_ABLE,
1038 MDIO_MMD_PCS, phydev->addr); 1038 MDIO_MMD_PCS, phydev->addr);
1039 if (eee_cap < 0) 1039 if (eee_cap <= 0)
1040 return eee_cap; 1040 goto eee_exit_err;
1041 1041
1042 cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap); 1042 cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap);
1043 if (!cap) 1043 if (!cap)
1044 return -EPROTONOSUPPORT; 1044 goto eee_exit_err;
1045 1045
1046 /* Check which link settings negotiated and verify it in 1046 /* Check which link settings negotiated and verify it in
1047 * the EEE advertising registers. 1047 * the EEE advertising registers.
1048 */ 1048 */
1049 eee_lp = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_LPABLE, 1049 eee_lp = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_LPABLE,
1050 MDIO_MMD_AN, phydev->addr); 1050 MDIO_MMD_AN, phydev->addr);
1051 if (eee_lp < 0) 1051 if (eee_lp <= 0)
1052 return eee_lp; 1052 goto eee_exit_err;
1053 1053
1054 eee_adv = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_ADV, 1054 eee_adv = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_ADV,
1055 MDIO_MMD_AN, phydev->addr); 1055 MDIO_MMD_AN, phydev->addr);
1056 if (eee_adv < 0) 1056 if (eee_adv <= 0)
1057 return eee_adv; 1057 goto eee_exit_err;
1058 1058
1059 adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); 1059 adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv);
1060 lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); 1060 lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp);
1061 idx = phy_find_setting(phydev->speed, phydev->duplex); 1061 idx = phy_find_setting(phydev->speed, phydev->duplex);
1062 if (!(lp & adv & settings[idx].setting)) 1062 if (!(lp & adv & settings[idx].setting))
1063 return -EPROTONOSUPPORT; 1063 goto eee_exit_err;
1064 1064
1065 if (clk_stop_enable) { 1065 if (clk_stop_enable) {
1066 /* Configure the PHY to stop receiving xMII 1066 /* Configure the PHY to stop receiving xMII
@@ -1080,7 +1080,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
1080 1080
1081 return 0; /* EEE supported */ 1081 return 0; /* EEE supported */
1082 } 1082 }
1083 1083eee_exit_err:
1084 return -EPROTONOSUPPORT; 1084 return -EPROTONOSUPPORT;
1085} 1085}
1086EXPORT_SYMBOL(phy_init_eee); 1086EXPORT_SYMBOL(phy_init_eee);