Linux Renesas SOC kernel development
 help / color / mirror / Atom feed
* [net-next,v2] net: phy: marvell-88q2xxx: Enable temperature sensor for mv88q211x
@ 2025-04-18 14:58 Niklas Söderlund
  2025-04-18 15:50 ` Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Niklas Söderlund @ 2025-04-18 14:58 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Dimitri Fedrau, netdev
  Cc: linux-renesas-soc, Niklas Söderlund

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>
---
* Changes since v1
- Clarify in commit message that it's the link that must be up for the
  reporting to work, not just power up. Hopefully this oddity can be
  solved in the future by patch [1].

  This change just aligns the mv88q211x with the current mv88q222x
  behavior.

1. https://lore.kernel.org/all/20250220-marvell-88q2xxx-hwmon-enable-at-probe-v2-0-78b2838a62da@gmail.com/
---
 drivers/net/phy/marvell-88q2xxx.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c
index 23e1f0521f54..5c687164b8e0 100644
--- a/drivers/net/phy/marvell-88q2xxx.c
+++ b/drivers/net/phy/marvell-88q2xxx.c
@@ -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,
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [net-next,v2] net: phy: marvell-88q2xxx: Enable temperature sensor for mv88q211x
  2025-04-18 14:58 [net-next,v2] net: phy: marvell-88q2xxx: Enable temperature sensor for mv88q211x Niklas Söderlund
@ 2025-04-18 15:50 ` Andrew Lunn
  2025-04-18 16:10 ` Heiner Kallweit
  2025-04-24 11:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2025-04-18 15:50 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Dimitri Fedrau, netdev,
	linux-renesas-soc

On Fri, Apr 18, 2025 at 04:58:00PM +0200, Niklas Söderlund wrote:
> 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>

    Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [net-next,v2] net: phy: marvell-88q2xxx: Enable temperature sensor for mv88q211x
  2025-04-18 14:58 [net-next,v2] net: phy: marvell-88q2xxx: Enable temperature sensor for mv88q211x Niklas Söderlund
  2025-04-18 15:50 ` Andrew Lunn
@ 2025-04-18 16:10 ` Heiner Kallweit
  2025-04-24 11:19   ` Paolo Abeni
  2025-04-24 11:30 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Heiner Kallweit @ 2025-04-18 16:10 UTC (permalink / raw)
  To: Niklas Söderlund, Andrew Lunn, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Dimitri Fedrau, netdev
  Cc: linux-renesas-soc

On 18.04.2025 16:58, Niklas Söderlund wrote:
> 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>
> ---
> * Changes since v1
> - Clarify in commit message that it's the link that must be up for the
>   reporting to work, not just power up. Hopefully this oddity can be
>   solved in the future by patch [1].
> 
Following this link I don't see anything which would deal with incorrect
values being shown if link is down. What are you referring to in detail?
I think you have to modify mv88q2xxx_hwmon_is_visible(), or return an
appropriate error in mv88q2xxx_hwmon_read() if link is down.

>   This change just aligns the mv88q211x with the current mv88q222x
>   behavior.
> 
> 1. https://lore.kernel.org/all/20250220-marvell-88q2xxx-hwmon-enable-at-probe-v2-0-78b2838a62da@gmail.com/
> ---
>  drivers/net/phy/marvell-88q2xxx.c | 14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c
> index 23e1f0521f54..5c687164b8e0 100644
> --- a/drivers/net/phy/marvell-88q2xxx.c
> +++ b/drivers/net/phy/marvell-88q2xxx.c
> @@ -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,


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [net-next,v2] net: phy: marvell-88q2xxx: Enable temperature sensor for mv88q211x
  2025-04-18 16:10 ` Heiner Kallweit
@ 2025-04-24 11:19   ` Paolo Abeni
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Abeni @ 2025-04-24 11:19 UTC (permalink / raw)
  To: Heiner Kallweit, Niklas Söderlund, Andrew Lunn, Russell King,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Dimitri Fedrau,
	netdev
  Cc: linux-renesas-soc

On 4/18/25 6:10 PM, Heiner Kallweit wrote:
> On 18.04.2025 16:58, Niklas Söderlund wrote:
>> 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>
>> ---
>> * Changes since v1
>> - Clarify in commit message that it's the link that must be up for the
>>   reporting to work, not just power up. Hopefully this oddity can be
>>   solved in the future by patch [1].
>>
> Following this link I don't see anything which would deal with incorrect
> values being shown if link is down. What are you referring to in detail?
> I think you have to modify mv88q2xxx_hwmon_is_visible(), or return an
> appropriate error in mv88q2xxx_hwmon_read() if link is down.

@Heiner: my take is that the temp reading oddity should/will be handled
in a separate (net) patch, let's not block this patch due to that.

Thanks,

Paolo


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [net-next,v2] net: phy: marvell-88q2xxx: Enable temperature sensor for mv88q211x
  2025-04-18 14:58 [net-next,v2] net: phy: marvell-88q2xxx: Enable temperature sensor for mv88q211x Niklas Söderlund
  2025-04-18 15:50 ` Andrew Lunn
  2025-04-18 16:10 ` Heiner Kallweit
@ 2025-04-24 11:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-24 11:30 UTC (permalink / raw)
  To: =?utf-8?q?Niklas_S=C3=B6derlund_=3Cniklas=2Esoderlund+renesas=40ragnatech=2E?=,
	=?utf-8?q?se=3E?=
  Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni,
	dima.fedrau, netdev, linux-renesas-soc

Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Fri, 18 Apr 2025 16:58:00 +0200 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net: phy: marvell-88q2xxx: Enable temperature sensor for mv88q211x
    https://git.kernel.org/netdev/net-next/c/bef4f1156b74

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-04-24 11:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-18 14:58 [net-next,v2] net: phy: marvell-88q2xxx: Enable temperature sensor for mv88q211x Niklas Söderlund
2025-04-18 15:50 ` Andrew Lunn
2025-04-18 16:10 ` Heiner Kallweit
2025-04-24 11:19   ` Paolo Abeni
2025-04-24 11:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox