summaryrefslogtreecommitdiffstats
path: root/target/linux/generic
diff options
context:
space:
mode:
authorDavid Bauer <mail@david-bauer.net>2021-06-02 19:34:01 +0200
committerDavid Bauer <mail@david-bauer.net>2021-06-03 00:00:46 +0200
commit766e0f584a325b0b80a97bbc86ca515d97c63001 (patch)
tree0aadc9e672b4b8a570fe0d8b4d61ad3998e9edf4 /target/linux/generic
parent29c94fe28ec6ec2f2cbd08e5af9a1b665587b3fe (diff)
downloadopenwrt-766e0f584a325b0b80a97bbc86ca515d97c63001.tar.gz
openwrt-766e0f584a325b0b80a97bbc86ca515d97c63001.tar.bz2
openwrt-766e0f584a325b0b80a97bbc86ca515d97c63001.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>
Diffstat (limited to 'target/linux/generic')
-rw-r--r--target/linux/generic/files/drivers/net/phy/ar8216.c43
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 ef0fc54949..dbcb1c41c4 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c
@@ -2552,6 +2552,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 */
@@ -2649,29 +2661,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;
@@ -2746,7 +2743,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,
@@ -2754,6 +2750,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,
}
};