mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 06:57:57 +00:00
ca4469045f
Replace downstream RealTek PHY patches with backported ones. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
64 lines
2.0 KiB
Diff
64 lines
2.0 KiB
Diff
From d54ef6aea00e7a6ace439baade6ad0aa38ee4b04 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Golle <daniel@makrotopia.org>
|
|
Date: Mon, 3 Apr 2023 01:21:57 +0300
|
|
Subject: [PATCH 287/326] 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@gmail.com>
|
|
Reported-by: Chukun Pan <amadeus@jmu.edu.cn>
|
|
Reported-by: Yevhen Kolomeiko <jarvis2709@gmail.com>
|
|
Tested-by: Yevhen Kolomeiko <jarvis2709@gmail.com>
|
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
---
|
|
drivers/net/phy/realtek.c | 27 +++++++++++++++++++++++++--
|
|
1 file changed, 25 insertions(+), 2 deletions(-)
|
|
|
|
--- a/drivers/net/phy/realtek.c
|
|
+++ b/drivers/net/phy/realtek.c
|
|
@@ -682,8 +682,8 @@ static int rtl822x_write_mmd(struct phy_
|
|
static int rtl822xb_config_init(struct phy_device *phydev)
|
|
{
|
|
bool has_2500, has_sgmii;
|
|
+ int ret, val;
|
|
u16 mode;
|
|
- int ret;
|
|
|
|
has_2500 = test_bit(PHY_INTERFACE_MODE_2500BASEX,
|
|
phydev->host_interfaces) ||
|
|
@@ -733,7 +733,29 @@ static int rtl822xb_config_init(struct p
|
|
if (ret < 0)
|
|
return ret;
|
|
|
|
- return phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x6f11, 0x8020);
|
|
+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x6f11, 0x8020);
|
|
+ if (ret < 0)
|
|
+ return ret;
|
|
+
|
|
+ /* Disable SGMII AN */
|
|
+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x7588, 0x2);
|
|
+ if (ret < 0)
|
|
+ return ret;
|
|
+
|
|
+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x7589, 0x71d0);
|
|
+ if (ret < 0)
|
|
+ return ret;
|
|
+
|
|
+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x7587, 0x3);
|
|
+ if (ret < 0)
|
|
+ return ret;
|
|
+
|
|
+ ret = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, 0x7587,
|
|
+ val, !(val & BIT(0)), 500, 100000, false);
|
|
+ if (ret < 0)
|
|
+ return ret;
|
|
+
|
|
+ return 0;
|
|
}
|
|
|
|
static int rtl822xb_get_rate_matching(struct phy_device *phydev,
|