* [PATCH net-next 0/2] net: phy: realtek: add the mass production RTL8251B @ 2026-12-01 20:31 John-Michael Mulesa 2026-12-01 20:31 ` [PATCH net-next 1/2] net: phy: realtek: rename the 0x001cc862 PHY to RTL8251BE John-Michael Mulesa 2026-12-01 20:31 ` [PATCH net-next 2/2] net: phy: realtek: add support for the RTL8251B 5Gbps PHY John-Michael Mulesa 0 siblings, 2 replies; 4+ messages in thread From: John-Michael Mulesa @ 2026-12-01 20:31 UTC (permalink / raw) To: netdev Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Markus Stockhausen, John-Michael Mulesa The driver matches the PHY ID 0x001cc862 as the RTL8251B. Realtek's SDK driver names that ID RTL8251BE, an engineering sample, and gives the mass production RTL8251B the ID 0x001cc86a. Patch 1 renames the existing driver to RTL8251BE, patch 2 adds the production RTL8251B as a Clause 45 PHY. Tested on a Sirivision SR-S5G3008 (RTL9303 switch with eight RTL8251B) running OpenWrt's 6.18 kernel with both patches backported unchanged: all eight PHYs report 0x001cc86a in MMD 1 and bind to the new driver. On the connected port the link came up at 5 Gbit/s, and at 2.5 and 1 Gbit/s with the advertisement limited through ethtool, and passed traffic at each speed. I have no hardware reporting 0x001cc862, so the rename itself is only build-tested (W=1). Both patches were written with the help of an AI coding assistant (Claude, claude-opus-5-5), which also compared the IDs against Realtek's SDK driver and drafted the changelogs. I reviewed and tested the result. John-Michael Mulesa (2): net: phy: realtek: rename the 0x001cc862 PHY to RTL8251BE net: phy: realtek: add support for the RTL8251B 5Gbps PHY drivers/net/phy/realtek/realtek_main.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) -- 2.56.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 1/2] net: phy: realtek: rename the 0x001cc862 PHY to RTL8251BE 2026-12-01 20:31 [PATCH net-next 0/2] net: phy: realtek: add the mass production RTL8251B John-Michael Mulesa @ 2026-12-01 20:31 ` John-Michael Mulesa 2026-12-01 20:31 ` [PATCH net-next 2/2] net: phy: realtek: add support for the RTL8251B 5Gbps PHY John-Michael Mulesa 1 sibling, 0 replies; 4+ messages in thread From: John-Michael Mulesa @ 2026-12-01 20:31 UTC (permalink / raw) To: netdev Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Markus Stockhausen, John-Michael Mulesa Commit 5befa3728b85 ("net: phy: realtek: add support for RTL8126A-integrated 5Gbps PHY") added the stand-alone PHY with ID 0x001cc862 as the RTL8251B. Realtek's own PHY driver, as shipped in their SDK, names this ID RTL8251BE and marks it as an engineering sample. The mass production RTL8251B reports 0x001cc86a instead. Rename the define, the Clause 45 match function and the driver to RTL8251BE, so that the RTL8251B name is free for the production part. The RTL8126A-integrated PHY reports the same ID and is still matched by the internal NBASE-T driver. Apart from the driver name, there is no functional change. The code and this changelog were drafted with the help of an AI coding assistant (Claude, claude-opus-5-5). Suggested-by: Markus Stockhausen <markus.stockhausen@gmx.de> Signed-off-by: John-Michael Mulesa <jmulesa@gmail.com> --- drivers/net/phy/realtek/realtek_main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c index a39ad1838..ece327d3c 100644 --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c @@ -264,7 +264,7 @@ #define RTL_8221B 0x001cc840 #define RTL_8221B_VB_CG 0x001cc849 #define RTL_8221B_VM_CG 0x001cc84a -#define RTL_8251B 0x001cc862 +#define RTL_8251BE 0x001cc862 #define RTL_8261C 0x001cc890 #define RTL_8261C_CG 0x001cc898 #define RTL_8261CE_CG 0x001cc899 @@ -2907,7 +2907,7 @@ static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev, switch (phydev->phy_id) { case RTL_GENERIC_PHYID: case RTL_8221B: - case RTL_8251B: + case RTL_8251BE: case RTL_8261C: case 0x001cc841: break; @@ -2918,10 +2918,10 @@ static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev, return rtlgen_supports_2_5gbps(phydev) && !rtlgen_supports_mmd(phydev); } -static int rtl8251b_c45_match_phy_device(struct phy_device *phydev, - const struct phy_driver *phydrv) +static int rtl8251be_c45_match_phy_device(struct phy_device *phydev, + const struct phy_driver *phydrv) { - return rtlgen_is_c45_match(phydev, RTL_8251B, true); + return rtlgen_is_c45_match(phydev, RTL_8251BE, true); } static int rtlgen_resume(struct phy_device *phydev) @@ -3399,8 +3399,8 @@ static struct phy_driver realtek_drvs[] = { .led_hw_control_get = rtl822xb_led_hw_control_get, .led_hw_control_set = rtl822xb_led_hw_control_set, }, { - .match_phy_device = rtl8251b_c45_match_phy_device, - .name = "RTL8251B 5Gbps PHY", + .match_phy_device = rtl8251be_c45_match_phy_device, + .name = "RTL8251BE 5Gbps PHY", .probe = rtl822x_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -- 2.56.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net-next 2/2] net: phy: realtek: add support for the RTL8251B 5Gbps PHY 2026-12-01 20:31 [PATCH net-next 0/2] net: phy: realtek: add the mass production RTL8251B John-Michael Mulesa 2026-12-01 20:31 ` [PATCH net-next 1/2] net: phy: realtek: rename the 0x001cc862 PHY to RTL8251BE John-Michael Mulesa @ 2026-12-01 20:31 ` John-Michael Mulesa 2026-12-04 11:32 ` netdev-bot+sashiko 1 sibling, 1 reply; 4+ messages in thread From: John-Michael Mulesa @ 2026-12-01 20:31 UTC (permalink / raw) To: netdev Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Markus Stockhausen, John-Michael Mulesa The mass production RTL8251B reports the PHY ID 0x001cc86a, unlike the RTL8251BE engineering sample (0x001cc862) the driver already supports. On the Sirivision SR-S5G3008, an RTL9303 switch with eight RTL8251B, the switch's MDIO buses run Clause 45 only and Clause 22 accesses fail. Without a matching driver the PHYs bind to the generic Clause 45 driver. As devices-in-package bit 0 is set, phylib then falls back to Clause 22 autonegotiation, which fails and leaves the PHY in the error state. Add a Clause 45 driver built from the helpers the RTL8224 driver already uses: standard MMD 7 advertisement and link status, with the 1000BASE-T registers and the resolved speed read through the vendor register mirror in MMD 31. The code and this changelog were drafted with the help of an AI coding assistant (Claude, claude-opus-5-5). Signed-off-by: John-Michael Mulesa <jmulesa@gmail.com> --- drivers/net/phy/realtek/realtek_main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c index ece327d3c..1a91b62a8 100644 --- a/drivers/net/phy/realtek/realtek_main.c +++ b/drivers/net/phy/realtek/realtek_main.c @@ -265,6 +265,7 @@ #define RTL_8221B_VB_CG 0x001cc849 #define RTL_8221B_VM_CG 0x001cc84a #define RTL_8251BE 0x001cc862 +#define RTL_8251B 0x001cc86a #define RTL_8261C 0x001cc890 #define RTL_8261C_CG 0x001cc898 #define RTL_8261CE_CG 0x001cc899 @@ -2924,6 +2925,12 @@ static int rtl8251be_c45_match_phy_device(struct phy_device *phydev, return rtlgen_is_c45_match(phydev, RTL_8251BE, true); } +static int rtl8251b_c45_match_phy_device(struct phy_device *phydev, + const struct phy_driver *phydrv) +{ + return rtlgen_is_c45_match(phydev, RTL_8251B, true); +} + static int rtlgen_resume(struct phy_device *phydev) { int ret = genphy_resume(phydev); @@ -3409,6 +3416,14 @@ static struct phy_driver realtek_drvs[] = { .resume = rtlgen_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, + }, { + .match_phy_device = rtl8251b_c45_match_phy_device, + .name = "RTL8251B 5Gbps PHY", + .get_features = rtl822x_c45_get_features, + .config_aneg = rtl822x_c45_config_aneg, + .read_status = rtl822x_c45_read_status, + .suspend = genphy_c45_pma_suspend, + .resume = rtlgen_c45_resume, }, { .match_phy_device = rtl_internal_nbaset_match_phy_device, .name = "Realtek Internal NBASE-T PHY", -- 2.56.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 2/2] net: phy: realtek: add support for the RTL8251B 5Gbps PHY 2026-12-01 20:31 ` [PATCH net-next 2/2] net: phy: realtek: add support for the RTL8251B 5Gbps PHY John-Michael Mulesa @ 2026-12-04 11:32 ` netdev-bot+sashiko 0 siblings, 0 replies; 4+ messages in thread From: netdev-bot+sashiko @ 2026-12-04 11:32 UTC (permalink / raw) To: jmulesa Cc: netdev, andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, markus.stockhausen Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 2 · Low: 1 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] The patch fixes the configure-autoneg path but not the restart-autoneg path. - [Medium] The new RTL8251B entry in realtek_drvs[] neither programs nor tracks the PHY's host-side SerDes mode. - [Low] The changelog says an AI assistant drafted the code and the changelog, but it never says the new driver entry was tested on… -- net: phy: realtek: add support for the RTL8251B 5Gbps PHY This adds a Clause 45 phy_driver entry for the mass production RTL8251B (PHY ID 0x001cc86a). It matches on the C45 device ID and reuses the RTL8224 helpers for features, autoneg configuration, link status, suspend and resume. > The code and this changelog were drafted with the help of an AI coding > assistant (Claude, claude-opus-5-5). [Severity: Low] This isn't a bug, but could the changelog say how the new entry was tested on the SR-S5G3008? The changelog describes the failure before the patch. It doesn't say whether the link then came up at 5G/2.5G/1G with the correct speed read from PHYSR. Documentation/process/generated-content.rst suggests saying how the submission was tested. For longer sessions it also suggests a summary of the prompts and of the kind of help the assistant gave. > diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c > index ece327d3cfc37..1a91b62a845a2 100644 > --- a/drivers/net/phy/realtek/realtek_main.c > +++ b/drivers/net/phy/realtek/realtek_main.c [ ... ] > @@ -3409,6 +3416,14 @@ static struct phy_driver realtek_drvs[] = { > .resume = rtlgen_resume, > .read_page = rtl821x_read_page, > .write_page = rtl821x_write_page, > + }, { > + .match_phy_device = rtl8251b_c45_match_phy_device, > + .name = "RTL8251B 5Gbps PHY", > + .get_features = rtl822x_c45_get_features, > + .config_aneg = rtl822x_c45_config_aneg, [Severity: Medium] This entry moves config_aneg and read_status to Clause 45. Does restarting autoneg still go over Clause 22 on this PHY? There is no driver hook for restarting autoneg, so phy_restart_aneg() chooses the access method itself: drivers/net/phy/phy.c:phy_restart_aneg() { ... if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package & BIT(0))) ret = genphy_c45_restart_aneg(phydev); else ret = genphy_restart_aneg(phydev); ... } The commit message says devices-in-package bit 0 is set on the RTL8251B. That means this takes the genphy_restart_aneg() branch, which does a read-modify-write of MII_BMCR over Clause 22. The commit message says that kind of access fails on the RTL9303 MDIO buses. Two user-reachable paths end up here: ethtool -r: phy_ethtool_nway_reset() or phylink_ethtool_nway_reset() phy_restart_aneg() genphy_restart_aneg() ethtool --set-eee: phy_ethtool_set_eee() genphy_c45_ethtool_set_eee() genphy_c45_an_config_eee_aneg() <- writes MMD 7 over C45 phy_restart_aneg() <- fails over C22 In the EEE case, the new advertisement is already in MMD 7 when phy_restart_aneg() fails. After that, phy_ethtool_set_eee() restores phydev->eee_cfg to old_cfg. Wouldn't the PHY then keep advertising the new EEE modes, without renegotiating, while phydev->eee_cfg holds the old configuration? Normal link bring-up through the state machine doesn't call phy_restart_aneg(), so this shouldn't put the PHY in the error state. The problem is that ethtool -r and EEE changes would fail on this board. > + .read_status = rtl822x_c45_read_status, [Severity: Medium] Does this entry need to program or track the host-side SerDes mode? These helpers come from the RTL8224, which has a fixed USXGMII-QXGMII host interface. This entry has no config_init, inband_caps/config_inband or get_rate_matching. Also, rtl822x_c45_read_status() only decodes PHYSR for the copper speed and never updates phydev->interface. The RTL8221B entries in the same driver handle a configurable SerDes in three places: - rtl822xb_config_init() calls rtl822x_set_serdes_option_mode(), which sets the SerDes option, possible_interfaces and rate_matching. - rtl822xb_get_rate_matching() reports the rate matching mode. - The read_status callback follows the SerDes mode: static int rtl822xb_c45_read_status(struct phy_device *phydev) { ... ret = rtl822x_c45_read_status(phydev); if (ret < 0) return ret; rtl822xb_update_interface(phydev); ... } Straps or the bootloader might set the RTL8251B SerDes to switch modes with link speed. In that case phydev->interface would stay at the DT phy-mode. The MAC/PCS would not be reconfigured when the link comes up at 2.5G/1G/100M. The SerDes might instead be set up for pause-based rate adaptation. Then phylink would assume RATE_MATCH_NONE and configure the MAC for the copper speed. Is the SerDes mode on this PHY known to be fixed? Or does this entry rely on strap or firmware state being set up a certain way? > + .suspend = genphy_c45_pma_suspend, > + .resume = rtlgen_c45_resume, > }, { [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201203114.1274260-1-jmulesa%40gmail.com ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-04 11:32 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-12-01 20:31 [PATCH net-next 0/2] net: phy: realtek: add the mass production RTL8251B John-Michael Mulesa 2026-12-01 20:31 ` [PATCH net-next 1/2] net: phy: realtek: rename the 0x001cc862 PHY to RTL8251BE John-Michael Mulesa 2026-12-01 20:31 ` [PATCH net-next 2/2] net: phy: realtek: add support for the RTL8251B 5Gbps PHY John-Michael Mulesa 2026-12-04 11:32 ` netdev-bot+sashiko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox