* [PATCH] net: phy: marvell10g: hwmon support for 2110
@ 2020-04-17 6:10 Baruch Siach
2020-04-17 15:48 ` Andrew Lunn
0 siblings, 1 reply; 3+ messages in thread
From: Baruch Siach @ 2020-04-17 6:10 UTC (permalink / raw)
To: Russell King
Cc: netdev, Andrew Lunn, Florian Fainelli, Heiner Kallweit, Baruch Siach
Read the temperature sensor register from the correct location for the
88E2110 PHY. There is no enable/disable bit, so leave
mv3310_hwmon_config() for 88X3310 only.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
This applies on top of "net: phy: marvell10g: disable temperature sensor
on 2110".
---
drivers/net/phy/marvell10g.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index 7c4bc7347d0f..52d697563142 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -64,6 +64,8 @@ enum {
MV_PCS_CSSR1_SPD2_2500 = 0x0004,
MV_PCS_CSSR1_SPD2_10000 = 0x0000,
+ MV_PCS_TEMP = 0x8042,
+
/* These registers appear at 0x800X and 0xa00X - the 0xa00X control
* registers appear to set themselves to the 0x800X when AN is
* restarted, but status registers appear readable from either.
@@ -99,6 +101,14 @@ static umode_t mv3310_hwmon_is_visible(const void *data,
return 0;
}
+static int mv3310_hwmon_read_temp_reg(struct phy_device *phydev)
+{
+ if (phydev->drv->phy_id == MARVELL_PHY_ID_88X3310)
+ return phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_TEMP);
+ else /* MARVELL_PHY_ID_88E2110 */
+ return phy_read_mmd(phydev, MDIO_MMD_PCS, MV_PCS_TEMP);
+}
+
static int mv3310_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *value)
{
@@ -111,7 +121,7 @@ static int mv3310_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
}
if (type == hwmon_temp && attr == hwmon_temp_input) {
- temp = phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_TEMP);
+ temp = mv3310_hwmon_read_temp_reg(phydev);
if (temp < 0)
return temp;
@@ -191,7 +201,8 @@ static int mv3310_hwmon_probe(struct phy_device *phydev)
struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
int i, j, ret;
- if (phydev->drv->phy_id != MARVELL_PHY_ID_88X3310)
+ if (phydev->drv->phy_id != MARVELL_PHY_ID_88X3310 &&
+ phydev->drv->phy_id != MARVELL_PHY_ID_88E2110)
return 0;
priv->hwmon_name = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phy: marvell10g: hwmon support for 2110
2020-04-17 6:10 [PATCH] net: phy: marvell10g: hwmon support for 2110 Baruch Siach
@ 2020-04-17 15:48 ` Andrew Lunn
2020-04-19 6:44 ` Baruch Siach
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2020-04-17 15:48 UTC (permalink / raw)
To: Baruch Siach; +Cc: Russell King, netdev, Florian Fainelli, Heiner Kallweit
On Fri, Apr 17, 2020 at 09:10:52AM +0300, Baruch Siach wrote:
> Read the temperature sensor register from the correct location for the
> 88E2110 PHY. There is no enable/disable bit, so leave
> mv3310_hwmon_config() for 88X3310 only.
Nice. Thanks for doing this.
> @@ -191,7 +201,8 @@ static int mv3310_hwmon_probe(struct phy_device *phydev)
> struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
> int i, j, ret;
>
> - if (phydev->drv->phy_id != MARVELL_PHY_ID_88X3310)
> + if (phydev->drv->phy_id != MARVELL_PHY_ID_88X3310 &&
> + phydev->drv->phy_id != MARVELL_PHY_ID_88E2110)
> return 0;
The indentation looks wrong here?
Thanks
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phy: marvell10g: hwmon support for 2110
2020-04-17 15:48 ` Andrew Lunn
@ 2020-04-19 6:44 ` Baruch Siach
0 siblings, 0 replies; 3+ messages in thread
From: Baruch Siach @ 2020-04-19 6:44 UTC (permalink / raw)
To: Andrew Lunn; +Cc: Russell King, netdev, Florian Fainelli, Heiner Kallweit
Hi Andrew,
On Fri, Apr 17 2020, Andrew Lunn wrote:
> On Fri, Apr 17, 2020 at 09:10:52AM +0300, Baruch Siach wrote:
>> Read the temperature sensor register from the correct location for the
>> 88E2110 PHY. There is no enable/disable bit, so leave
>> mv3310_hwmon_config() for 88X3310 only.
>
> Nice. Thanks for doing this.
>
>> @@ -191,7 +201,8 @@ static int mv3310_hwmon_probe(struct phy_device *phydev)
>> struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
>> int i, j, ret;
>>
>> - if (phydev->drv->phy_id != MARVELL_PHY_ID_88X3310)
>> + if (phydev->drv->phy_id != MARVELL_PHY_ID_88X3310 &&
>> + phydev->drv->phy_id != MARVELL_PHY_ID_88E2110)
>> return 0;
>
> The indentation looks wrong here?
Indeed. Should I respin?
baruch
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-19 6:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17 6:10 [PATCH] net: phy: marvell10g: hwmon support for 2110 Baruch Siach
2020-04-17 15:48 ` Andrew Lunn
2020-04-19 6:44 ` Baruch Siach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).