mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-22 01:56:51 +00:00
generic: 6.6: fix realtek PHY detection patch
Fixes the issue of RTL8221B-VB-CG not being detected correctly. Reverts changes from f6c27b2, leaving only the read_c45 test. Fixed: #15093 Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
This commit is contained in:
parent
4f87a4d84f
commit
76584c798a
@ -1,4 +1,4 @@
|
|||||||
From e52faf1564a8bcaf866f9a6c7bf0e8a8748afb15 Mon Sep 17 00:00:00 2001
|
From 0de82310d2b32e78ff79d42c08b1122a6ede3778 Mon Sep 17 00:00:00 2001
|
||||||
From: Daniel Golle <daniel@makrotopia.org>
|
From: Daniel Golle <daniel@makrotopia.org>
|
||||||
Date: Sun, 30 Apr 2023 00:15:41 +0100
|
Date: Sun, 30 Apr 2023 00:15:41 +0100
|
||||||
Subject: [PATCH] net: phy: realtek: detect early version of RTL8221B
|
Subject: [PATCH] net: phy: realtek: detect early version of RTL8221B
|
||||||
@ -10,9 +10,6 @@ Implement custom identify function using the PKGID instead of iterating
|
|||||||
over the implemented MMDs.
|
over the implemented MMDs.
|
||||||
|
|
||||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||||
---
|
|
||||||
drivers/net/phy/realtek.c | 50 ++++++++++++++++++++++++++++++++++++++-
|
|
||||||
1 file changed, 49 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
--- a/drivers/net/phy/realtek.c
|
--- a/drivers/net/phy/realtek.c
|
||||||
+++ b/drivers/net/phy/realtek.c
|
+++ b/drivers/net/phy/realtek.c
|
||||||
@ -20,12 +17,12 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
|
|
||||||
#define RTL_GENERIC_PHYID 0x001cc800
|
#define RTL_GENERIC_PHYID 0x001cc800
|
||||||
#define RTL_8211FVD_PHYID 0x001cc878
|
#define RTL_8211FVD_PHYID 0x001cc878
|
||||||
+#define RTL_8221B_VB_CG 0x001cc849
|
+#define RTL_8221B_VB_CG_PHYID 0x001cc849
|
||||||
|
|
||||||
MODULE_DESCRIPTION("Realtek PHY driver");
|
MODULE_DESCRIPTION("Realtek PHY driver");
|
||||||
MODULE_AUTHOR("Johnson Leung");
|
MODULE_AUTHOR("Johnson Leung");
|
||||||
@@ -801,6 +802,54 @@ static int rtl822x_probe(struct phy_devi
|
@@ -782,6 +783,38 @@ static int rtl8226_match_phy_device(stru
|
||||||
return 0;
|
rtlgen_supports_2_5gbps(phydev);
|
||||||
}
|
}
|
||||||
|
|
||||||
+static int rtl8221b_vb_cg_match_phy_device(struct phy_device *phydev)
|
+static int rtl8221b_vb_cg_match_phy_device(struct phy_device *phydev)
|
||||||
@ -33,14 +30,6 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
+ int val;
|
+ int val;
|
||||||
+ u32 id;
|
+ u32 id;
|
||||||
+
|
+
|
||||||
+ if (phydev->is_c45) {
|
|
||||||
+ if (phydev->c45_ids.device_ids[1])
|
|
||||||
+ return phydev->c45_ids.device_ids[1] == RTL_8221B_VB_CG;
|
|
||||||
+ } else {
|
|
||||||
+ if (phydev->phy_id)
|
|
||||||
+ return phydev->phy_id == RTL_8221B_VB_CG;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (phydev->mdio.bus->read_c45) {
|
+ if (phydev->mdio.bus->read_c45) {
|
||||||
+ val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PKGID1);
|
+ val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PKGID1);
|
||||||
+ if (val < 0)
|
+ if (val < 0)
|
||||||
@ -65,21 +54,13 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
+ id |= val;
|
+ id |= val;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (id != RTL_8221B_VB_CG)
|
+ return (id == RTL_8221B_VB_CG_PHYID);
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ if (phydev->is_c45)
|
|
||||||
+ phydev->c45_ids.device_ids[1] = id;
|
|
||||||
+ else
|
|
||||||
+ phydev->phy_id = id;
|
|
||||||
+
|
|
||||||
+ return 1;
|
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
static int rtlgen_resume(struct phy_device *phydev)
|
static int rtl822x_probe(struct phy_device *phydev)
|
||||||
{
|
{
|
||||||
int ret = genphy_resume(phydev);
|
struct device *dev = &phydev->mdio.dev;
|
||||||
@@ -1134,7 +1183,7 @@ static struct phy_driver realtek_drvs[]
|
@@ -1134,7 +1167,7 @@ static struct phy_driver realtek_drvs[]
|
||||||
.write_page = rtl821x_write_page,
|
.write_page = rtl821x_write_page,
|
||||||
.soft_reset = genphy_soft_reset,
|
.soft_reset = genphy_soft_reset,
|
||||||
}, {
|
}, {
|
||||||
|
@ -12,7 +12,7 @@ Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
|
|||||||
|
|
||||||
--- a/drivers/net/phy/realtek.c
|
--- a/drivers/net/phy/realtek.c
|
||||||
+++ b/drivers/net/phy/realtek.c
|
+++ b/drivers/net/phy/realtek.c
|
||||||
@@ -1026,6 +1026,51 @@ static int rtl8221b_config_init(struct p
|
@@ -1010,6 +1010,51 @@ static int rtl8221b_config_init(struct p
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
|
|||||||
static struct phy_driver realtek_drvs[] = {
|
static struct phy_driver realtek_drvs[] = {
|
||||||
{
|
{
|
||||||
PHY_ID_MATCH_EXACT(0x00008201),
|
PHY_ID_MATCH_EXACT(0x00008201),
|
||||||
@@ -1188,6 +1233,8 @@ static struct phy_driver realtek_drvs[]
|
@@ -1172,6 +1217,8 @@ static struct phy_driver realtek_drvs[]
|
||||||
.get_features = rtl822x_get_features,
|
.get_features = rtl822x_get_features,
|
||||||
.config_init = rtl8221b_config_init,
|
.config_init = rtl8221b_config_init,
|
||||||
.config_aneg = rtl822x_config_aneg,
|
.config_aneg = rtl822x_config_aneg,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user