Skip to contentSkip to conversation

net: phy: marvell10g: Clean .get_features by using C45 helpers

PATCH In review Maxime Chevallier 2 participants 4 messages Feb 25, 2019 – Feb 28, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover net: phy: marvell10g: Clean .get_features by using C45 helpers

Recent work on C45 helpers by Heiner made the genphy_c45_pma_read_abilities function generic enough to use as a default .get_featutes implementation.

This series removes the remaining redundant code in mv3310_get_features(), and makes the 2110 PHY use genphy_c45_pma_read_abilities() directly, since it doesn't have the issue with the wrong abilities being reported.

Maxime Chevallier (2):
net: phy: marvell10g: Let genphy_c45_pma_read_abilities set Aneg bit
net: phy: marvell10g: Use the generic C45 helper to read the 2110
features

 drivers/net/phy/marvell10g.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
Signature · 1 line
2.19.2
#1 lore raw

PATCH 1/2 net: phy: marvell10g: Let genphy_c45_pma_read_abilities set Aneg bit

The genphy_c45_pma_read_abilities helper now sets the Autoneg ability in phydev->supported according to what the AN MMD reports.

We therefore don't need to manually do that in mv3310_get_features().

---
 drivers/net/phy/marvell10g.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/net/phy/marvell10g.c +0 -10
index 580e91deadbc..ab71da55c1e0 100644
@@ -268,16 +268,6 @@ static int mv3310_get_features(struct phy_device *phydev)
 {
 	int ret, val;
 
-	if (phydev->c45_ids.devices_in_package & MDIO_DEVS_AN) {
-		val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1);
-		if (val < 0)
-			return val;
-
-		if (val & MDIO_AN_STAT1_ABLE)
-			linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
-					 phydev->supported);
-	}
-
 	ret = genphy_c45_pma_read_abilities(phydev);
 	if (ret)
 		return ret;
Signature · 1 line
2.19.2
#2 lore raw

PATCH 2/2 net: phy: marvell10g: Use the generic C45 helper to read the 2110 features

In reply to Maxime Chevallier

Contrary to the 3310, the 2110 PHY correctly reports it's 2.5G/5G abilities. We can therefore use the genphy_c45_pma_read_abilities helper to build the list of features.

---
 drivers/net/phy/marvell10g.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/marvell10g.c +1 -1
index ab71da55c1e0..79106e70010f 100644
@@ -472,7 +472,7 @@ static struct phy_driver mv3310_drivers[] = {
 		.phy_id		= MARVELL_PHY_ID_88E2110,
 		.phy_id_mask	= MARVELL_PHY_ID_MASK,
 		.name		= "mv88x2110",
-		.features	= PHY_10GBIT_FEATURES,
+		.get_features	= genphy_c45_pma_read_abilities,
 		.probe		= mv3310_probe,
 		.soft_reset	= gen10g_no_soft_reset,
 		.config_init	= mv3310_config_init,
Signature · 1 line
2.19.2
maintainer
#3 lore raw
In reply to Maxime Chevallier

From: Maxime Chevallier <[email protected]>
Date: Mon, 25 Feb 2019 17:14:05 +0100

Quoted 8 lines

Recent work on C45 helpers by Heiner made the genphy_c45_pma_read_abilities function generic enough to use as a default .get_featutes implementation.

This series removes the remaining redundant code in mv3310_get_features(), and makes the 2110 PHY use genphy_c45_pma_read_abilities() directly, since it doesn't have the issue with the wrong abilities being reported.

Series applied, thanks Maxime.