1 From a2f5c505b4378cd6fc7c4a44ff3665ccef2037db Mon Sep 17 00:00:00 2001
2 From: Sava Jakovljev <savaj@meyersound.com>
3 Date: Wed, 21 Aug 2024 04:16:57 +0200
4 Subject: [PATCH] net: phy: realtek: Fix setting of PHY LEDs Mode B bit on
7 The current implementation incorrectly sets the mode bit of the PHY chip.
8 Bit 15 (RTL8211F_LEDCR_MODE) should not be shifted together with the
9 configuration nibble of a LED- it should be set independently of the
10 index of the LED being configured.
11 As a consequence, the RTL8211F LED control is actually operating in Mode A.
12 Fix the error by or-ing final register value to write with a const-value of
13 RTL8211F_LEDCR_MODE, thus setting Mode bit explicitly.
15 Fixes: 17784801d888 ("net: phy: realtek: Add support for PHY LEDs on RTL8211F")
16 Signed-off-by: Sava Jakovljev <savaj@meyersound.com>
17 Reviewed-by: Marek Vasut <marex@denx.de>
18 Link: https://patch.msgid.link/PAWP192MB21287372F30C4E55B6DF6158C38E2@PAWP192MB2128.EURP192.PROD.OUTLOOK.COM
19 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
21 drivers/net/phy/realtek.c | 3 ++-
22 1 file changed, 2 insertions(+), 1 deletion(-)
24 --- a/drivers/net/phy/realtek.c
25 +++ b/drivers/net/phy/realtek.c
26 @@ -555,7 +555,7 @@ static int rtl8211f_led_hw_control_set(s
29 const u16 mask = RTL8211F_LEDCR_MASK << (RTL8211F_LEDCR_SHIFT * index);
30 - u16 reg = RTL8211F_LEDCR_MODE; /* Mode B */
33 if (index >= RTL8211F_LED_COUNT)
35 @@ -575,6 +575,7 @@ static int rtl8211f_led_hw_control_set(s
38 reg <<= RTL8211F_LEDCR_SHIFT * index;
39 + reg |= RTL8211F_LEDCR_MODE; /* Mode B */
41 return phy_modify_paged(phydev, 0xd04, RTL8211F_LEDCR, mask, reg);