Re: [PATCH 1/2] net: phy: marvell-88q2xxx: Enable temperature measurement in probe again
From: Stefan Eichenberger
Date: Wed Feb 19 2025 - 01:17:13 EST
Hi Dimitri,
On Tue, Feb 18, 2025 at 07:33:09PM +0100, Dimitri Fedrau wrote:
> 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.
>
> Fixes: a197004cf3c2 ("net: phy: marvell-88q2xxx: Fix temperature measurement with reset-gpios")
> Signed-off-by: Dimitri Fedrau <dima.fedrau@xxxxxxxxx>
> ---
> drivers/net/phy/marvell-88q2xxx.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c
> index a3996471a1c9a5d4060d5d19ce44aa70e902a83f..30d71bfc365597d77c34c48f05390db9d63c4af4 100644
> --- a/drivers/net/phy/marvell-88q2xxx.c
> +++ b/drivers/net/phy/marvell-88q2xxx.c
> @@ -718,6 +718,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));
Is it necessary to have it enabled in probe and in config? Is that
because of the soft reset? Can it happen that the phy is reset but
config is not called, then we would end up in the same situation right?
Regards,
Stefan