On some but not all devices using the RTL8221B 2.5GBit/s PHY the SerDes
setup sequence may hang under some circumstances (eg. <2500M link
partner present during boot).
RTL8221B-VB-CG 2.5Gbps PHY (C45) mdio-bus:01: rtl822xb_config_init failed: -110
Work-around the issue by performing a hardware reset and subsequent
retry of the SerDes setup, which seems to always succeed.
Doing this requires moving ALDPS setup to config_init (which is anyway
the better place for that) as it otherwise doesn't survive the reset.
Also disable listening on MDIO address 0 which may be used by other PHYs
despite being spec'ed as "broadcast address", as bus activity on address
0 may otherwise confuse the RealTek PHY for good reasons.
Tested-by: Luis Mita <luis@luismita.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(cherry picked from commit c87a767801)
Link: https://github.com/openwrt/openwrt/pull/17790
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			972 B
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			972 B
		
	
	
	
		
			Diff
		
	
	
	
	
	
From 1addfb042a9d27788a0fb2c2935045b56fd8560e Mon Sep 17 00:00:00 2001
 | 
						|
From: Daniel Golle <daniel@makrotopia.org>
 | 
						|
Date: Thu, 23 Jan 2025 03:25:29 +0000
 | 
						|
Subject: [PATCH] net: phy: realtek: mark existing MMDs as present
 | 
						|
 | 
						|
When using Clause-45 mode to access RealTek RTL8221B 2.5G PHYs some
 | 
						|
versions of the PHY fail to report the MMDs present on the PHY.
 | 
						|
Mark MMDs PMAPMD, PCS and AN which are always existing according to
 | 
						|
the datasheet as present to fix that.
 | 
						|
 | 
						|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
 | 
						|
---
 | 
						|
 drivers/net/phy/realtek/realtek_main.c | 3 +++
 | 
						|
 1 file changed, 3 insertions(+)
 | 
						|
 | 
						|
--- a/drivers/net/phy/realtek/realtek_main.c
 | 
						|
+++ b/drivers/net/phy/realtek/realtek_main.c
 | 
						|
@@ -1043,6 +1043,9 @@ static int rtl822x_c45_get_features(stru
 | 
						|
 	linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT,
 | 
						|
 			 phydev->supported);
 | 
						|
 
 | 
						|
+	phydev->c45_ids.mmds_present |= MDIO_DEVS_PMAPMD | MDIO_DEVS_PCS |
 | 
						|
+				        MDIO_DEVS_AN;
 | 
						|
+
 | 
						|
 	return genphy_c45_pma_read_abilities(phydev);
 | 
						|
 }
 | 
						|
 
 |