* [PATCH] net: phy: realtek: Fix setting of PHY LEDs Mode B bit on RTL8211F
@ 2024-08-21 2:16 Sava Jakovljev
2024-08-21 3:54 ` Marek Vasut
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sava Jakovljev @ 2024-08-21 2:16 UTC (permalink / raw)
Cc: savaj, Andrew Lunn, Heiner Kallweit, Russell King,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Marek Vasut, netdev, linux-kernel
From: Sava Jakovljev <savaj@meyersound.com>
The current implementation incorrectly sets the mode bit of the PHY chip.
Bit 15 (RTL8211F_LEDCR_MODE) should not be shifted together with the
configuration nibble of a LED- it should be set independently of the
index of the LED being configured.
As a consequence, the RTL8211F LED control is actually operating in Mode A.
Fix the error by or-ing final register value to write with a const-value of
RTL8211F_LEDCR_MODE, thus setting Mode bit explicitly.
Fixes: 17784801d888 ("net: phy: realtek: Add support for PHY LEDs on RTL8211F")
Signed-off-by: Sava Jakovljev <savaj@meyersound.com>
---
drivers/net/phy/realtek.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 87865918dab6..25e5bfbb6f89 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -555,7 +555,7 @@ static int rtl8211f_led_hw_control_set(struct phy_device *phydev, u8 index,
unsigned long rules)
{
const u16 mask = RTL8211F_LEDCR_MASK << (RTL8211F_LEDCR_SHIFT * index);
- u16 reg = RTL8211F_LEDCR_MODE; /* Mode B */
+ u16 reg = 0;
if (index >= RTL8211F_LED_COUNT)
return -EINVAL;
@@ -575,6 +575,7 @@ static int rtl8211f_led_hw_control_set(struct phy_device *phydev, u8 index,
}
reg <<= RTL8211F_LEDCR_SHIFT * index;
+ reg |= RTL8211F_LEDCR_MODE; /* Mode B */
return phy_modify_paged(phydev, 0xd04, RTL8211F_LEDCR, mask, reg);
}
--
2.46.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: phy: realtek: Fix setting of PHY LEDs Mode B bit on RTL8211F
2024-08-21 2:16 [PATCH] net: phy: realtek: Fix setting of PHY LEDs Mode B bit on RTL8211F Sava Jakovljev
@ 2024-08-21 3:54 ` Marek Vasut
2024-08-22 11:02 ` Paolo Abeni
2024-08-22 11:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2024-08-21 3:54 UTC (permalink / raw)
To: Sava Jakovljev
Cc: savaj, Andrew Lunn, Heiner Kallweit, Russell King,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev, linux-kernel
On 8/21/24 4:16 AM, Sava Jakovljev wrote:
> From: Sava Jakovljev <savaj@meyersound.com>
>
> The current implementation incorrectly sets the mode bit of the PHY chip.
> Bit 15 (RTL8211F_LEDCR_MODE) should not be shifted together with the
> configuration nibble of a LED- it should be set independently of the
> index of the LED being configured.
> As a consequence, the RTL8211F LED control is actually operating in Mode A.
> Fix the error by or-ing final register value to write with a const-value of
> RTL8211F_LEDCR_MODE, thus setting Mode bit explicitly.
>
> Fixes: 17784801d888 ("net: phy: realtek: Add support for PHY LEDs on RTL8211F")
>
> Signed-off-by: Sava Jakovljev <savaj@meyersound.com>
> ---
> drivers/net/phy/realtek.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> index 87865918dab6..25e5bfbb6f89 100644
> --- a/drivers/net/phy/realtek.c
> +++ b/drivers/net/phy/realtek.c
> @@ -555,7 +555,7 @@ static int rtl8211f_led_hw_control_set(struct phy_device *phydev, u8 index,
> unsigned long rules)
> {
> const u16 mask = RTL8211F_LEDCR_MASK << (RTL8211F_LEDCR_SHIFT * index);
> - u16 reg = RTL8211F_LEDCR_MODE; /* Mode B */
> + u16 reg = 0;
>
> if (index >= RTL8211F_LED_COUNT)
> return -EINVAL;
> @@ -575,6 +575,7 @@ static int rtl8211f_led_hw_control_set(struct phy_device *phydev, u8 index,
> }
>
> reg <<= RTL8211F_LEDCR_SHIFT * index;
> + reg |= RTL8211F_LEDCR_MODE; /* Mode B */
Nice find, thanks !
Reviewed-by: Marek Vasut <marex@denx.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: phy: realtek: Fix setting of PHY LEDs Mode B bit on RTL8211F
2024-08-21 2:16 [PATCH] net: phy: realtek: Fix setting of PHY LEDs Mode B bit on RTL8211F Sava Jakovljev
2024-08-21 3:54 ` Marek Vasut
@ 2024-08-22 11:02 ` Paolo Abeni
2024-08-22 11:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Abeni @ 2024-08-22 11:02 UTC (permalink / raw)
To: Sava Jakovljev
Cc: savaj, Andrew Lunn, Heiner Kallweit, Russell King,
David S. Miller, Eric Dumazet, Jakub Kicinski, Marek Vasut,
netdev, linux-kernel
On 8/21/24 04:16, Sava Jakovljev wrote:
> From: Sava Jakovljev <savaj@meyersound.com>
>
> The current implementation incorrectly sets the mode bit of the PHY chip.
> Bit 15 (RTL8211F_LEDCR_MODE) should not be shifted together with the
> configuration nibble of a LED- it should be set independently of the
> index of the LED being configured.
> As a consequence, the RTL8211F LED control is actually operating in Mode A.
> Fix the error by or-ing final register value to write with a const-value of
> RTL8211F_LEDCR_MODE, thus setting Mode bit explicitly.
>
> Fixes: 17784801d888 ("net: phy: realtek: Add support for PHY LEDs on RTL8211F")
Please, do not insert blank lines in the tag area i.e. between the fixes
and sob tags.
I'll one-off fix this while applying the patch,
No need to resent
Cheers,
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: phy: realtek: Fix setting of PHY LEDs Mode B bit on RTL8211F
2024-08-21 2:16 [PATCH] net: phy: realtek: Fix setting of PHY LEDs Mode B bit on RTL8211F Sava Jakovljev
2024-08-21 3:54 ` Marek Vasut
2024-08-22 11:02 ` Paolo Abeni
@ 2024-08-22 11:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-22 11:10 UTC (permalink / raw)
To: Sava Jakovljev
Cc: savaj, andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni,
marex, netdev, linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Wed, 21 Aug 2024 04:16:57 +0200 you wrote:
> From: Sava Jakovljev <savaj@meyersound.com>
>
> The current implementation incorrectly sets the mode bit of the PHY chip.
> Bit 15 (RTL8211F_LEDCR_MODE) should not be shifted together with the
> configuration nibble of a LED- it should be set independently of the
> index of the LED being configured.
> As a consequence, the RTL8211F LED control is actually operating in Mode A.
> Fix the error by or-ing final register value to write with a const-value of
> RTL8211F_LEDCR_MODE, thus setting Mode bit explicitly.
>
> [...]
Here is the summary with links:
- net: phy: realtek: Fix setting of PHY LEDs Mode B bit on RTL8211F
https://git.kernel.org/netdev/net/c/a2f5c505b437
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] 4+ messages in thread
end of thread, other threads:[~2024-08-22 11:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-21 2:16 [PATCH] net: phy: realtek: Fix setting of PHY LEDs Mode B bit on RTL8211F Sava Jakovljev
2024-08-21 3:54 ` Marek Vasut
2024-08-22 11:02 ` Paolo Abeni
2024-08-22 11:10 ` 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;
as well as URLs for NNTP newsgroup(s).