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 patch
- Fix setting of PHY LEDs Mode B bit on RTL8211F. - Rename pending Realtek PHY patches. Signed-off-by: Álvaro Fernández Rojas <[email protected]>
- Loading branch information
Showing
9 changed files
with
68 additions
and
26 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...eric/backport-6.6/781-12-v6.11-net-phy-realtek-Fix-setting-of-PHY-LEDs-Mode-B-bit-o.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 a2f5c505b4378cd6fc7c4a44ff3665ccef2037db Mon Sep 17 00:00:00 2001 | ||
From: Sava Jakovljev <[email protected]> | ||
Date: Wed, 21 Aug 2024 04:16:57 +0200 | ||
Subject: [PATCH] net: phy: realtek: Fix setting of PHY LEDs Mode B bit on | ||
RTL8211F | ||
|
||
The current implementation incorrectly sets the mode bit of the PHY chip. | ||
Bit 15 (RTL8211F_LEDCR_MODE) should not be shifted together with the | ||
configuration nibble of a LED- it should be set independently of the | ||
index of the LED being configured. | ||
As a consequence, the RTL8211F LED control is actually operating in Mode A. | ||
Fix the error by or-ing final register value to write with a const-value of | ||
RTL8211F_LEDCR_MODE, thus setting Mode bit explicitly. | ||
|
||
Fixes: 17784801d888 ("net: phy: realtek: Add support for PHY LEDs on RTL8211F") | ||
Signed-off-by: Sava Jakovljev <[email protected]> | ||
Reviewed-by: Marek Vasut <[email protected]> | ||
Link: https://patch.msgid.link/PAWP192MB21287372F30C4E55B6DF6158C38E2@PAWP192MB2128.EURP192.PROD.OUTLOOK.COM | ||
Signed-off-by: Paolo Abeni <[email protected]> | ||
--- | ||
drivers/net/phy/realtek.c | 3 ++- | ||
1 file changed, 2 insertions(+), 1 deletion(-) | ||
|
||
--- a/drivers/net/phy/realtek.c | ||
+++ b/drivers/net/phy/realtek.c | ||
@@ -555,7 +555,7 @@ static int rtl8211f_led_hw_control_set(s | ||
unsigned long rules) | ||
{ | ||
const u16 mask = RTL8211F_LEDCR_MASK << (RTL8211F_LEDCR_SHIFT * index); | ||
- u16 reg = RTL8211F_LEDCR_MODE; /* Mode B */ | ||
+ u16 reg = 0; | ||
|
||
if (index >= RTL8211F_LED_COUNT) | ||
return -EINVAL; | ||
@@ -575,6 +575,7 @@ static int rtl8211f_led_hw_control_set(s | ||
} | ||
|
||
reg <<= RTL8211F_LEDCR_SHIFT * index; | ||
+ reg |= RTL8211F_LEDCR_MODE; /* Mode B */ | ||
|
||
return phy_modify_paged(phydev, 0xd04, RTL8211F_LEDCR, mask, reg); | ||
} |
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 |
---|---|---|
|
@@ -15,63 +15,63 @@ Signed-off-by: Daniel Golle <[email protected]> | |
|
||
--- a/drivers/net/phy/realtek.c | ||
+++ b/drivers/net/phy/realtek.c | ||
@@ -1324,6 +1324,7 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1325,6 +1325,7 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
.name = "RTL8226 2.5Gbps PHY", | ||
.match_phy_device = rtl8226_match_phy_device, | ||
+ .soft_reset = genphy_soft_reset, | ||
.get_features = rtl822x_get_features, | ||
.config_aneg = rtl822x_config_aneg, | ||
.read_status = rtl822x_read_status, | ||
@@ -1336,6 +1337,7 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1337,6 +1338,7 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
PHY_ID_MATCH_EXACT(0x001cc840), | ||
.name = "RTL8226B_RTL8221B 2.5Gbps PHY", | ||
+ .soft_reset = genphy_soft_reset, | ||
.get_features = rtl822x_get_features, | ||
.config_aneg = rtl822x_config_aneg, | ||
.config_init = rtl822xb_config_init, | ||
@@ -1350,6 +1352,7 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1351,6 +1353,7 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
PHY_ID_MATCH_EXACT(0x001cc838), | ||
.name = "RTL8226-CG 2.5Gbps PHY", | ||
+ .soft_reset = genphy_soft_reset, | ||
.get_features = rtl822x_get_features, | ||
.config_aneg = rtl822x_config_aneg, | ||
.read_status = rtl822x_read_status, | ||
@@ -1360,6 +1363,7 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1361,6 +1364,7 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
PHY_ID_MATCH_EXACT(0x001cc848), | ||
.name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", | ||
+ .soft_reset = genphy_soft_reset, | ||
.get_features = rtl822x_get_features, | ||
.config_aneg = rtl822x_config_aneg, | ||
.config_init = rtl822xb_config_init, | ||
@@ -1372,6 +1376,7 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1373,6 +1377,7 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
.match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, | ||
.name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", | ||
+ .soft_reset = genphy_soft_reset, | ||
.get_features = rtl822x_get_features, | ||
.config_aneg = rtl822x_config_aneg, | ||
.config_init = rtl822xb_config_init, | ||
@@ -1384,6 +1389,7 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1385,6 +1390,7 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
.match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, | ||
.name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", | ||
+ .soft_reset = genphy_soft_reset, | ||
.config_init = rtl822xb_config_init, | ||
.get_rate_matching = rtl822xb_get_rate_matching, | ||
.get_features = rtl822x_c45_get_features, | ||
@@ -1394,6 +1400,7 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1395,6 +1401,7 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
.match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, | ||
.name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", | ||
+ .soft_reset = genphy_soft_reset, | ||
.get_features = rtl822x_get_features, | ||
.config_aneg = rtl822x_config_aneg, | ||
.config_init = rtl822xb_config_init, | ||
@@ -1406,6 +1413,7 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1407,6 +1414,7 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
.match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, | ||
.name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", | ||
|
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 |
---|---|---|
|
@@ -19,7 +19,7 @@ Signed-off-by: Daniel Golle <[email protected]> | |
|
||
--- a/drivers/net/phy/realtek.c | ||
+++ b/drivers/net/phy/realtek.c | ||
@@ -785,8 +785,8 @@ static int rtl822x_write_mmd(struct phy_ | ||
@@ -786,8 +786,8 @@ static int rtl822x_write_mmd(struct phy_ | ||
static int rtl822xb_config_init(struct phy_device *phydev) | ||
{ | ||
bool has_2500, has_sgmii; | ||
|
@@ -29,7 +29,7 @@ Signed-off-by: Daniel Golle <[email protected]> | |
|
||
has_2500 = test_bit(PHY_INTERFACE_MODE_2500BASEX, | ||
phydev->host_interfaces) || | ||
@@ -836,7 +836,29 @@ static int rtl822xb_config_init(struct p | ||
@@ -837,7 +837,29 @@ static int rtl822xb_config_init(struct p | ||
if (ret < 0) | ||
return ret; | ||
|
||
|
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ Signed-off-by: Daniel Golle <[email protected]> | |
|
||
--- a/drivers/net/phy/realtek.c | ||
+++ b/drivers/net/phy/realtek.c | ||
@@ -1051,9 +1051,11 @@ static bool rtlgen_supports_2_5gbps(stru | ||
@@ -1052,9 +1052,11 @@ static bool rtlgen_supports_2_5gbps(stru | ||
{ | ||
int val; | ||
|
||
|
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ Signed-off-by: Daniel Golle <[email protected]> | |
|
||
--- a/drivers/net/phy/realtek.c | ||
+++ b/drivers/net/phy/realtek.c | ||
@@ -909,7 +909,8 @@ static int rtl822x_config_aneg(struct ph | ||
@@ -910,7 +910,8 @@ static int rtl822x_config_aneg(struct ph | ||
|
||
ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12, | ||
MDIO_AN_10GBT_CTRL_ADV2_5G | | ||
|
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 |
---|---|---|
|
@@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle <[email protected]> | |
|
||
--- a/drivers/net/phy/realtek.c | ||
+++ b/drivers/net/phy/realtek.c | ||
@@ -949,6 +949,10 @@ static int rtl822x_read_status(struct ph | ||
@@ -950,6 +950,10 @@ static int rtl822x_read_status(struct ph | ||
if (lpadv < 0) | ||
return lpadv; | ||
|
||
|
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 |
---|---|---|
|
@@ -24,7 +24,7 @@ Signed-off-by: Daniel Golle <[email protected]> | |
#define RTL8366RB_POWER_SAVE 0x15 | ||
#define RTL8366RB_POWER_SAVE_ON BIT(12) | ||
|
||
@@ -1106,6 +1110,25 @@ static int rtl8221b_vn_cg_c45_match_phy_ | ||
@@ -1107,6 +1111,25 @@ static int rtl8221b_vn_cg_c45_match_phy_ | ||
return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true); | ||
} | ||
|
||
|
@@ -50,47 +50,47 @@ Signed-off-by: Daniel Golle <[email protected]> | |
static int rtlgen_resume(struct phy_device *phydev) | ||
{ | ||
int ret = genphy_resume(phydev); | ||
@@ -1381,6 +1404,7 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1382,6 +1405,7 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
PHY_ID_MATCH_EXACT(0x001cc838), | ||
.name = "RTL8226-CG 2.5Gbps PHY", | ||
+ .probe = rtl822x_probe, | ||
.soft_reset = genphy_soft_reset, | ||
.get_features = rtl822x_get_features, | ||
.config_aneg = rtl822x_config_aneg, | ||
@@ -1392,6 +1416,7 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1393,6 +1417,7 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
PHY_ID_MATCH_EXACT(0x001cc848), | ||
.name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", | ||
+ .probe = rtl822x_probe, | ||
.soft_reset = genphy_soft_reset, | ||
.get_features = rtl822x_get_features, | ||
.config_aneg = rtl822x_config_aneg, | ||
@@ -1405,6 +1430,7 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1406,6 +1431,7 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
.match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, | ||
.name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", | ||
+ .probe = rtl822x_probe, | ||
.soft_reset = genphy_soft_reset, | ||
.get_features = rtl822x_get_features, | ||
.config_aneg = rtl822x_config_aneg, | ||
@@ -1418,6 +1444,7 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1419,6 +1445,7 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
.match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, | ||
.name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", | ||
+ .probe = rtl822x_probe, | ||
.soft_reset = genphy_soft_reset, | ||
.config_init = rtl822xb_config_init, | ||
.get_rate_matching = rtl822xb_get_rate_matching, | ||
@@ -1429,6 +1456,7 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1430,6 +1457,7 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
.match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, | ||
.name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", | ||
+ .probe = rtl822x_probe, | ||
.soft_reset = genphy_soft_reset, | ||
.get_features = rtl822x_get_features, | ||
.config_aneg = rtl822x_config_aneg, | ||
@@ -1442,6 +1470,7 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1443,6 +1471,7 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
.match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, | ||
.name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", | ||
|
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ Signed-off-by: Daniel Golle <[email protected]> | |
Signed-off-by: Mieczyslaw Nalewaj <[email protected]> | ||
--- a/drivers/net/phy/realtek.c | ||
+++ b/drivers/net/phy/realtek.c | ||
@@ -1084,10 +1084,32 @@ static int rtl8226_match_phy_device(stru | ||
@@ -1085,10 +1085,32 @@ static int rtl8226_match_phy_device(stru | ||
static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id, | ||
bool is_c45) | ||
{ | ||
|
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 |
---|---|---|
|
@@ -12,7 +12,7 @@ Signed-off-by: Jianhui Zhao <[email protected]> | |
|
||
--- a/drivers/net/phy/realtek.c | ||
+++ b/drivers/net/phy/realtek.c | ||
@@ -1264,6 +1264,51 @@ static irqreturn_t rtl9000a_handle_inter | ||
@@ -1287,6 +1287,51 @@ static irqreturn_t rtl9000a_handle_inter | ||
return IRQ_HANDLED; | ||
} | ||
|
||
|
@@ -64,7 +64,7 @@ Signed-off-by: Jianhui Zhao <[email protected]> | |
static struct phy_driver realtek_drvs[] = { | ||
{ | ||
PHY_ID_MATCH_EXACT(0x00008201), | ||
@@ -1430,6 +1475,8 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1453,6 +1498,8 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
.match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, | ||
.name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", | ||
|
@@ -73,7 +73,7 @@ Signed-off-by: Jianhui Zhao <[email protected]> | |
.probe = rtl822x_probe, | ||
.soft_reset = genphy_soft_reset, | ||
.get_features = rtl822x_get_features, | ||
@@ -1444,6 +1491,8 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1467,6 +1514,8 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
.match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, | ||
.name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", | ||
|
@@ -82,7 +82,7 @@ Signed-off-by: Jianhui Zhao <[email protected]> | |
.probe = rtl822x_probe, | ||
.soft_reset = genphy_soft_reset, | ||
.config_init = rtl822xb_config_init, | ||
@@ -1456,6 +1505,8 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1479,6 +1528,8 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
.match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, | ||
.name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", | ||
|
@@ -91,7 +91,7 @@ Signed-off-by: Jianhui Zhao <[email protected]> | |
.probe = rtl822x_probe, | ||
.soft_reset = genphy_soft_reset, | ||
.get_features = rtl822x_get_features, | ||
@@ -1470,6 +1521,8 @@ static struct phy_driver realtek_drvs[] | ||
@@ -1493,6 +1544,8 @@ static struct phy_driver realtek_drvs[] | ||
}, { | ||
.match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, | ||
.name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", | ||
|