[openwrt/openwrt] generic: disable SGMII in-band AN for RealTek 2.5G PHYs

LEDE Commits lede-commits at lists.infradead.org
Mon Apr 3 09:38:55 PDT 2023


dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/d98c8fc06ddd36f4b47c0eef8094e68257b92f87

commit d98c8fc06ddd36f4b47c0eef8094e68257b92f87
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Mon Apr 3 01:21:57 2023 +0300

    generic: disable SGMII in-band AN for RealTek 2.5G PHYs
    
    MAC drivers don't use SGMII in-band autonegotiation unless told to do so
    in device tree using 'managed = "in-band-status"'. When using MDIO to
    access a PHY, in-band-status is unneeded as we have link-status via
    MDIO. Switch off SGMII in-band autonegotiation using magic values.
    
    Reported-by: Chen Minqiang <ptpt52 at gmail.com>
    Reported-by: Chukun Pan <amadeus at jmu.edu.cn>
    Reported-by: Yevhen Kolomeiko <jarvis2709 at gmail.com>
    Tested-by: Yevhen Kolomeiko <jarvis2709 at gmail.com>
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 ...ek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/target/linux/generic/pending-5.15/725-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch b/target/linux/generic/pending-5.15/725-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch
new file mode 100644
index 0000000000..7f2174e4d2
--- /dev/null
+++ b/target/linux/generic/pending-5.15/725-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch
@@ -0,0 +1,43 @@
+From 2b1b8c4c215af7988136401c902338d091d408a1 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel at makrotopia.org>
+Date: Mon, 3 Apr 2023 01:21:57 +0300
+Subject: [PATCH 2/2] net: phy: realtek: disable SGMII in-band AN for 2.5G PHYs
+
+MAC drivers don't use SGMII in-band autonegotiation unless told to do so
+in device tree using 'managed = "in-band-status"'. When using MDIO to
+access a PHY, in-band-status is unneeded as we have link-status via
+MDIO. Switch off SGMII in-band autonegotiation using magic values.
+
+Reported-by: Chen Minqiang <ptpt52 at gmail.com>
+Reported-by: Chukun Pan <amadeus at jmu.edu.cn>
+Reported-by: Yevhen Kolomeiko <jarvis2709 at gmail.com>
+Tested-by: Yevhen Kolomeiko <jarvis2709 at gmail.com>
+Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+---
+ drivers/net/phy/realtek.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/net/phy/realtek.c
++++ b/drivers/net/phy/realtek.c
+@@ -875,6 +875,7 @@ static irqreturn_t rtl9000a_handle_inter
+ static int rtl8221b_config_init(struct phy_device *phydev)
+ {
+ 	u16 option_mode;
++	int val;
+ 
+ 	switch (phydev->interface) {
+ 	case PHY_INTERFACE_MODE_SGMII:
+@@ -906,6 +907,13 @@ static int rtl8221b_config_init(struct p
+                 break;
+ 	}
+ 
++	/* Disable SGMII AN */
++	phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7588, 0x2);
++	phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7589, 0x71d0);
++	phy_write_mmd(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7587, 0x3);
++	phy_read_mmd_poll_timeout(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7587, val,
++				  !(val & BIT(0)), 500, 100000, false);
++
+ 	return 0;
+ }
+ 




More information about the lede-commits mailing list