mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-07-16 17:46:28 +00:00
Backport realtek phy driver changes for RTL8125D (#4014)
As pointed out in [1] by @cdce8p, the RTL8125D has an internal PHY that also needs some changes to be backported. Also, move the patches to more targeted directories is it would be otherwise applied to RPi 6.6 kernel with failures. We can move it back to the top-level patches directory once RPi moves to kernel 6.12. [1] https://github.com/home-assistant/operating-system/issues/3880#issuecomment-2790105503
This commit is contained in:
parent
7bc7f66e49
commit
7b3ce53ab2
@ -0,0 +1,143 @@
|
||||
From acc8d5ec4b6cdbf0a9625a9f9d3710b52555f3b2 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Tue, 15 Oct 2024 07:47:14 +0200
|
||||
Subject: [PATCH] net: phy: realtek: merge the drivers for internal NBase-T
|
||||
PHY's
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The Realtek RTL8125/RTL8126 NBase-T MAC/PHY chips have internal PHY's
|
||||
which are register-compatible, at least for the registers we use here.
|
||||
So let's use just one PHY driver to support all of them.
|
||||
These internal PHY's exist also as external C45 PHY's, but on the
|
||||
internal PHY's no access to MMD registers is possible. This can be
|
||||
used to differentiate between the internal and external version.
|
||||
|
||||
As a side effect the drivers for two now external-only drivers don't
|
||||
require read_mmd/write_mmd hooks any longer.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/c57081a6-811f-4571-ab35-34f4ca6de9af@gmail.com
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
Upstream: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f87a17ed3b51fba4dfdd8f8b643b5423a85fc551
|
||||
Signed-off-by: Jan Čermák <sairon@sairon.cz>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 53 +++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 43 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
|
||||
index 166f6a7283731..830a0d337de5d 100644
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -92,6 +92,7 @@
|
||||
|
||||
#define RTL_GENERIC_PHYID 0x001cc800
|
||||
#define RTL_8211FVD_PHYID 0x001cc878
|
||||
+#define RTL_8221B 0x001cc840
|
||||
#define RTL_8221B_VB_CG 0x001cc849
|
||||
#define RTL_8221B_VN_CG 0x001cc84a
|
||||
#define RTL_8251B 0x001cc862
|
||||
@@ -1040,6 +1041,23 @@ static bool rtlgen_supports_2_5gbps(struct phy_device *phydev)
|
||||
return val >= 0 && val & MDIO_PMA_SPEED_2_5G;
|
||||
}
|
||||
|
||||
+/* On internal PHY's MMD reads over C22 always return 0.
|
||||
+ * Check a MMD register which is known to be non-zero.
|
||||
+ */
|
||||
+static bool rtlgen_supports_mmd(struct phy_device *phydev)
|
||||
+{
|
||||
+ int val;
|
||||
+
|
||||
+ phy_lock_mdio_bus(phydev);
|
||||
+ __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS);
|
||||
+ __phy_write(phydev, MII_MMD_DATA, MDIO_PCS_EEE_ABLE);
|
||||
+ __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS | MII_MMD_CTRL_NOINCR);
|
||||
+ val = __phy_read(phydev, MII_MMD_DATA);
|
||||
+ phy_unlock_mdio_bus(phydev);
|
||||
+
|
||||
+ return val > 0;
|
||||
+}
|
||||
+
|
||||
static int rtlgen_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
return phydev->phy_id == RTL_GENERIC_PHYID &&
|
||||
@@ -1049,7 +1067,8 @@ static int rtlgen_match_phy_device(struct phy_device *phydev)
|
||||
static int rtl8226_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
return phydev->phy_id == RTL_GENERIC_PHYID &&
|
||||
- rtlgen_supports_2_5gbps(phydev);
|
||||
+ rtlgen_supports_2_5gbps(phydev) &&
|
||||
+ rtlgen_supports_mmd(phydev);
|
||||
}
|
||||
|
||||
static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id,
|
||||
@@ -1061,6 +1080,11 @@ static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id,
|
||||
return !is_c45 && (id == phydev->phy_id);
|
||||
}
|
||||
|
||||
+static int rtl8221b_match_phy_device(struct phy_device *phydev)
|
||||
+{
|
||||
+ return phydev->phy_id == RTL_8221B && rtlgen_supports_mmd(phydev);
|
||||
+}
|
||||
+
|
||||
static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, false);
|
||||
@@ -1081,9 +1105,21 @@ static int rtl8221b_vn_cg_c45_match_phy_device(struct phy_device *phydev)
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true);
|
||||
}
|
||||
|
||||
-static int rtl8251b_c22_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
- return rtlgen_is_c45_match(phydev, RTL_8251B, false);
|
||||
+ if (phydev->is_c45)
|
||||
+ return false;
|
||||
+
|
||||
+ switch (phydev->phy_id) {
|
||||
+ case RTL_GENERIC_PHYID:
|
||||
+ case RTL_8221B:
|
||||
+ case RTL_8251B:
|
||||
+ break;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return rtlgen_supports_2_5gbps(phydev) && !rtlgen_supports_mmd(phydev);
|
||||
}
|
||||
|
||||
static int rtl8251b_c45_match_phy_device(struct phy_device *phydev)
|
||||
@@ -1345,10 +1381,8 @@ static struct phy_driver realtek_drvs[] = {
|
||||
.resume = rtlgen_resume,
|
||||
.read_page = rtl821x_read_page,
|
||||
.write_page = rtl821x_write_page,
|
||||
- .read_mmd = rtl822x_read_mmd,
|
||||
- .write_mmd = rtl822x_write_mmd,
|
||||
}, {
|
||||
- PHY_ID_MATCH_EXACT(0x001cc840),
|
||||
+ .match_phy_device = rtl8221b_match_phy_device,
|
||||
.name = "RTL8226B_RTL8221B 2.5Gbps PHY",
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
@@ -1359,8 +1393,6 @@ static struct phy_driver realtek_drvs[] = {
|
||||
.resume = rtlgen_resume,
|
||||
.read_page = rtl821x_read_page,
|
||||
.write_page = rtl821x_write_page,
|
||||
- .read_mmd = rtl822x_read_mmd,
|
||||
- .write_mmd = rtl822x_write_mmd,
|
||||
}, {
|
||||
PHY_ID_MATCH_EXACT(0x001cc838),
|
||||
.name = "RTL8226-CG 2.5Gbps PHY",
|
||||
@@ -1438,8 +1470,9 @@ static struct phy_driver realtek_drvs[] = {
|
||||
.read_page = rtl821x_read_page,
|
||||
.write_page = rtl821x_write_page,
|
||||
}, {
|
||||
- .match_phy_device = rtl8251b_c22_match_phy_device,
|
||||
- .name = "RTL8126A-internal 5Gbps PHY",
|
||||
+ .match_phy_device = rtl_internal_nbaset_match_phy_device,
|
||||
+ .name = "Realtek Internal NBASE-T PHY",
|
||||
+ .flags = PHY_IS_INTERNAL,
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
.read_status = rtl822x_read_status,
|
@ -0,0 +1,36 @@
|
||||
From 7ab842c714924784cae4b6ab229997905b096b4f Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 17 Oct 2024 18:01:13 +0200
|
||||
Subject: [PATCH] net: phy: realtek: add RTL8125D-internal PHY
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The first boards show up with Realtek's RTL8125D. This MAC/PHY chip
|
||||
comes with an integrated 2.5Gbps PHY with ID 0x001cc841. It's not
|
||||
clear yet whether there's an external version of this PHY and how
|
||||
Realtek calls it, therefore use the numeric id for now.
|
||||
|
||||
Link: https://lore.kernel.org/netdev/2ada65e1-5dfa-456c-9334-2bc51272e9da@gmail.com/T/
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Message-ID: <7d2924de-053b-44d2-a479-870dc3878170@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Upstream: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8989bad541133c43550bff2b80edbe37b8fb9659
|
||||
Signed-off-by: Jan Čermák <sairon@sairon.cz>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
|
||||
index 830a0d337de5d..8ce5705af69c5 100644
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -1114,6 +1114,7 @@ static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev)
|
||||
case RTL_GENERIC_PHYID:
|
||||
case RTL_8221B:
|
||||
case RTL_8251B:
|
||||
+ case 0x001cc841:
|
||||
break;
|
||||
default:
|
||||
return false;
|
@ -0,0 +1,154 @@
|
||||
From f0fb974644a132ecc4bd2dc5cce9622435d0ec13 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 24 Oct 2024 22:42:33 +0200
|
||||
Subject: [PATCH] r8169: add support for RTL8125D
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This adds support for new chip version RTL8125D, which can be found on
|
||||
boards like Gigabyte X870E AORUS ELITE WIFI7. Firmware rtl8125d-1.fw
|
||||
for this chip version is available in linux-firmware already.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/d0306912-e88e-4c25-8b5d-545ae8834c0c@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
Upstream: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f75d1fbe7809bc5ed134204b920fd9e2fc5db1df
|
||||
Signed-off-by: Jan Čermák <sairon@sairon.cz>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169.h | 1 +
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 23 +++++++++++++------
|
||||
.../net/ethernet/realtek/r8169_phy_config.c | 10 ++++++++
|
||||
3 files changed, 27 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/ethernet/realtek/r8169.h b/drivers/net/ethernet/realtek/r8169.h
|
||||
index e2db944e6fa8b..be4c9622618d8 100644
|
||||
--- a/drivers/net/ethernet/realtek/r8169.h
|
||||
+++ b/drivers/net/ethernet/realtek/r8169.h
|
||||
@@ -68,6 +68,7 @@ enum mac_version {
|
||||
/* support for RTL_GIGA_MAC_VER_60 has been removed */
|
||||
RTL_GIGA_MAC_VER_61,
|
||||
RTL_GIGA_MAC_VER_63,
|
||||
+ RTL_GIGA_MAC_VER_64,
|
||||
RTL_GIGA_MAC_VER_65,
|
||||
RTL_GIGA_MAC_VER_66,
|
||||
RTL_GIGA_MAC_NONE
|
||||
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
index 5ed2818bac257..1cbde7ebd6f30 100644
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -55,6 +55,7 @@
|
||||
#define FIRMWARE_8107E_2 "rtl_nic/rtl8107e-2.fw"
|
||||
#define FIRMWARE_8125A_3 "rtl_nic/rtl8125a-3.fw"
|
||||
#define FIRMWARE_8125B_2 "rtl_nic/rtl8125b-2.fw"
|
||||
+#define FIRMWARE_8125D_1 "rtl_nic/rtl8125d-1.fw"
|
||||
#define FIRMWARE_8126A_2 "rtl_nic/rtl8126a-2.fw"
|
||||
#define FIRMWARE_8126A_3 "rtl_nic/rtl8126a-3.fw"
|
||||
|
||||
@@ -138,6 +139,7 @@ static const struct {
|
||||
[RTL_GIGA_MAC_VER_61] = {"RTL8125A", FIRMWARE_8125A_3},
|
||||
/* reserve 62 for CFG_METHOD_4 in the vendor driver */
|
||||
[RTL_GIGA_MAC_VER_63] = {"RTL8125B", FIRMWARE_8125B_2},
|
||||
+ [RTL_GIGA_MAC_VER_64] = {"RTL8125D", FIRMWARE_8125D_1},
|
||||
[RTL_GIGA_MAC_VER_65] = {"RTL8126A", FIRMWARE_8126A_2},
|
||||
[RTL_GIGA_MAC_VER_66] = {"RTL8126A", FIRMWARE_8126A_3},
|
||||
};
|
||||
@@ -707,6 +709,7 @@ MODULE_FIRMWARE(FIRMWARE_8168FP_3);
|
||||
MODULE_FIRMWARE(FIRMWARE_8107E_2);
|
||||
MODULE_FIRMWARE(FIRMWARE_8125A_3);
|
||||
MODULE_FIRMWARE(FIRMWARE_8125B_2);
|
||||
+MODULE_FIRMWARE(FIRMWARE_8125D_1);
|
||||
MODULE_FIRMWARE(FIRMWARE_8126A_2);
|
||||
MODULE_FIRMWARE(FIRMWARE_8126A_3);
|
||||
|
||||
@@ -2098,10 +2101,7 @@ static void rtl_set_eee_txidle_timer(struct rtl8169_private *tp)
|
||||
tp->tx_lpi_timer = timer_val;
|
||||
r8168_mac_ocp_write(tp, 0xe048, timer_val);
|
||||
break;
|
||||
- case RTL_GIGA_MAC_VER_61:
|
||||
- case RTL_GIGA_MAC_VER_63:
|
||||
- case RTL_GIGA_MAC_VER_65:
|
||||
- case RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66:
|
||||
tp->tx_lpi_timer = timer_val;
|
||||
RTL_W16(tp, EEE_TXIDLE_TIMER_8125, timer_val);
|
||||
break;
|
||||
@@ -2233,6 +2233,9 @@ static enum mac_version rtl8169_get_mac_version(u16 xid, bool gmii)
|
||||
{ 0x7cf, 0x64a, RTL_GIGA_MAC_VER_66 },
|
||||
{ 0x7cf, 0x649, RTL_GIGA_MAC_VER_65 },
|
||||
|
||||
+ /* 8125D family. */
|
||||
+ { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64 },
|
||||
+
|
||||
/* 8125B family. */
|
||||
{ 0x7cf, 0x641, RTL_GIGA_MAC_VER_63 },
|
||||
|
||||
@@ -2500,9 +2503,7 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp)
|
||||
case RTL_GIGA_MAC_VER_61:
|
||||
RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST);
|
||||
break;
|
||||
- case RTL_GIGA_MAC_VER_63:
|
||||
- case RTL_GIGA_MAC_VER_65:
|
||||
- case RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_66:
|
||||
RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST |
|
||||
RX_PAUSE_SLOT_ON);
|
||||
break;
|
||||
@@ -3814,6 +3815,12 @@ static void rtl_hw_start_8125b(struct rtl8169_private *tp)
|
||||
rtl_hw_start_8125_common(tp);
|
||||
}
|
||||
|
||||
+static void rtl_hw_start_8125d(struct rtl8169_private *tp)
|
||||
+{
|
||||
+ rtl_set_def_aspm_entry_latency(tp);
|
||||
+ rtl_hw_start_8125_common(tp);
|
||||
+}
|
||||
+
|
||||
static void rtl_hw_start_8126a(struct rtl8169_private *tp)
|
||||
{
|
||||
rtl_set_def_aspm_entry_latency(tp);
|
||||
@@ -3862,6 +3869,7 @@ static void rtl_hw_config(struct rtl8169_private *tp)
|
||||
[RTL_GIGA_MAC_VER_53] = rtl_hw_start_8117,
|
||||
[RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2,
|
||||
[RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b,
|
||||
+ [RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d,
|
||||
[RTL_GIGA_MAC_VER_65] = rtl_hw_start_8126a,
|
||||
[RTL_GIGA_MAC_VER_66] = rtl_hw_start_8126a,
|
||||
};
|
||||
@@ -3879,6 +3887,7 @@ static void rtl_hw_start_8125(struct rtl8169_private *tp)
|
||||
/* disable interrupt coalescing */
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_61:
|
||||
+ case RTL_GIGA_MAC_VER_64:
|
||||
for (i = 0xa00; i < 0xb00; i += 4)
|
||||
RTL_W32(tp, i, 0);
|
||||
break;
|
||||
diff --git a/drivers/net/ethernet/realtek/r8169_phy_config.c b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
index cf29b12084826..d09b2a41cd062 100644
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -1104,6 +1104,15 @@ static void rtl8125b_hw_phy_config(struct rtl8169_private *tp,
|
||||
rtl8125b_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
+static void rtl8125d_hw_phy_config(struct rtl8169_private *tp,
|
||||
+ struct phy_device *phydev)
|
||||
+{
|
||||
+ r8169_apply_firmware(tp);
|
||||
+ rtl8125_legacy_force_mode(phydev);
|
||||
+ rtl8168g_disable_aldps(phydev);
|
||||
+ rtl8125b_config_eee_phy(phydev);
|
||||
+}
|
||||
+
|
||||
static void rtl8126a_hw_phy_config(struct rtl8169_private *tp,
|
||||
struct phy_device *phydev)
|
||||
{
|
||||
@@ -1160,6 +1169,7 @@ void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev,
|
||||
[RTL_GIGA_MAC_VER_53] = rtl8117_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config,
|
||||
+ [RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_65] = rtl8126a_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_66] = rtl8126a_hw_phy_config,
|
||||
};
|
@ -0,0 +1,143 @@
|
||||
From acc8d5ec4b6cdbf0a9625a9f9d3710b52555f3b2 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Tue, 15 Oct 2024 07:47:14 +0200
|
||||
Subject: [PATCH] net: phy: realtek: merge the drivers for internal NBase-T
|
||||
PHY's
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The Realtek RTL8125/RTL8126 NBase-T MAC/PHY chips have internal PHY's
|
||||
which are register-compatible, at least for the registers we use here.
|
||||
So let's use just one PHY driver to support all of them.
|
||||
These internal PHY's exist also as external C45 PHY's, but on the
|
||||
internal PHY's no access to MMD registers is possible. This can be
|
||||
used to differentiate between the internal and external version.
|
||||
|
||||
As a side effect the drivers for two now external-only drivers don't
|
||||
require read_mmd/write_mmd hooks any longer.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/c57081a6-811f-4571-ab35-34f4ca6de9af@gmail.com
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
Upstream: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f87a17ed3b51fba4dfdd8f8b643b5423a85fc551
|
||||
Signed-off-by: Jan Čermák <sairon@sairon.cz>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 53 +++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 43 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
|
||||
index 166f6a7283731..830a0d337de5d 100644
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -92,6 +92,7 @@
|
||||
|
||||
#define RTL_GENERIC_PHYID 0x001cc800
|
||||
#define RTL_8211FVD_PHYID 0x001cc878
|
||||
+#define RTL_8221B 0x001cc840
|
||||
#define RTL_8221B_VB_CG 0x001cc849
|
||||
#define RTL_8221B_VN_CG 0x001cc84a
|
||||
#define RTL_8251B 0x001cc862
|
||||
@@ -1040,6 +1041,23 @@ static bool rtlgen_supports_2_5gbps(struct phy_device *phydev)
|
||||
return val >= 0 && val & MDIO_PMA_SPEED_2_5G;
|
||||
}
|
||||
|
||||
+/* On internal PHY's MMD reads over C22 always return 0.
|
||||
+ * Check a MMD register which is known to be non-zero.
|
||||
+ */
|
||||
+static bool rtlgen_supports_mmd(struct phy_device *phydev)
|
||||
+{
|
||||
+ int val;
|
||||
+
|
||||
+ phy_lock_mdio_bus(phydev);
|
||||
+ __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS);
|
||||
+ __phy_write(phydev, MII_MMD_DATA, MDIO_PCS_EEE_ABLE);
|
||||
+ __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS | MII_MMD_CTRL_NOINCR);
|
||||
+ val = __phy_read(phydev, MII_MMD_DATA);
|
||||
+ phy_unlock_mdio_bus(phydev);
|
||||
+
|
||||
+ return val > 0;
|
||||
+}
|
||||
+
|
||||
static int rtlgen_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
return phydev->phy_id == RTL_GENERIC_PHYID &&
|
||||
@@ -1049,7 +1067,8 @@ static int rtlgen_match_phy_device(struct phy_device *phydev)
|
||||
static int rtl8226_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
return phydev->phy_id == RTL_GENERIC_PHYID &&
|
||||
- rtlgen_supports_2_5gbps(phydev);
|
||||
+ rtlgen_supports_2_5gbps(phydev) &&
|
||||
+ rtlgen_supports_mmd(phydev);
|
||||
}
|
||||
|
||||
static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id,
|
||||
@@ -1061,6 +1080,11 @@ static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id,
|
||||
return !is_c45 && (id == phydev->phy_id);
|
||||
}
|
||||
|
||||
+static int rtl8221b_match_phy_device(struct phy_device *phydev)
|
||||
+{
|
||||
+ return phydev->phy_id == RTL_8221B && rtlgen_supports_mmd(phydev);
|
||||
+}
|
||||
+
|
||||
static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, false);
|
||||
@@ -1081,9 +1105,21 @@ static int rtl8221b_vn_cg_c45_match_phy_device(struct phy_device *phydev)
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true);
|
||||
}
|
||||
|
||||
-static int rtl8251b_c22_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
- return rtlgen_is_c45_match(phydev, RTL_8251B, false);
|
||||
+ if (phydev->is_c45)
|
||||
+ return false;
|
||||
+
|
||||
+ switch (phydev->phy_id) {
|
||||
+ case RTL_GENERIC_PHYID:
|
||||
+ case RTL_8221B:
|
||||
+ case RTL_8251B:
|
||||
+ break;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return rtlgen_supports_2_5gbps(phydev) && !rtlgen_supports_mmd(phydev);
|
||||
}
|
||||
|
||||
static int rtl8251b_c45_match_phy_device(struct phy_device *phydev)
|
||||
@@ -1345,10 +1381,8 @@ static struct phy_driver realtek_drvs[] = {
|
||||
.resume = rtlgen_resume,
|
||||
.read_page = rtl821x_read_page,
|
||||
.write_page = rtl821x_write_page,
|
||||
- .read_mmd = rtl822x_read_mmd,
|
||||
- .write_mmd = rtl822x_write_mmd,
|
||||
}, {
|
||||
- PHY_ID_MATCH_EXACT(0x001cc840),
|
||||
+ .match_phy_device = rtl8221b_match_phy_device,
|
||||
.name = "RTL8226B_RTL8221B 2.5Gbps PHY",
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
@@ -1359,8 +1393,6 @@ static struct phy_driver realtek_drvs[] = {
|
||||
.resume = rtlgen_resume,
|
||||
.read_page = rtl821x_read_page,
|
||||
.write_page = rtl821x_write_page,
|
||||
- .read_mmd = rtl822x_read_mmd,
|
||||
- .write_mmd = rtl822x_write_mmd,
|
||||
}, {
|
||||
PHY_ID_MATCH_EXACT(0x001cc838),
|
||||
.name = "RTL8226-CG 2.5Gbps PHY",
|
||||
@@ -1438,8 +1470,9 @@ static struct phy_driver realtek_drvs[] = {
|
||||
.read_page = rtl821x_read_page,
|
||||
.write_page = rtl821x_write_page,
|
||||
}, {
|
||||
- .match_phy_device = rtl8251b_c22_match_phy_device,
|
||||
- .name = "RTL8126A-internal 5Gbps PHY",
|
||||
+ .match_phy_device = rtl_internal_nbaset_match_phy_device,
|
||||
+ .name = "Realtek Internal NBASE-T PHY",
|
||||
+ .flags = PHY_IS_INTERNAL,
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
.read_status = rtl822x_read_status,
|
@ -0,0 +1,36 @@
|
||||
From 7ab842c714924784cae4b6ab229997905b096b4f Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 17 Oct 2024 18:01:13 +0200
|
||||
Subject: [PATCH] net: phy: realtek: add RTL8125D-internal PHY
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The first boards show up with Realtek's RTL8125D. This MAC/PHY chip
|
||||
comes with an integrated 2.5Gbps PHY with ID 0x001cc841. It's not
|
||||
clear yet whether there's an external version of this PHY and how
|
||||
Realtek calls it, therefore use the numeric id for now.
|
||||
|
||||
Link: https://lore.kernel.org/netdev/2ada65e1-5dfa-456c-9334-2bc51272e9da@gmail.com/T/
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Message-ID: <7d2924de-053b-44d2-a479-870dc3878170@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Upstream: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8989bad541133c43550bff2b80edbe37b8fb9659
|
||||
Signed-off-by: Jan Čermák <sairon@sairon.cz>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
|
||||
index 830a0d337de5d..8ce5705af69c5 100644
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -1114,6 +1114,7 @@ static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev)
|
||||
case RTL_GENERIC_PHYID:
|
||||
case RTL_8221B:
|
||||
case RTL_8251B:
|
||||
+ case 0x001cc841:
|
||||
break;
|
||||
default:
|
||||
return false;
|
@ -4,7 +4,7 @@ BR2_DL_DIR="/cache/dl"
|
||||
BR2_CCACHE=y
|
||||
BR2_CCACHE_DIR="/cache/cc"
|
||||
BR2_ENABLE_LTO=y
|
||||
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_HASSOS_PATH)/patches"
|
||||
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_HASSOS_PATH)/patches $(BR2_EXTERNAL_HASSOS_PATH)/board/arm-uefi/generic-aarch64/patches"
|
||||
BR2_SSP_REGULAR=y
|
||||
BR2_TARGET_GENERIC_HOSTNAME="homeassistant"
|
||||
BR2_TARGET_GENERIC_ISSUE="Welcome to Home Assistant"
|
||||
|
@ -4,7 +4,7 @@ BR2_DL_DIR="/cache/dl"
|
||||
BR2_CCACHE=y
|
||||
BR2_CCACHE_DIR="/cache/cc"
|
||||
BR2_ENABLE_LTO=y
|
||||
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_HASSOS_PATH)/patches"
|
||||
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_HASSOS_PATH)/patches $(BR2_EXTERNAL_HASSOS_PATH)/board/pc/patches"
|
||||
BR2_SSP_REGULAR=y
|
||||
BR2_TARGET_GENERIC_HOSTNAME="homeassistant"
|
||||
BR2_TARGET_GENERIC_ISSUE="Welcome to Home Assistant"
|
||||
|
@ -4,7 +4,7 @@ BR2_DL_DIR="/cache/dl"
|
||||
BR2_CCACHE=y
|
||||
BR2_CCACHE_DIR="/cache/cc"
|
||||
BR2_ENABLE_LTO=y
|
||||
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_HASSOS_PATH)/patches"
|
||||
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_HASSOS_PATH)/patches $(BR2_EXTERNAL_HASSOS_PATH)/board/pc/patches"
|
||||
BR2_SSP_REGULAR=y
|
||||
BR2_TARGET_GENERIC_HOSTNAME="homeassistant"
|
||||
BR2_TARGET_GENERIC_ISSUE="Welcome to Home Assistant"
|
||||
|
Loading…
x
Reference in New Issue
Block a user