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 766e0f584a)
			
			
This commit is contained in:
		| @@ -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, | ||||
| 	} | ||||
| }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 David Bauer
					David Bauer