diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2019-11-06 21:51:31 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-11-06 21:36:48 -0800 |
commit | 9c6850fea3edefef6e7153b2c466f09155399882 (patch) | |
tree | 20c2f559740a428af9a7523f996f9724b1eab41b /drivers | |
parent | 58b87d21fe796953a2addc69e26179fb31f792a4 (diff) | |
download | linux-riscv-9c6850fea3edefef6e7153b2c466f09155399882.tar.gz linux-riscv-9c6850fea3edefef6e7153b2c466f09155399882.tar.bz2 linux-riscv-9c6850fea3edefef6e7153b2c466f09155399882.zip |
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")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/realtek/r8169_main.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 5064c292b873..c4e961ea44d5 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -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; |