diff options
author | David Bauer <mail@david-bauer.net> | 2021-06-02 19:34:01 +0200 |
---|---|---|
committer | David Bauer <mail@david-bauer.net> | 2021-10-12 11:38:20 +0200 |
commit | e7c5e08db09a0034a1dc5f013af651339743fd40 (patch) | |
tree | 017c3b7a3ba85d0741d754ff0b1fb2a72bdca9d4 /target/linux | |
parent | 9b258f220f1223dc578e1cfe3ff026fb98b9edd2 (diff) | |
download | upstream-e7c5e08db09a0034a1dc5f013af651339743fd40.tar.gz upstream-e7c5e08db09a0034a1dc5f013af651339743fd40.tar.bz2 upstream-e7c5e08db09a0034a1dc5f013af651339743fd40.zip |
kernel: ar8216: add get_features method
Modifying PHY capabilities in the probe function broke with upstream
commit 92ed2eb7f4b7 ("net: phy: probe the PHY before determining the
supported features").
AR8316 switches only support 10/100 Mbit/s link modes because of this
change.
Provide a get_features method for the PHY driver, so Gigabit link mode
will be advertised to link partners again.
Signed-off-by: David Bauer <mail@david-bauer.net>
(cherry picked from commit 766e0f584a325b0b80a97bbc86ca515d97c63001)
Diffstat (limited to 'target/linux')
-rw-r--r-- | target/linux/generic/files/drivers/net/phy/ar8216.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 0b0348bfdf..556c3c86f3 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -2538,6 +2538,18 @@ ar8xxx_phy_config_aneg(struct phy_device *phydev) return genphy_config_aneg(phydev); } +static int +ar8xxx_get_features(struct phy_device *phydev) +{ + struct ar8xxx_priv *priv = phydev->priv; + + linkmode_copy(phydev->supported, PHY_BASIC_FEATURES); + if (ar8xxx_has_gige(priv)) + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, phydev->supported); + + return 0; +} + static const u32 ar8xxx_phy_ids[] = { 0x004dd033, 0x004dd034, /* AR8327 */ @@ -2635,29 +2647,14 @@ ar8xxx_phy_probe(struct phy_device *phydev) found: priv->use_count++; - if (phydev->mdio.addr == 0) { - linkmode_zero(phydev->supported); - if (ar8xxx_has_gige(priv)) - linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, phydev->supported); - else - linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, phydev->supported); - linkmode_copy(phydev->advertising, phydev->supported); + if (phydev->mdio.addr == 0 && priv->chip->config_at_probe) { + priv->phy = phydev; - if (priv->chip->config_at_probe) { - priv->phy = phydev; - - ret = ar8xxx_start(priv); - if (ret) - goto err_unregister_switch; - } - } else { - if (ar8xxx_has_gige(priv)) { - linkmode_zero(phydev->supported); - linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, phydev->supported); - linkmode_copy(phydev->advertising, phydev->supported); - } - if (priv->chip->phy_rgmii_set) - priv->chip->phy_rgmii_set(priv, phydev); + ret = ar8xxx_start(priv); + if (ret) + goto err_unregister_switch; + } else if (priv->chip->phy_rgmii_set) { + priv->chip->phy_rgmii_set(priv, phydev); } phydev->priv = priv; @@ -2730,7 +2727,6 @@ static struct phy_driver ar8xxx_phy_driver[] = { .phy_id = 0x004d0000, .name = "Atheros AR8216/AR8236/AR8316", .phy_id_mask = 0xffff0000, - .features = PHY_BASIC_FEATURES, .probe = ar8xxx_phy_probe, .remove = ar8xxx_phy_remove, .detach = ar8xxx_phy_detach, @@ -2738,6 +2734,7 @@ static struct phy_driver ar8xxx_phy_driver[] = { .config_aneg = ar8xxx_phy_config_aneg, .read_status = ar8xxx_phy_read_status, .soft_reset = ar8xxx_phy_soft_reset, + .get_features = ar8xxx_get_features, } }; |