@@ -513,7 +513,10 @@ static int mv88q2xxx_config_init(struct phy_device *phydev)
return ret;
}
- /* Enable temperature sense */
+ /* Enable temperature sensor again. There might have been a hard reset
+ * of the PHY and in this case the register content is restored to
+ * defaults and we need to enable it again.
+ */
if (priv->enable_temp) {
ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
MDIO_MMD_PCS_MV_TEMP_SENSOR2,
@@ -766,6 +769,13 @@ static int mv88q2xxx_hwmon_probe(struct phy_device *phydev)
struct device *dev = &phydev->mdio.dev;
struct device *hwmon;
char *hwmon_name;
+ int ret;
+
+ /* Enable temperature sense */
+ ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, MDIO_MMD_PCS_MV_TEMP_SENSOR2,
+ MDIO_MMD_PCS_MV_TEMP_SENSOR2_DIS_MASK, 0);
+ if (ret < 0)
+ return ret;
priv->enable_temp = true;
hwmon_name = devm_hwmon_sanitize_name(dev, dev_name(dev));
Enabling of the temperature sensor was moved from mv88q2xxx_hwmon_probe to mv88q222x_config_init with the consequence that the sensor is only usable when the PHY is configured. Enable the sensor in mv88q2xxx_hwmon_probe as well to fix this. Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com> --- drivers/net/phy/marvell-88q2xxx.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)