[openwrt/openwrt] realtek: add support for RTL8218E

LEDE Commits lede-commits at lists.infradead.org
Sun Sep 21 16:16:00 PDT 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/c8c187f0f08a7660b0f66fd624c04e44fb8f8f6f

commit c8c187f0f08a7660b0f66fd624c04e44fb8f8f6f
Author: Thomas Martitz <thomas.martitz at mailbox.org>
AuthorDate: Thu Sep 18 09:09:04 2025 +0200

    realtek: add support for RTL8218E
    
    ZyXEL XGS1250-12 Rev.B1 has RTL8218E compared to RTL8218D in Rev.A1
    but both of them seem very similar and pin compatible. Therefore
    they can share the same phy_driver callbacks.
    
    PHY identifier is set based on the datasheet from
      https://github.com/plappermaul/realtek-doc/blob/main/RTL8218E-CG_Datasheet.pdf
    
    Before:
    
    [    2.120161] rtl83xx-switch switch at 1b000000 lan1 (uninitialized): PHY [mdio-bus:00] driver [Generic PHY] (irq=POLL)
    [    2.134581] rtl83xx-switch switch at 1b000000 lan2 (uninitialized): PHY [mdio-bus:01] driver [Generic PHY] (irq=POLL)
    [    2.149043] rtl83xx-switch switch at 1b000000 lan3 (uninitialized): PHY [mdio-bus:02] driver [Generic PHY] (irq=POLL)
    [    2.163498] rtl83xx-switch switch at 1b000000 lan4 (uninitialized): PHY [mdio-bus:03] driver [Generic PHY] (irq=POLL)
    [    2.177963] rtl83xx-switch switch at 1b000000 lan5 (uninitialized): PHY [mdio-bus:04] driver [Generic PHY] (irq=POLL)
    [    2.192435] rtl83xx-switch switch at 1b000000 lan6 (uninitialized): PHY [mdio-bus:05] driver [Generic PHY] (irq=POLL)
    [    2.207009] rtl83xx-switch switch at 1b000000 lan7 (uninitialized): PHY [mdio-bus:06] driver [Generic PHY] (irq=POLL)
    [    2.221474] rtl83xx-switch switch at 1b000000 lan8 (uninitialized): PHY [mdio-bus:07] driver [Generic PHY] (irq=POLL)
    
    After:
    
    [    2.119165] rtl83xx-switch switch at 1b000000 lan1 (uninitialized): PHY [mdio-bus:00] driver [REALTEK RTL8218E] (irq=POLL)
    [    2.132880] rtl83xx-switch switch at 1b000000 lan2 (uninitialized): PHY [mdio-bus:01] driver [REALTEK RTL8218E] (irq=POLL)
    [    2.146727] rtl83xx-switch switch at 1b000000 lan3 (uninitialized): PHY [mdio-bus:02] driver [REALTEK RTL8218E] (irq=POLL)
    [    2.160580] rtl83xx-switch switch at 1b000000 lan4 (uninitialized): PHY [mdio-bus:03] driver [REALTEK RTL8218E] (irq=POLL)
    [    2.174367] rtl83xx-switch switch at 1b000000 lan5 (uninitialized): PHY [mdio-bus:04] driver [REALTEK RTL8218E] (irq=POLL)
    [    2.188270] rtl83xx-switch switch at 1b000000 lan6 (uninitialized): PHY [mdio-bus:05] driver [REALTEK RTL8218E] (irq=POLL)
    [    2.202140] rtl83xx-switch switch at 1b000000 lan7 (uninitialized): PHY [mdio-bus:06] driver [REALTEK RTL8218E] (irq=POLL)
    [    2.216047] rtl83xx-switch switch at 1b000000 lan8 (uninitialized): PHY [mdio-bus:07] driver [REALTEK RTL8218E] (irq=POLL)
    
    Based-on-patch-by: Antanas Bruzas <antanas.bruzas at protonmail.com>
    Signed-off-by: Thomas Martitz <thomas.martitz at mailbox.org>
    Link: https://github.com/openwrt/openwrt/pull/20068
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 .../realtek/files-6.12/drivers/net/phy/rtl83xx-phy.c    | 17 +++++++++++++++--
 .../realtek/files-6.12/drivers/net/phy/rtl83xx-phy.h    |  1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.c b/target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.c
index e083654cd4..9ea73e6fa1 100644
--- a/target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.c
+++ b/target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.c
@@ -3263,7 +3263,7 @@ static int rtl8218b_int_phy_probe(struct phy_device *phydev)
 	return 0;
 }
 
-static int rtl8218d_phy_probe(struct phy_device *phydev)
+static int rtl8218x_phy_probe(struct phy_device *phydev)
 {
 	int base_addr = phydev->mdio.addr & ~7;
 
@@ -3445,7 +3445,20 @@ static struct phy_driver rtl83xx_phy_driver[] = {
 		.name		= "REALTEK RTL8218D",
 		.config_init	= rtl821x_config_init,
 		.features	= PHY_GBIT_FEATURES,
-		.probe		= rtl8218d_phy_probe,
+		.probe		= rtl8218x_phy_probe,
+		.read_mmd	= rtl821x_read_mmd,
+		.read_page	= rtl821x_read_page,
+		.resume		= genphy_resume,
+		.suspend	= genphy_suspend,
+		.write_mmd	= rtl821x_write_mmd,
+		.write_page	= rtl821x_write_page,
+	},
+	{
+		PHY_ID_MATCH_EXACT(PHY_ID_RTL8218E),
+		.name		= "REALTEK RTL8218E",
+		.config_init	= rtl821x_config_init,
+		.features	= PHY_GBIT_FEATURES,
+		.probe		= rtl8218x_phy_probe,
 		.read_mmd	= rtl821x_read_mmd,
 		.read_page	= rtl821x_read_page,
 		.resume		= genphy_resume,
diff --git a/target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.h b/target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.h
index d054b9bd9a..81ef182e42 100644
--- a/target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.h
+++ b/target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.h
@@ -23,6 +23,7 @@ struct __attribute__ ((__packed__)) fw_header {
 #define PHY_ID_RTL8218B_E			0x001cc980
 #define PHY_ID_RTL8214_OR_8218			0x001cc981
 #define PHY_ID_RTL8218D				0x001cc983
+#define PHY_ID_RTL8218E				0x001cc984
 #define PHY_ID_RTL8218B_I			0x001cca40
 #define PHY_ID_RTL8390_GENERIC			0x001ccab0
 #define PHY_ID_RTL8393_I			0x001c8393




More information about the lede-commits mailing list