From: Daniel Golle <daniel@makrotopia.org> Date: 2026-01-09 03:03:15
The RTL8221B PHY variants (VB-CG and VM-CG) were previously split into
separate C22 and C45 driver instances to support copper SFP modules
using the RollBall MDIO-over-I2C protocol, which only supports Clause-45
access. However, this split created significant code duplication and
complexity.
Commit 8af2136e77989 ("net: phy: realtek: add helper
RTL822X_VND2_C22_REG") exposed that RealTek PHYs map all standard
Clause-22 registers into MDIO_MMD_VEND2 at offset 0xa400.
With commit 1850ec20d6e71 ("net: phy: realtek: use paged access for
MDIO_MMD_VEND2 in C22 mode") it is now possible to access all MMD
registers transparently, regardless of whether the PHY is accessed via
C22 or C45 MDIO.
Further improve the translation logic for this register mapping, so a
single unified driver works efficiently with both access methods,
reducing code duplication.
The series also includes cleanup to remove unnecessary paged operations
on registers that aren't actually affected by page selection.
Testing was done on RTL8211F and RTL8221B-VB-CG (the latter in both
C22 and C45 modes).
Daniel Golle (5):
net: phy: realtek: support interrupt also for C22 variants
net: phy: realtek: simplify C22 reg access via MDIO_MMD_VEND2
net: phy: realtek: reunify C22 and C45 drivers
net: phy: realtek: demystify PHYSR register location
net: phy: realtek: simplify bogus paged operations
drivers/net/phy/realtek/realtek_main.c | 122 ++++++++++---------------
1 file changed, 47 insertions(+), 75 deletions(-)
--
2.52.0
From: Daniel Golle <daniel@makrotopia.org> Date: 2026-01-09 03:03:15
Now that access to MDIO_MMD_VEND2 works transparently also in Clause-22
mode, add interrupt support also for the C22 variants of the
RTL8221B-VB-CG and RTL8221B-VM-CG. This results in the C22 and C45
driver instances now having all the same features implemented.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/net/phy/realtek/realtek_main.c | 4 ++++
1 file changed, 4 insertions(+)
From: Daniel Golle <daniel@makrotopia.org> Date: 2026-01-09 03:03:29
RealTek 2.5GE PHYs have all standard Clause-22 registers mapped also
inside MDIO_MMD_VEND2 at offset 0xa400. This is used mainly in case the
PHY is inside a copper SFP module which uses the RollBall MDIO-over-I2C
method which *only* supports Clause-45. In order to support such
modules, the PHY driver has previously been split into a C22-only and
C45-only instances, creating quite a bit of redundancy and confusion.
In preparation of reunifying the two driver instances, add support for
translating MDIO_MMD_VEND2 registers 0xa400 to 0xa438 back to standard
Clause-22 access in case the PHY is accessed on a Clause-22 bus.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/net/phy/realtek/realtek_main.c | 11 +++++++++++
1 file changed, 11 insertions(+)
@@ -1264,6 +1265,11 @@ static int rtl822xb_read_mmd(struct phy_device *phydev, int devnum, u16 reg)returnmmd_phy_read(phydev->mdio.bus,phydev->mdio.addr,phydev->is_c45,devnum,reg);+/* Simplify access to C22-registers addressed inside MDIO_MMD_VEND2 */+if(reg>=RTL822X_VND2_C22_REG(0)&&+reg<=RTL822X_VND2_C22_REG(30))+return__phy_read(phydev,RTL822X_VND2_TO_C22_REG(reg));+/* Use paged access for MDIO_MMD_VEND2 over Clause-22 */page=RTL822X_VND2_TO_PAGE(reg);oldpage=__phy_read(phydev,RTL821x_PAGE_SELECT);
@@ -1299,6 +1305,11 @@ static int rtl822xb_write_mmd(struct phy_device *phydev, int devnum, u16 reg,returnmmd_phy_write(phydev->mdio.bus,phydev->mdio.addr,phydev->is_c45,devnum,reg,val);+/* Simplify access to C22-registers addressed inside MDIO_MMD_VEND2 */+if(reg>=RTL822X_VND2_C22_REG(0)&&+reg<=RTL822X_VND2_C22_REG(30))+return__phy_write(phydev,RTL822X_VND2_TO_C22_REG(reg),val);+/* Use paged access for MDIO_MMD_VEND2 over Clause-22 */page=RTL822X_VND2_TO_PAGE(reg);oldpage=__phy_read(phydev,RTL821x_PAGE_SELECT);
From: Daniel Golle <daniel@makrotopia.org> Date: 2026-01-09 03:03:40
Reunify the split C22/C45 drivers for the RTL8221B-VB-CG 2.5Gbps and
RTL8221B-VM-CG 2.5Gbps PHYs back into a single driver.
This is possible now by using all the driver operations previously used
by the C45 driver, as transparent access to all MMDs including
MDIO_MMD_VEND2 is now possible also over Clause-22 MDIO.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/net/phy/realtek/realtek_main.c | 72 ++++++--------------------
1 file changed, 16 insertions(+), 56 deletions(-)
From: Daniel Golle <daniel@makrotopia.org> Date: 2026-01-09 03:03:51
Turns out that register address RTL_VND2_PHYSR (0xa434) maps to
Clause-22 register MII_RESV2. Use that to get rid of yet another magic
number, and rename access macros accordingly.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/net/phy/realtek/realtek_main.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
From: Daniel Golle <daniel@makrotopia.org> Date: 2026-01-09 03:04:02
Only registers 0x10~0x17 are affected by the value in the page
selection register 0x1f. Hence there is no point in using paged
operations when accessing any other registers.
Simplify the driver by using the normal phy_read and phy_write
operations for registers which are anyway not affected by paging.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/net/phy/realtek/realtek_main.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
@@ -669,8 +667,8 @@ static int rtl8211f_config_clk_out(struct phy_device *phydev)RTL8211FVD_CLKOUT_REG,RTL8211FVD_CLKOUT_EN,0);else-ret=phy_modify_paged(phydev,RTL8211F_PHYCR_PAGE,-RTL8211F_PHYCR2,RTL8211F_CLKOUT_EN,0);+ret=phy_modify(phydev,RTL8211F_PHYCR2,RTL8211F_CLKOUT_EN,+0);if(ret)returnret;
@@ -695,15 +693,14 @@ static int rtl8211f_config_aldps(struct phy_device *phydev)if(!priv->enable_aldps)return0;-returnphy_modify_paged(phydev,RTL8211F_PHYCR_PAGE,RTL8211F_PHYCR1,-mask,mask);+returnphy_modify(phydev,RTL8211F_PHYCR1,mask,mask);}staticintrtl8211f_config_phy_eee(structphy_device*phydev){/* Disable PHY-mode EEE so LPI is passed to the MAC */-returnphy_modify_paged(phydev,RTL8211F_PHYCR_PAGE,RTL8211F_PHYCR2,-RTL8211F_PHYCR2_PHY_EEE_ENABLE,0);+returnphy_modify(phydev,RTL8211F_PHYCR2,+RTL8211F_PHYCR2_PHY_EEE_ENABLE,0);}staticintrtl8211f_config_init(structphy_device*phydev)
@@ -769,7 +766,7 @@ static int rtl8211f_suspend(struct phy_device *phydev)gotoerr;/* Read the INSR to clear any pending interrupt */-phy_read_paged(phydev,RTL8211F_INSR_PAGE,RTL8211F_INSR);+phy_read(phydev,RTL8211F_INSR);/* Reset the WoL to ensure that an event is picked up.*Unlesswedothis,evenifwereceiveanotherpacket,
RealTek 2.5GE PHYs have all standard Clause-22 registers mapped also
inside MDIO_MMD_VEND2 at offset 0xa400. This is used mainly in case the
PHY is inside a copper SFP module which uses the RollBall MDIO-over-I2C
method which *only* supports Clause-45. In order to support such
modules, the PHY driver has previously been split into a C22-only and
C45-only instances, creating quite a bit of redundancy and confusion.
To complement: RTL812x MAC/PHY chips allow access to MDIO_MMD_VEND2 of the
integrated PHY only. There is no native C22 MDIO access.
quoted hunk
In preparation of reunifying the two driver instances, add support for
translating MDIO_MMD_VEND2 registers 0xa400 to 0xa438 back to standard
Clause-22 access in case the PHY is accessed on a Clause-22 bus.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/net/phy/realtek/realtek_main.c | 11 +++++++++++
1 file changed, 11 insertions(+)
@@ -1264,6 +1265,11 @@ static int rtl822xb_read_mmd(struct phy_device *phydev, int devnum, u16 reg)returnmmd_phy_read(phydev->mdio.bus,phydev->mdio.addr,phydev->is_c45,devnum,reg);+/* Simplify access to C22-registers addressed inside MDIO_MMD_VEND2 */+if(reg>=RTL822X_VND2_C22_REG(0)&&+reg<=RTL822X_VND2_C22_REG(30))+return__phy_read(phydev,RTL822X_VND2_TO_C22_REG(reg));+/* Use paged access for MDIO_MMD_VEND2 over Clause-22 */page=RTL822X_VND2_TO_PAGE(reg);oldpage=__phy_read(phydev,RTL821x_PAGE_SELECT);
@@ -1299,6 +1305,11 @@ static int rtl822xb_write_mmd(struct phy_device *phydev, int devnum, u16 reg,returnmmd_phy_write(phydev->mdio.bus,phydev->mdio.addr,phydev->is_c45,devnum,reg,val);+/* Simplify access to C22-registers addressed inside MDIO_MMD_VEND2 */+if(reg>=RTL822X_VND2_C22_REG(0)&&+reg<=RTL822X_VND2_C22_REG(30))+return__phy_write(phydev,RTL822X_VND2_TO_C22_REG(reg),val);+/* Use paged access for MDIO_MMD_VEND2 over Clause-22 */page=RTL822X_VND2_TO_PAGE(reg);oldpage=__phy_read(phydev,RTL821x_PAGE_SELECT);
Turns out that register address RTL_VND2_PHYSR (0xa434) maps to
Clause-22 register MII_RESV2. Use that to get rid of yet another magic
number, and rename access macros accordingly.
RTL_VND2_PHYSR is documented in the datasheet, at least for RTL8221B(I)-VB-CG.
(this datasheet is publicly available, I don't have access to other datasheets)
MII_RESV2 isn't documented there. Is MII_RESV2 documented in any other datasheet?
From: Daniel Golle <daniel@makrotopia.org> Date: 2026-01-09 12:26:57
On Fri, Jan 09, 2026 at 08:32:33AM +0100, Heiner Kallweit wrote:
On 1/9/2026 4:03 AM, Daniel Golle wrote:
quoted
Turns out that register address RTL_VND2_PHYSR (0xa434) maps to
Clause-22 register MII_RESV2. Use that to get rid of yet another magic
number, and rename access macros accordingly.
RTL_VND2_PHYSR is documented in the datasheet, at least for RTL8221B(I)-VB-CG.
(this datasheet is publicly available, I don't have access to other datasheets)
MII_RESV2 isn't documented there. Is MII_RESV2 documented in any other datasheet?
No datasheet mentions the nature of paging only affecting registers
0x10~0x17, I've figured that out by code analysis and testing (ie.
dumping all registers for all known/used pages using mdio-tools in
userspace, and writing to PHYCR1 toggling BIT(13) and confirming that it
affects the PHY in the expected way). Don't ask me why they ommit this
in the datasheets, I suspect the people writing the datasheets are given
some auto-generated code and also don't have unterstanding of the actual
internals (maybe to "protect" their precious IP?).
Anyway, as RTL_VND2_PHYSR is 0xa434 on MDIO_MMD_VEND2, and we know that
0xa400~0xa43c maps to the standard C22 registers, I concluded that
0xa434 on MDIO_MMD_VEND2 is identical to C22 register 0x1a, ie.
MII_RESV2. I've also noticed that the mechanism to translate registers
on MDIO_MMD_VEND2 to paged C22 registers only makes use of registers
0x10~0x17, so it became apparent that other registers are not affected
by paging.
I've confirmed all that by testing on RTL8211F and RTL8221B. As pointed
out this also holds true for internal PHYs on r8169 which emulate C22
registers in the exact same way. Hence the PHY driver can be simplified,
as there is no need to set and restore the page around the reading of
PHYSR.
From: Andrew Lunn <andrew@lunn.ch> Date: 2026-01-09 13:18:31
On Fri, Jan 09, 2026 at 03:03:33AM +0000, Daniel Golle wrote:
quoted hunk
Reunify the split C22/C45 drivers for the RTL8221B-VB-CG 2.5Gbps and
RTL8221B-VM-CG 2.5Gbps PHYs back into a single driver.
This is possible now by using all the driver operations previously used
by the C45 driver, as transparent access to all MMDs including
MDIO_MMD_VEND2 is now possible also over Clause-22 MDIO.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/net/phy/realtek/realtek_main.c | 72 ++++++--------------------
1 file changed, 16 insertions(+), 56 deletions(-)
@@ -1879,28 +1879,18 @@ static int rtl8221b_match_phy_device(struct phy_device *phydev,returnphydev->phy_id==RTL_8221B&&rtlgen_supports_mmd(phydev);}-staticintrtl8221b_vb_cg_c22_match_phy_device(structphy_device*phydev,-conststructphy_driver*phydrv)+staticintrtl8221b_vb_cg_match_phy_device(structphy_device*phydev,+conststructphy_driver*phydrv){-returnrtlgen_is_c45_match(phydev,RTL_8221B_VB_CG,false);+returnrtlgen_is_c45_match(phydev,RTL_8221B_VB_CG,true)||+rtlgen_is_c45_match(phydev,RTL_8221B_VB_CG,false);
Are there any calls left to rtlgen_is_c45_match() which don't || true
and false? If not, maybe add another patch which removes the bool
parameter?
Andrew
From: Daniel Golle <daniel@makrotopia.org> Date: 2026-01-09 13:25:28
On Fri, Jan 09, 2026 at 02:18:14PM +0100, Andrew Lunn wrote:
On Fri, Jan 09, 2026 at 03:03:33AM +0000, Daniel Golle wrote:
quoted
Reunify the split C22/C45 drivers for the RTL8221B-VB-CG 2.5Gbps and
RTL8221B-VM-CG 2.5Gbps PHYs back into a single driver.
This is possible now by using all the driver operations previously used
by the C45 driver, as transparent access to all MMDs including
MDIO_MMD_VEND2 is now possible also over Clause-22 MDIO.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/net/phy/realtek/realtek_main.c | 72 ++++++--------------------
1 file changed, 16 insertions(+), 56 deletions(-)
@@ -1879,28 +1879,18 @@ static int rtl8221b_match_phy_device(struct phy_device *phydev,returnphydev->phy_id==RTL_8221B&&rtlgen_supports_mmd(phydev);}-staticintrtl8221b_vb_cg_c22_match_phy_device(structphy_device*phydev,-conststructphy_driver*phydrv)+staticintrtl8221b_vb_cg_match_phy_device(structphy_device*phydev,+conststructphy_driver*phydrv){-returnrtlgen_is_c45_match(phydev,RTL_8221B_VB_CG,false);+returnrtlgen_is_c45_match(phydev,RTL_8221B_VB_CG,true)||+rtlgen_is_c45_match(phydev,RTL_8221B_VB_CG,false);
Are there any calls left to rtlgen_is_c45_match() which don't || true
and false? If not, maybe add another patch which removes the bool
parameter?
At this point it is still used by
---
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);
}
---
This 5G PHY supposedly supports only C45 mode, I don't know if it
actually needs the .match_phy_device at all or could also simply use
PHY_ID_MATCH_EXACT(RTL_8251B) instead, I don't have any device using
it so I can't test that.
From: Daniel Golle <daniel@makrotopia.org> Date: 2026-01-09 17:32:01
On Fri, Jan 09, 2026 at 12:26:42PM +0000, Daniel Golle wrote:
On Fri, Jan 09, 2026 at 08:32:33AM +0100, Heiner Kallweit wrote:
quoted
On 1/9/2026 4:03 AM, Daniel Golle wrote:
quoted
Turns out that register address RTL_VND2_PHYSR (0xa434) maps to
Clause-22 register MII_RESV2. Use that to get rid of yet another magic
number, and rename access macros accordingly.
RTL_VND2_PHYSR is documented in the datasheet, at least for RTL8221B(I)-VB-CG.
(this datasheet is publicly available, I don't have access to other datasheets)
MII_RESV2 isn't documented there. Is MII_RESV2 documented in any other datasheet?
No datasheet mentions the nature of paging only affecting registers
0x10~0x17, I've figured that out by code analysis and testing (ie.
dumping all registers for all known/used pages using mdio-tools in
userspace, and writing to PHYCR1 toggling BIT(13) and confirming that it
affects the PHY in the expected way). Don't ask me why they ommit this
in the datasheets, I suspect the people writing the datasheets are given
some auto-generated code and also don't have unterstanding of the actual
internals (maybe to "protect" their precious IP?).
Anyway, as RTL_VND2_PHYSR is 0xa434 on MDIO_MMD_VEND2, and we know that
0xa400~0xa43c maps to the standard C22 registers, I concluded that
0xa434 on MDIO_MMD_VEND2 is identical to C22 register 0x1a, ie.
MII_RESV2. I've also noticed that the mechanism to translate registers
on MDIO_MMD_VEND2 to paged C22 registers only makes use of registers
0x10~0x17, so it became apparent that other registers are not affected
by paging.
I've confirmed all that by testing on RTL8211F and RTL8221B. As pointed
out this also holds true for internal PHYs on r8169 which emulate C22
registers in the exact same way. Hence the PHY driver can be simplified,
as there is no need to set and restore the page around the reading of
PHYSR.
Just did some additional testing also with r8169 (with internal 2.5G PHY
0x001cc840), and PHYSR reads fine as MII_RESV2, letting the Ethernet
driver handle the mapping to MDIO_MMD_VEND2 instead of using a paged
read in the PHY driver.
From: Daniel Golle <daniel@makrotopia.org> Date: 2026-01-09 20:19:32
On Fri, Jan 09, 2026 at 05:31:40PM +0000, Daniel Golle wrote:
On Fri, Jan 09, 2026 at 12:26:42PM +0000, Daniel Golle wrote:
quoted
On Fri, Jan 09, 2026 at 08:32:33AM +0100, Heiner Kallweit wrote:
quoted
On 1/9/2026 4:03 AM, Daniel Golle wrote:
quoted
Turns out that register address RTL_VND2_PHYSR (0xa434) maps to
Clause-22 register MII_RESV2. Use that to get rid of yet another magic
number, and rename access macros accordingly.
RTL_VND2_PHYSR is documented in the datasheet, at least for RTL8221B(I)-VB-CG.
(this datasheet is publicly available, I don't have access to other datasheets)
MII_RESV2 isn't documented there. Is MII_RESV2 documented in any other datasheet?
No datasheet mentions the nature of paging only affecting registers
0x10~0x17, I've figured that out by code analysis and testing (ie.
dumping all registers for all known/used pages using mdio-tools in
userspace, and writing to PHYCR1 toggling BIT(13) and confirming that it
affects the PHY in the expected way). Don't ask me why they ommit this
in the datasheets, I suspect the people writing the datasheets are given
some auto-generated code and also don't have unterstanding of the actual
internals (maybe to "protect" their precious IP?).
Anyway, as RTL_VND2_PHYSR is 0xa434 on MDIO_MMD_VEND2, and we know that
0xa400~0xa43c maps to the standard C22 registers, I concluded that
0xa434 on MDIO_MMD_VEND2 is identical to C22 register 0x1a, ie.
MII_RESV2. I've also noticed that the mechanism to translate registers
on MDIO_MMD_VEND2 to paged C22 registers only makes use of registers
0x10~0x17, so it became apparent that other registers are not affected
by paging.
I've confirmed all that by testing on RTL8211F and RTL8221B. As pointed
out this also holds true for internal PHYs on r8169 which emulate C22
registers in the exact same way. Hence the PHY driver can be simplified,
as there is no need to set and restore the page around the reading of
PHYSR.
Just did some additional testing also with r8169 (with internal 2.5G PHY
0x001cc840), and PHYSR reads fine as MII_RESV2, letting the Ethernet
driver handle the mapping to MDIO_MMD_VEND2 instead of using a paged
read in the PHY driver.
Same for 10ec:8168
("Realtek Semiconductor Co., Ltd. RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller (rev 15)")
with PHY ID 0x001cc800 ("Generic FE-GE Realtek PHY"), works all fine
with this series applied.
So I agree that for r8169 this change doesn't make a difference, but
for standalone PHYs it does make things more simple and also means
less MDIO operations (1 instead of 3) to do the same thing.
From: "Russell King (Oracle)" <linux@armlinux.org.uk> Date: 2026-01-09 21:32:34
On Fri, Jan 09, 2026 at 03:03:22AM +0000, Daniel Golle wrote:
RealTek 2.5GE PHYs have all standard Clause-22 registers mapped also
inside MDIO_MMD_VEND2 at offset 0xa400. This is used mainly in case the
PHY is inside a copper SFP module which uses the RollBall MDIO-over-I2C
method which *only* supports Clause-45.
It isn't just Rollball. There are SoCs out there which have separate
MDIO buses, one bus signals at 3.3V and can generate only clause 22
frames. The other operates at 1.2V and can only generate clause 45
frames.
While hardware may elect to generate and recognise either frame types
at either voltage, this goes some way to explain why there are
implementations that only support one or the other on a particular
pair of MDC/MDIO wires.
Armada 8040 has this setup - there is one MDIO bus that only supports
clause 22 frames, and there is a separate MDIO bus that only supports
clause 45 frames.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
From: Daniel Golle <daniel@makrotopia.org> Date: 2026-01-09 22:21:51
On Fri, Jan 09, 2026 at 09:32:18PM +0000, Russell King (Oracle) wrote:
On Fri, Jan 09, 2026 at 03:03:22AM +0000, Daniel Golle wrote:
quoted
RealTek 2.5GE PHYs have all standard Clause-22 registers mapped also
inside MDIO_MMD_VEND2 at offset 0xa400. This is used mainly in case the
PHY is inside a copper SFP module which uses the RollBall MDIO-over-I2C
method which *only* supports Clause-45.
It isn't just Rollball. There are SoCs out there which have separate
MDIO buses, one bus signals at 3.3V and can generate only clause 22
frames. The other operates at 1.2V and can only generate clause 45
frames.
While hardware may elect to generate and recognise either frame types
at either voltage, this goes some way to explain why there are
implementations that only support one or the other on a particular
pair of MDC/MDIO wires.
Armada 8040 has this setup - there is one MDIO bus that only supports
clause 22 frames, and there is a separate MDIO bus that only supports
clause 45 frames.
Interesting. And a bit annoying. I wasn't aware of the electrical
difference (signal voltage).
Never the less, even with this change applied you now get a driver which
uses *only* Clause-45 access in case phydev->is_45 is true, and only
Clause-22 in case phydev->is_45 is false.
From what I understood this was the intended outcome of having two
dedicated drivers, and you can have the very same results now with a
single driver. If you would like me to broaden the commit message and
clarify this, please let me know.
On Fri, Jan 09, 2026 at 02:18:14PM +0100, Andrew Lunn wrote:
quoted
On Fri, Jan 09, 2026 at 03:03:33AM +0000, Daniel Golle wrote:
quoted
Reunify the split C22/C45 drivers for the RTL8221B-VB-CG 2.5Gbps and
RTL8221B-VM-CG 2.5Gbps PHYs back into a single driver.
This is possible now by using all the driver operations previously used
by the C45 driver, as transparent access to all MMDs including
MDIO_MMD_VEND2 is now possible also over Clause-22 MDIO.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/net/phy/realtek/realtek_main.c | 72 ++++++--------------------
1 file changed, 16 insertions(+), 56 deletions(-)
@@ -1879,28 +1879,18 @@ static int rtl8221b_match_phy_device(struct phy_device *phydev,returnphydev->phy_id==RTL_8221B&&rtlgen_supports_mmd(phydev);}-staticintrtl8221b_vb_cg_c22_match_phy_device(structphy_device*phydev,-conststructphy_driver*phydrv)+staticintrtl8221b_vb_cg_match_phy_device(structphy_device*phydev,+conststructphy_driver*phydrv){-returnrtlgen_is_c45_match(phydev,RTL_8221B_VB_CG,false);+returnrtlgen_is_c45_match(phydev,RTL_8221B_VB_CG,true)||+rtlgen_is_c45_match(phydev,RTL_8221B_VB_CG,false);
Are there any calls left to rtlgen_is_c45_match() which don't || true
and false? If not, maybe add another patch which removes the bool
parameter?
At this point it is still used by
---
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);
}
---
This 5G PHY supposedly supports only C45 mode, I don't know if it
actually needs the .match_phy_device at all or could also simply use
PHY_ID_MATCH_EXACT(RTL_8251B) instead, I don't have any device using
it so I can't test that.
Yes, match_phy_device is needed. This PHY ID also matches the internal PHY
of RTL8126. And RTL8126 doesn't support speaking c45 to its internal PHY.