]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: phy: marvell-88q2xxx: Enable temperature sensor for mv88q211x
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Fri, 18 Apr 2025 14:58:00 +0000 (16:58 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 24 Apr 2025 11:19:51 +0000 (13:19 +0200)
The temperature sensor enabled for mv88q222x devices also functions for
mv88q211x based devices. Unify the two devices probe functions to enable
the sensors for all devices supported by this driver.

The same oddity as for mv88q222x devices exists, the PHY link must be up
for a correct temperature reading to be reported.

    # cat /sys/class/hwmon/hwmon9/temp1_input
    -75000

    # ifconfig end5 up

    # cat /sys/class/hwmon/hwmon9/temp1_input
    59000

Worth noting is that while the temperature register offsets and layout
are the same between mv88q211x and mv88q222x devices their names in the
datasheets are different. This change keeps the mv88q222x names for the
mv88q211x support.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Dimitri Fedrau <dima.fedrau@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20250418145800.2420751-1-niklas.soderlund+renesas@ragnatech.se
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/phy/marvell-88q2xxx.c

index 23e1f0521f54985b226f3918bf724d97b8240279..5c687164b8e068f3f09e91cd4dd198f24782682e 100644 (file)
@@ -828,6 +828,7 @@ static int mv88q2xxx_leds_probe(struct phy_device *phydev)
 static int mv88q2xxx_probe(struct phy_device *phydev)
 {
        struct mv88q2xxx_priv *priv;
+       int ret;
 
        priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL);
        if (!priv)
@@ -835,17 +836,6 @@ static int mv88q2xxx_probe(struct phy_device *phydev)
 
        phydev->priv = priv;
 
-       return 0;
-}
-
-static int mv88q222x_probe(struct phy_device *phydev)
-{
-       int ret;
-
-       ret = mv88q2xxx_probe(phydev);
-       if (ret)
-               return ret;
-
        ret = mv88q2xxx_leds_probe(phydev);
        if (ret)
                return ret;
@@ -1118,7 +1108,7 @@ static struct phy_driver mv88q2xxx_driver[] = {
                .phy_id_mask            = MARVELL_PHY_ID_MASK,
                .name                   = "mv88q2220",
                .flags                  = PHY_POLL_CABLE_TEST,
-               .probe                  = mv88q222x_probe,
+               .probe                  = mv88q2xxx_probe,
                .get_features           = mv88q2xxx_get_features,
                .config_aneg            = mv88q2xxx_config_aneg,
                .aneg_done              = genphy_c45_aneg_done,