netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] r8169: fix issue caused by buggy BIOS on certain boards with RTL8168d
@ 2024-03-30 11:49 Heiner Kallweit
  2024-03-30 11:49 ` Heiner Kallweit
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Heiner Kallweit @ 2024-03-30 11:49 UTC (permalink / raw)
  To: Realtek linux nic maintainers, Paolo Abeni, David Miller,
	Eric Dumazet, Jakub Kicinski
  Cc: netdev@vger.kernel.org

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: f1e911d5d0df ("r8169: add basic phylib support")
Cc: stable@vger.kernel.org
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 5c879a5c8..3936db3d4 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -5141,6 +5141,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;
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-03  1:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-30 11:49 [PATCH net] r8169: fix issue caused by buggy BIOS on certain boards with RTL8168d Heiner Kallweit
2024-03-30 11:49 ` Heiner Kallweit
2024-04-02  8:31 ` Simon Horman
2024-04-03  1:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).