summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Tenart <antoine.tenart@bootlin.com>2019-04-16 06:10:20 -0400
committerDavid S. Miller <davem@davemloft.net>2019-04-17 00:36:40 -0400
commit3aed3e2a143c9619f4c8d0a3b8fe74d7d3d79c93 (patch)
tree1975307d7f0fff4e866c590c9c64c9eb6531f9b6
parent9c03e2270813173b3690938dfe074a921c11855b (diff)
net: phy: micrel: add Asym Pause workaround
The Micrel KSZ9031 PHY may fail to establish a link when the Asymmetric Pause capability is set. This issue is described in a Silicon Errata (DS80000691D or DS80000692D), which advises to always disable the capability. This patch implements the workaround by defining a KSZ9031 specific get_feature callback to force the Asymmetric Pause capability bit to be cleared. This fixes issues where the link would not come up at boot time, or when the Asym Pause bit was set later on. Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/phy/micrel.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index d6807b5bcd97..ddd6b6374d8c 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -738,6 +738,31 @@ static int ksz8873mll_read_status(struct phy_device *phydev)
738 return 0; 738 return 0;
739} 739}
740 740
741static int ksz9031_get_features(struct phy_device *phydev)
742{
743 int ret;
744
745 ret = genphy_read_abilities(phydev);
746 if (ret < 0)
747 return ret;
748
749 /* Silicon Errata Sheet (DS80000691D or DS80000692D):
750 * Whenever the device's Asymmetric Pause capability is set to 1,
751 * link-up may fail after a link-up to link-down transition.
752 *
753 * Workaround:
754 * Do not enable the Asymmetric Pause capability bit.
755 */
756 linkmode_clear_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydev->supported);
757
758 /* We force setting the Pause capability as the core will force the
759 * Asymmetric Pause capability to 1 otherwise.
760 */
761 linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev->supported);
762
763 return 0;
764}
765
741static int ksz9031_read_status(struct phy_device *phydev) 766static int ksz9031_read_status(struct phy_device *phydev)
742{ 767{
743 int err; 768 int err;
@@ -1052,9 +1077,9 @@ static struct phy_driver ksphy_driver[] = {
1052 .phy_id = PHY_ID_KSZ9031, 1077 .phy_id = PHY_ID_KSZ9031,
1053 .phy_id_mask = MICREL_PHY_ID_MASK, 1078 .phy_id_mask = MICREL_PHY_ID_MASK,
1054 .name = "Micrel KSZ9031 Gigabit PHY", 1079 .name = "Micrel KSZ9031 Gigabit PHY",
1055 /* PHY_GBIT_FEATURES */
1056 .driver_data = &ksz9021_type, 1080 .driver_data = &ksz9021_type,
1057 .probe = kszphy_probe, 1081 .probe = kszphy_probe,
1082 .get_features = ksz9031_get_features,
1058 .config_init = ksz9031_config_init, 1083 .config_init = ksz9031_config_init,
1059 .soft_reset = genphy_soft_reset, 1084 .soft_reset = genphy_soft_reset,
1060 .read_status = ksz9031_read_status, 1085 .read_status = ksz9031_read_status,