1 From e340bff27e63ed61a1e9895bed546107859e48a7 Mon Sep 17 00:00:00 2001
2 From: Heiner Kallweit <hkallweit1@gmail.com>
3 Date: Fri, 8 Nov 2024 08:08:24 +0100
4 Subject: [PATCH] r8169: copy vendor driver 2.5G/5G EEE advertisement
7 Vendor driver r8125 doesn't advertise 2.5G EEE on RTL8125A, and r8126
8 doesn't advertise 5G EEE. Likely there are compatibility issues,
9 therefore do the same in r8169.
10 With this change we don't have to disable 2.5G EEE advertisement in
11 rtl8125a_config_eee_phy() any longer.
12 We use new phylib accessor phy_set_eee_broken() to mark the respective
15 Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
16 Link: https://patch.msgid.link/ce185e10-8a2f-4cf8-a49b-fd8fb3c3c8a1@gmail.com
17 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
19 drivers/net/ethernet/realtek/r8169_main.c | 6 ++++++
20 drivers/net/ethernet/realtek/r8169_phy_config.c | 16 ++++------------
21 2 files changed, 10 insertions(+), 12 deletions(-)
23 --- a/drivers/net/ethernet/realtek/r8169_main.c
24 +++ b/drivers/net/ethernet/realtek/r8169_main.c
25 @@ -5238,6 +5238,11 @@ static int r8169_mdio_register(struct rt
26 tp->phydev->supported_eee);
27 phy_support_asym_pause(tp->phydev);
29 + /* mimic behavior of r8125/r8126 vendor drivers */
30 + if (tp->mac_version == RTL_GIGA_MAC_VER_61)
31 + tp->phydev->eee_broken_modes |= MDIO_EEE_2_5GT;
32 + tp->phydev->eee_broken_modes |= MDIO_EEE_5GT;
34 /* PHY will be woken up in rtl_open() */
35 phy_suspend(tp->phydev);
37 --- a/drivers/net/ethernet/realtek/r8169_phy_config.c
38 +++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
39 @@ -96,15 +96,7 @@ static void rtl8125_common_config_eee_ph
40 phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000);
43 -static void rtl8125a_config_eee_phy(struct phy_device *phydev)
45 - rtl8168g_config_eee_phy(phydev);
46 - /* disable EEE at 2.5Gbps */
47 - phy_modify_paged(phydev, 0xa6d, 0x12, 0x0001, 0x0000);
48 - rtl8125_common_config_eee_phy(phydev);
51 -static void rtl8125b_config_eee_phy(struct phy_device *phydev)
52 +static void rtl8125_config_eee_phy(struct phy_device *phydev)
54 rtl8168g_config_eee_phy(phydev);
55 rtl8125_common_config_eee_phy(phydev);
56 @@ -1066,7 +1058,7 @@ static void rtl8125a_2_hw_phy_config(str
57 rtl8168g_enable_gphy_10m(phydev);
59 rtl8168g_disable_aldps(phydev);
60 - rtl8125a_config_eee_phy(phydev);
61 + rtl8125_config_eee_phy(phydev);
64 static void rtl8125b_hw_phy_config(struct rtl8169_private *tp,
65 @@ -1106,7 +1098,7 @@ static void rtl8125b_hw_phy_config(struc
67 rtl8125_legacy_force_mode(phydev);
68 rtl8168g_disable_aldps(phydev);
69 - rtl8125b_config_eee_phy(phydev);
70 + rtl8125_config_eee_phy(phydev);
73 static void rtl8125d_hw_phy_config(struct rtl8169_private *tp,
74 @@ -1116,7 +1108,7 @@ static void rtl8125d_hw_phy_config(struc
75 rtl8168g_enable_gphy_10m(phydev);
76 rtl8125_legacy_force_mode(phydev);
77 rtl8168g_disable_aldps(phydev);
78 - rtl8125b_config_eee_phy(phydev);
79 + rtl8125_config_eee_phy(phydev);
82 static void rtl8126a_hw_phy_config(struct rtl8169_private *tp,