Skip to content

Commit a2f5c50

Browse files
sava-msliPaolo Abeni
authored andcommitted
net: phy: realtek: Fix setting of PHY LEDs Mode B bit on RTL8211F
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: 1778480 ("net: phy: realtek: Add support for PHY LEDs on RTL8211F") Signed-off-by: Sava Jakovljev <[email protected]> Reviewed-by: Marek Vasut <[email protected]> Link: https://patch.msgid.link/PAWP192MB21287372F30C4E55B6DF6158C38E2@PAWP192MB2128.EURP192.PROD.OUTLOOK.COM Signed-off-by: Paolo Abeni <[email protected]>
1 parent f2916c8 commit a2f5c50

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/phy/realtek.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ static int rtl8211f_led_hw_control_set(struct phy_device *phydev, u8 index,
555555
unsigned long rules)
556556
{
557557
const u16 mask = RTL8211F_LEDCR_MASK << (RTL8211F_LEDCR_SHIFT * index);
558-
u16 reg = RTL8211F_LEDCR_MODE; /* Mode B */
558+
u16 reg = 0;
559559

560560
if (index >= RTL8211F_LED_COUNT)
561561
return -EINVAL;
@@ -575,6 +575,7 @@ static int rtl8211f_led_hw_control_set(struct phy_device *phydev, u8 index,
575575
}
576576

577577
reg <<= RTL8211F_LEDCR_SHIFT * index;
578+
reg |= RTL8211F_LEDCR_MODE; /* Mode B */
578579

579580
return phy_modify_paged(phydev, 0xd04, RTL8211F_LEDCR, mask, reg);
580581
}

0 commit comments

Comments
 (0)