Skip to contentSkip to conversation

r8169: fix page read in r8168g_mdio_read

PATCH Applied Heiner Kallweit 2 participants 3 messages Nov 6, 2019 – Nov 7, 2019

Subsystems (3)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

PATCH 1/1 r8169: fix page read in r8168g_mdio_read

Functions like phy_modify_paged() read the current page, on Realtek PHY's this means reading the value of register 0x1f. Add special handling for reading this register, similar to what we do already in r8168g_mdio_write(). Currently we read a random value that by chance seems to be 0 always.

Fixes a2928d28643e ("r8169: use paged versions of phylib MDIO access functions")
---
 drivers/net/ethernet/realtek/r8169_main.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/realtek/r8169_main.c +3 -0
index 0704f8bd1..8a7b22301 100644
@@ -910,6 +910,9 @@ static void r8168g_mdio_write(struct rtl8169_private *tp, int reg, int value)
 
 static int r8168g_mdio_read(struct rtl8169_private *tp, int reg)
 {
+	if (reg == 0x1f)
+		return tp->ocp_base == OCP_STD_PHY_BASE ? 0 : tp->ocp_base >> 4;
+
 	if (tp->ocp_base != OCP_STD_PHY_BASE)
 		reg -= 0x10;
 
Signature · 1 line
2.24.0
maintainer Applied
#1 lore raw

From: Heiner Kallweit <[email protected]>
Date: Wed, 6 Nov 2019 21:51:31 +0100

Quoted 8 lines

Functions like phy_modify_paged() read the current page, on Realtek PHY's this means reading the value of register 0x1f. Add special handling for reading this register, similar to what we do already in r8168g_mdio_write(). Currently we read a random value that by chance seems to be 0 always.

Fixes a2928d28643e ("r8169: use paged versions of phylib MDIO access functions")

Applied, thanks.

maintainer
#2 lore raw

From: David Miller <[email protected]>
Date: Wed, 06 Nov 2019 21:37:58 -0800 (PST)

Quoted 9 lines

From: Heiner Kallweit <[email protected]>
Date: Wed, 6 Nov 2019 21:51:31 +0100

Quoted 6 lines

Functions like phy_modify_paged() read the current page, on Realtek PHY's this means reading the value of register 0x1f. Add special handling for reading this register, similar to what we do already in r8168g_mdio_write(). Currently we read a random value that by chance seems to be 0 always.

Quoted 4 lines
Quoted 2 lines
Fixes a2928d28643e ("r8169: use paged versions of phylib MDIO access functions")

Applied, thanks.

And also queued up for -stable :-)