Skip to content

Commit f058b2d

Browse files
robimarkodavem330
authored andcommitted
net: phy: qcom: qca808x: add helper for checking for 1G only model
There are 2 versions of QCA808x, one 2.5G capable and one 1G capable. Currently, this matter only in the .get_features call however, it will be required for filling supported interface modes so lets add a helper that can be reused. Signed-off-by: Robert Marko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f29f919 commit f058b2d

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

drivers/net/phy/qcom/qca808x.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,17 @@ static bool qca808x_has_fast_retrain_or_slave_seed(struct phy_device *phydev)
156156
return linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported);
157157
}
158158

159+
static bool qca808x_is_1g_only(struct phy_device *phydev)
160+
{
161+
int ret;
162+
163+
ret = phy_read_mmd(phydev, MDIO_MMD_AN, QCA808X_PHY_MMD7_CHIP_TYPE);
164+
if (ret < 0)
165+
return true;
166+
167+
return !!(QCA808X_PHY_CHIP_TYPE_1G & ret);
168+
}
169+
159170
static int qca808x_probe(struct phy_device *phydev)
160171
{
161172
struct device *dev = &phydev->mdio.dev;
@@ -350,11 +361,7 @@ static int qca808x_get_features(struct phy_device *phydev)
350361
* existed in the bit0 of MMD1.21, we need to remove it manually if
351362
* it is the qca8081 1G chip according to the bit0 of MMD7.0x901d.
352363
*/
353-
ret = phy_read_mmd(phydev, MDIO_MMD_AN, QCA808X_PHY_MMD7_CHIP_TYPE);
354-
if (ret < 0)
355-
return ret;
356-
357-
if (QCA808X_PHY_CHIP_TYPE_1G & ret)
364+
if (qca808x_is_1g_only(phydev))
358365
linkmode_clear_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported);
359366

360367
return 0;

0 commit comments

Comments
 (0)