Subject: [PATCH net-next 09/15] net: phy: realtek: read standard MMD register for rtlgen speed capability

From: Marek Behún <[email-masked]>
Date: Wed, 20 Dec 2023 16:55:12 +0100

Read the standard "PMA/PMD speed ability" register instead of it's
vendor specific alias via paging in rtlgen_supports_2_5gbps(), which is
used by the .match_phy_device method.

Signed-off-by: Marek Behún <[email-masked]>
---
 drivers/net/phy/realtek.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 66515981d2aa..0bb56d89157a 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -699,11 +699,7 @@ static int rtl822x_read_status(struct phy_device *phydev)
 
 static bool rtlgen_supports_2_5gbps(struct phy_device *phydev)
 {
-	int val;
-
-	phy_write(phydev, RTL821x_PAGE_SELECT, 0xa61);
-	val = phy_read(phydev, 0x13);
-	phy_write(phydev, RTL821x_PAGE_SELECT, 0);
+	int val = rtlgen_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_SPEED);
 
 	return val >= 0 && val & MDIO_PMA_SPEED_2_5G;
 }
-- 
2.41.0