Message ID | 20250218-marvell-88q2xxx-hwmon-enable-at-probe-v1-2-999a304c8a11@gmail.com (mailing list archive) |
---|---|
State | New |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: phy: marvell-88q2xxx: Enable temperature measurement in probe again | expand |
diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index 30d71bfc365597d77c34c48f05390db9d63c4af4..c1ae27057ee34feacb31c2e3c40b2b1769596408 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -647,6 +647,12 @@ static int mv88q2xxx_hwmon_read(struct device *dev, struct phy_device *phydev = dev_get_drvdata(dev); int ret; + /* If the PHYs reset is asserted it returns 0xffff for any read + * operation. Return with an I/O error in this case. + */ + if (phydev->mdio.reset_state == 1) + return -EIO; + switch (attr) { case hwmon_temp_input: ret = phy_read_mmd(phydev, MDIO_MMD_PCS,
If the PHYs reset is asserted it returns 0xffff for any read operation. Prevent reading the temperature in this case and return with an I/O error. Write operations are ignored by the device. Fixes: a197004cf3c2 ("net: phy: marvell-88q2xxx: Fix temperature measurement with reset-gpios") Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com> --- drivers/net/phy/marvell-88q2xxx.c | 6 ++++++ 1 file changed, 6 insertions(+)