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: a2928d2864 ("r8169: use paged versions of phylib MDIO access functions")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Heiner Kallweit 2019-11-06 21:51:31 +01:00 committed by David S. Miller
parent 58b87d21fe
commit 9c6850fea3
1 changed files with 3 additions and 0 deletions

View File

@ -916,6 +916,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;