forked from coolsnowwolf/lede
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generic: 6.6: backport upstream RealTek PHY patches
Replace downstream RealTek PHY patches with backported ones. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
- Loading branch information
Showing
22 changed files
with
1,141 additions
and
350 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
.../generic/backport-6.6/610-v6.9-net-mdio-add-2.5g-and-5g-related-PMA-speed-constants.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
From 6c06c88fa838fcc1b7e5380facd086f57fd9d1c4 Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Marek=20Beh=C3=BAn?= <kabel@kernel.org> | ||
Date: Sun, 4 Feb 2024 15:16:46 +0100 | ||
Subject: [PATCH] net: mdio: add 2.5g and 5g related PMA speed constants | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; charset=UTF-8 | ||
Content-Transfer-Encoding: 8bit | ||
|
||
Add constants indicating 2.5g and 5g ability in the MMD PMA speed | ||
register. | ||
|
||
Signed-off-by: Marek Behún <kabel@kernel.org> | ||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> | ||
Link: https://lore.kernel.org/r/98e15038-d96c-442f-93e4-410100d27866@gmail.com | ||
Signed-off-by: Jakub Kicinski <kuba@kernel.org> | ||
--- | ||
include/uapi/linux/mdio.h | 2 ++ | ||
1 file changed, 2 insertions(+) | ||
|
||
--- a/include/uapi/linux/mdio.h | ||
+++ b/include/uapi/linux/mdio.h | ||
@@ -138,6 +138,8 @@ | ||
#define MDIO_PMA_SPEED_1000 0x0010 /* 1000M capable */ | ||
#define MDIO_PMA_SPEED_100 0x0020 /* 100M capable */ | ||
#define MDIO_PMA_SPEED_10 0x0040 /* 10M capable */ | ||
+#define MDIO_PMA_SPEED_2_5G 0x2000 /* 2.5G capable */ | ||
+#define MDIO_PMA_SPEED_5G 0x4000 /* 5G capable */ | ||
#define MDIO_PCS_SPEED_10P2B 0x0002 /* 10PASS-TS/2BASE-TL capable */ | ||
#define MDIO_PCS_SPEED_2_5G 0x0040 /* 2.5G capable */ | ||
#define MDIO_PCS_SPEED_5G 0x0080 /* 5G capable */ |
40 changes: 40 additions & 0 deletions
40
...neric/backport-6.6/781-01-v6.9-net-phy-realtek-add-support-for-RTL8126A-integrated-.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
From 5befa3728b855e9f75b29bb0069a1ca7f5bab2f7 Mon Sep 17 00:00:00 2001 | ||
From: Heiner Kallweit <hkallweit1@gmail.com> | ||
Date: Wed, 31 Jan 2024 21:24:29 +0100 | ||
Subject: [PATCH] net: phy: realtek: add support for RTL8126A-integrated 5Gbps | ||
PHY | ||
|
||
A user reported that first consumer mainboards show up with a RTL8126A | ||
5Gbps MAC/PHY. This adds support for the integrated PHY, which is also | ||
available stand-alone. From a PHY driver perspective it's treated the | ||
same as the 2.5Gbps PHY's, we just have to support the new PHY ID. | ||
|
||
Reported-by: Joe Salmeri <jmscdba@gmail.com> | ||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> | ||
Reviewed-by: Andrew Lunn <andrew@lunn.ch> | ||
Tested-by: Joe Salmeri <jmscdba@gmail.com> | ||
Link: https://lore.kernel.org/r/0c8e67ea-6505-43d1-bd51-94e7ecd6e222@gmail.com | ||
Signed-off-by: Jakub Kicinski <kuba@kernel.org> | ||
--- | ||
drivers/net/phy/realtek.c | 10 ++++++++++ | ||
1 file changed, 10 insertions(+) | ||
|
||
--- a/drivers/net/phy/realtek.c | ||
+++ b/drivers/net/phy/realtek.c | ||
@@ -1050,6 +1050,16 @@ static struct phy_driver realtek_drvs[] | ||
.read_page = rtl821x_read_page, | ||
.write_page = rtl821x_write_page, | ||
}, { | ||
+ PHY_ID_MATCH_EXACT(0x001cc862), | ||
+ .name = "RTL8251B 5Gbps PHY", | ||
+ .get_features = rtl822x_get_features, | ||
+ .config_aneg = rtl822x_config_aneg, | ||
+ .read_status = rtl822x_read_status, | ||
+ .suspend = genphy_suspend, | ||
+ .resume = rtlgen_resume, | ||
+ .read_page = rtl821x_read_page, | ||
+ .write_page = rtl821x_write_page, | ||
+ }, { | ||
PHY_ID_MATCH_EXACT(0x001cc961), | ||
.name = "RTL8366RB Gigabit Ethernet", | ||
.config_init = &rtl8366rb_config_init, |
93 changes: 93 additions & 0 deletions
93
...t/linux/generic/backport-6.6/781-02-v6.9-net-phy-realtek-use-generic-MDIO-constants.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
From 2b9ec5dfb8255656ca731ab9d9bf59d94566d377 Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Marek=20Beh=C3=BAn?= <kabel@kernel.org> | ||
Date: Sun, 4 Feb 2024 15:17:53 +0100 | ||
Subject: [PATCH] net: phy: realtek: use generic MDIO constants | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; charset=UTF-8 | ||
Content-Transfer-Encoding: 8bit | ||
|
||
Drop the ad-hoc MDIO constants used in the driver and use generic | ||
constants instead. | ||
|
||
Signed-off-by: Marek Behún <kabel@kernel.org> | ||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> | ||
Reviewed-by: Andrew Lunn <andrew@lunn.ch> | ||
Link: https://lore.kernel.org/r/732a70d6-4191-4aae-8862-3716b062aa9e@gmail.com | ||
Signed-off-by: Jakub Kicinski <kuba@kernel.org> | ||
--- | ||
drivers/net/phy/realtek.c | 30 +++++++++++++----------------- | ||
1 file changed, 13 insertions(+), 17 deletions(-) | ||
|
||
--- a/drivers/net/phy/realtek.c | ||
+++ b/drivers/net/phy/realtek.c | ||
@@ -57,14 +57,6 @@ | ||
#define RTL8366RB_POWER_SAVE 0x15 | ||
#define RTL8366RB_POWER_SAVE_ON BIT(12) | ||
|
||
-#define RTL_SUPPORTS_5000FULL BIT(14) | ||
-#define RTL_SUPPORTS_2500FULL BIT(13) | ||
-#define RTL_SUPPORTS_10000FULL BIT(0) | ||
-#define RTL_ADV_2500FULL BIT(7) | ||
-#define RTL_LPADV_10000FULL BIT(11) | ||
-#define RTL_LPADV_5000FULL BIT(6) | ||
-#define RTL_LPADV_2500FULL BIT(5) | ||
- | ||
#define RTL9000A_GINMR 0x14 | ||
#define RTL9000A_GINMR_LINK_STATUS BIT(4) | ||
|
||
@@ -676,11 +668,11 @@ static int rtl822x_get_features(struct p | ||
return val; | ||
|
||
linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, | ||
- phydev->supported, val & RTL_SUPPORTS_2500FULL); | ||
+ phydev->supported, val & MDIO_PMA_SPEED_2_5G); | ||
linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, | ||
- phydev->supported, val & RTL_SUPPORTS_5000FULL); | ||
+ phydev->supported, val & MDIO_PMA_SPEED_5G); | ||
linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, | ||
- phydev->supported, val & RTL_SUPPORTS_10000FULL); | ||
+ phydev->supported, val & MDIO_SPEED_10G); | ||
|
||
return genphy_read_abilities(phydev); | ||
} | ||
@@ -694,10 +686,11 @@ static int rtl822x_config_aneg(struct ph | ||
|
||
if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, | ||
phydev->advertising)) | ||
- adv2500 = RTL_ADV_2500FULL; | ||
+ adv2500 = MDIO_AN_10GBT_CTRL_ADV2_5G; | ||
|
||
ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12, | ||
- RTL_ADV_2500FULL, adv2500); | ||
+ MDIO_AN_10GBT_CTRL_ADV2_5G, | ||
+ adv2500); | ||
if (ret < 0) | ||
return ret; | ||
} | ||
@@ -716,11 +709,14 @@ static int rtl822x_read_status(struct ph | ||
return lpadv; | ||
|
||
linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, | ||
- phydev->lp_advertising, lpadv & RTL_LPADV_10000FULL); | ||
+ phydev->lp_advertising, | ||
+ lpadv & MDIO_AN_10GBT_STAT_LP10G); | ||
linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, | ||
- phydev->lp_advertising, lpadv & RTL_LPADV_5000FULL); | ||
+ phydev->lp_advertising, | ||
+ lpadv & MDIO_AN_10GBT_STAT_LP5G); | ||
linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, | ||
- phydev->lp_advertising, lpadv & RTL_LPADV_2500FULL); | ||
+ phydev->lp_advertising, | ||
+ lpadv & MDIO_AN_10GBT_STAT_LP2_5G); | ||
} | ||
|
||
ret = genphy_read_status(phydev); | ||
@@ -738,7 +734,7 @@ static bool rtlgen_supports_2_5gbps(stru | ||
val = phy_read(phydev, 0x13); | ||
phy_write(phydev, RTL821x_PAGE_SELECT, 0); | ||
|
||
- return val >= 0 && val & RTL_SUPPORTS_2500FULL; | ||
+ return val >= 0 && val & MDIO_PMA_SPEED_2_5G; | ||
} | ||
|
||
static int rtlgen_match_phy_device(struct phy_device *phydev) |
42 changes: 42 additions & 0 deletions
42
...neric/backport-6.6/781-03-v6.9-net-phy-realtek-add-5Gbps-support-to-rtl822x_config_.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
From db1bb7741ff29bf2cefcbc0ca567644e9ed1caa9 Mon Sep 17 00:00:00 2001 | ||
From: Heiner Kallweit <hkallweit1@gmail.com> | ||
Date: Sun, 4 Feb 2024 15:18:50 +0100 | ||
Subject: [PATCH] net: phy: realtek: add 5Gbps support to rtl822x_config_aneg() | ||
|
||
RTL8126 as an evolution of RTL8125 supports 5Gbps. rtl822x_config_aneg() | ||
is used by the PHY driver for the integrated PHY, therefore add 5Gbps | ||
support to it. | ||
|
||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> | ||
Link: https://lore.kernel.org/r/5644ab50-e3e9-477c-96db-05cd5bdc2563@gmail.com | ||
Signed-off-by: Jakub Kicinski <kuba@kernel.org> | ||
--- | ||
drivers/net/phy/realtek.c | 12 ++++++++---- | ||
1 file changed, 8 insertions(+), 4 deletions(-) | ||
|
||
--- a/drivers/net/phy/realtek.c | ||
+++ b/drivers/net/phy/realtek.c | ||
@@ -682,15 +682,19 @@ static int rtl822x_config_aneg(struct ph | ||
int ret = 0; | ||
|
||
if (phydev->autoneg == AUTONEG_ENABLE) { | ||
- u16 adv2500 = 0; | ||
+ u16 adv = 0; | ||
|
||
if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, | ||
phydev->advertising)) | ||
- adv2500 = MDIO_AN_10GBT_CTRL_ADV2_5G; | ||
+ adv |= MDIO_AN_10GBT_CTRL_ADV2_5G; | ||
+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, | ||
+ phydev->advertising)) | ||
+ adv |= MDIO_AN_10GBT_CTRL_ADV5G; | ||
|
||
ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12, | ||
- MDIO_AN_10GBT_CTRL_ADV2_5G, | ||
- adv2500); | ||
+ MDIO_AN_10GBT_CTRL_ADV2_5G | | ||
+ MDIO_AN_10GBT_CTRL_ADV5G, | ||
+ adv); | ||
if (ret < 0) | ||
return ret; | ||
} |
52 changes: 52 additions & 0 deletions
52
...neric/backport-6.6/781-04-v6.9-net-phy-realtek-use-generic-MDIO-helpers-to-simplify.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
From b63cc73341e076961d564a74cc3d29b2fd444079 Mon Sep 17 00:00:00 2001 | ||
From: Heiner Kallweit <hkallweit1@gmail.com> | ||
Date: Thu, 8 Feb 2024 07:59:18 +0100 | ||
Subject: [PATCH] net: phy: realtek: use generic MDIO helpers to simplify the | ||
code | ||
|
||
Use generic MDIO helpers to simplify the code. | ||
|
||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> | ||
Reviewed-by: Andrew Lunn <andrew@lunn.ch> | ||
Link: https://lore.kernel.org/r/422ae70f-7305-45fd-ab3e-0dd604b9fd6c@gmail.com | ||
Signed-off-by: Jakub Kicinski <kuba@kernel.org> | ||
--- | ||
drivers/net/phy/realtek.c | 20 +++----------------- | ||
1 file changed, 3 insertions(+), 17 deletions(-) | ||
|
||
--- a/drivers/net/phy/realtek.c | ||
+++ b/drivers/net/phy/realtek.c | ||
@@ -682,14 +682,7 @@ static int rtl822x_config_aneg(struct ph | ||
int ret = 0; | ||
|
||
if (phydev->autoneg == AUTONEG_ENABLE) { | ||
- u16 adv = 0; | ||
- | ||
- if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, | ||
- phydev->advertising)) | ||
- adv |= MDIO_AN_10GBT_CTRL_ADV2_5G; | ||
- if (linkmode_test_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, | ||
- phydev->advertising)) | ||
- adv |= MDIO_AN_10GBT_CTRL_ADV5G; | ||
+ u16 adv = linkmode_adv_to_mii_10gbt_adv_t(phydev->advertising); | ||
|
||
ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12, | ||
MDIO_AN_10GBT_CTRL_ADV2_5G | | ||
@@ -712,15 +705,8 @@ static int rtl822x_read_status(struct ph | ||
if (lpadv < 0) | ||
return lpadv; | ||
|
||
- linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, | ||
- phydev->lp_advertising, | ||
- lpadv & MDIO_AN_10GBT_STAT_LP10G); | ||
- linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, | ||
- phydev->lp_advertising, | ||
- lpadv & MDIO_AN_10GBT_STAT_LP5G); | ||
- linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, | ||
- phydev->lp_advertising, | ||
- lpadv & MDIO_AN_10GBT_STAT_LP2_5G); | ||
+ mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, | ||
+ lpadv); | ||
} | ||
|
||
ret = genphy_read_status(phydev); |
Oops, something went wrong.