diff mbox series

[net] r8169: fix issue caused by buggy BIOS on certain boards with RTL8168d

Message ID 64f2055e-98b8-45ec-8568-665e3d54d4e6@gmail.com (mailing list archive)
State Accepted
Commit 5d872c9f46bd2ea3524af3c2420a364a13667135
Delegated to: Netdev Maintainers
Headers show
Series [net] r8169: fix issue caused by buggy BIOS on certain boards with RTL8168d | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 943 this patch: 943
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 954 this patch: 954
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 954 this patch: 954
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-03-31--03-00 (tests: 953)

Commit Message

Heiner Kallweit March 30, 2024, 11:49 a.m. UTC
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(+)

Comments

Simon Horman April 2, 2024, 8:31 a.m. UTC | #1
On Sat, Mar 30, 2024 at 12:49:02PM +0100, Heiner Kallweit wrote:
> 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>

Reviewed-by: Simon Horman <horms@kernel.org>
patchwork-bot+netdevbpf@kernel.org April 3, 2024, 1:20 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 30 Mar 2024 12:49:02 +0100 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [net] r8169: fix issue caused by buggy BIOS on certain boards with RTL8168d
    https://git.kernel.org/netdev/net/c/5d872c9f46bd

You are awesome, thank you!
diff mbox series

Patch

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;