Skip to content

Commit

Permalink
r8169: fix issue caused by buggy BIOS on certain boards with RTL8168d
Browse files Browse the repository at this point in the history
On some boards with this chip version the BIOS is buggy and misses
to reset the PHY page selector. This results in the PHY ID read
accessing registers on a different page, returning a more or
less random value. Fix this by resetting the page selector first.

Fixes: f1e911d ("r8169: add basic phylib support")
Cc: stable@vger.kernel.org
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/64f2055e-98b8-45ec-8568-665e3d54d4e6@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
hkallweit authored and kuba-moo committed Apr 3, 2024
1 parent b32a09e commit 5d872c9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/net/ethernet/realtek/r8169_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5164,6 +5164,15 @@ static int r8169_mdio_register(struct rtl8169_private *tp)
struct mii_bus *new_bus;
int ret;

/* On some boards with this chip version the BIOS is buggy and misses
* to reset the PHY page selector. This results in the PHY ID read
* accessing registers on a different page, returning a more or
* less random value. Fix this by resetting the page selector first.
*/
if (tp->mac_version == RTL_GIGA_MAC_VER_25 ||
tp->mac_version == RTL_GIGA_MAC_VER_26)
r8169_mdio_write(tp, 0x1f, 0);

new_bus = devm_mdiobus_alloc(&pdev->dev);
if (!new_bus)
return -ENOMEM;
Expand Down

0 comments on commit 5d872c9

Please sign in to comment.