net: phy: realtek: Add phy ids for RTL8226-CG/RTL8226B-CG
Subsystems (3)
PATCH 1/2 net: phy: realtek: Add phy ids for RTL8226-CG/RTL8226B-CG
Realtek single-port 2.5Gbps Ethernet PHY ids as below:
RTL8226-CG: 0x001cc800(ES)/0x001cc838(MP) RTL8226B-CG/RTL8221B-CG: 0x001cc840(ES)/0x001cc848(MP)
ES: engineer sample
MP: mass production
Since above PHYs are already in mass production stage, mass production id should be added.
--- drivers/net/phy/realtek.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) mode change 100644 => 100755 drivers/net/phy/realtek.c
drivers/net/phy/realtek.c +14 -4
@@ -57,6 +57,9 @@#define RTLGEN_SPEED_MASK 0x0630#define RTL_GENERIC_PHYID 0x001cc800 +#define RTL_8226_MP_PHYID 0x001cc838 +#define RTL_8221B_ES_PHYID 0x001cc840 +#define RTL_8221B_MP_PHYID 0x001cc848MODULE_DESCRIPTION ("Realtek PHY driver" );MODULE_AUTHOR ("Johnson Leung" );
@@ -533,10 +536,17 @@ 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 && +return (phydev->phy_id ==RTL_GENERIC_PHYID ) || + (phydev->phy_id ==RTL_8226_MP_PHYID ) &&rtlgen_supports_2_5gbps (phydev); } +static int rtl8221b_match_phy_device (struct phy_device *phydev) +{ +return (phydev->phy_id ==RTL_8221B_ES_PHYID ) || + (phydev->phy_id ==RTL_8221B_MP_PHYID ); +} +static int rtlgen_resume (struct phy_device *phydev) {int ret =genphy_resume (phydev);
@@ -636,7 +646,7 @@ static int rtlgen_resume(struct phy_device *phydev) .read_mmd = rtlgen_read_mmd, .write_mmd = rtlgen_write_mmd, }, { - .name = "RTL8226 2.5Gbps PHY", + .name = "RTL8226-CG 2.5Gbps PHY", .match_phy_device = rtl8226_match_phy_device, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg,
@@ -648,8 +658,8 @@ static int rtlgen_resume(struct phy_device *phydev) .read_mmd = rtl822x_read_mmd, .write_mmd = rtl822x_write_mmd, }, { - PHY_ID_MATCH_EXACT(0x001cc840), - .name = "RTL8226B_RTL8221B 2.5Gbps PHY", + .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", + .match_phy_device = rtl8221b_match_phy_device, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status,
Signature · 1 line
1.9.1
Andrew Lunn
maintainerQuoted 32 lines · Willy Liu
Realtek single-port 2.5Gbps Ethernet PHY ids as below:
RTL8226-CG: 0x001cc800(ES)/0x001cc838(MP) RTL8226B-CG/RTL8221B-CG: 0x001cc840(ES)/0x001cc848(MP)
ES: engineer sample
MP: mass productionSince above PHYs are already in mass production stage, mass production id should be added.
Signed-off-by Willy Liu <[email protected]>--- drivers/net/phy/realtek.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) mode change 100644 => 100755 drivers/net/phy/realtek.cdrivers/net/phy/realtek.c +3
-0@@ -57,6 +57,9 @@#define RTLGEN_SPEED_MASK 0x0630#define RTL_GENERIC_PHYID 0x001cc800 +#define RTL_8226_MP_PHYID 0x001cc838 +#define RTL_8221B_ES_PHYID 0x001cc840 +#define RTL_8221B_MP_PHYID 0x001cc848MODULE_DESCRIPTION ("Realtek PHY driver" );MODULE_AUTHOR ("Johnson Leung" );
drivers/net/phy/realtek.c static int rtlgen_match_phy_device(struct phy_device *phydev) · line 541
Quoted 7 lines
drivers/net/phy/realtek.c +2
-1@@ -533,10 +536,17 @@ 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 && +return (phydev->phy_id ==RTL_GENERIC_PHYID ) || + (phydev->phy_id ==RTL_8226_MP_PHYID ) &&rtlgen_supports_2_5gbps (phydev);
Hi Willy
If i understand the code correctly, this match function is used because the engineering sample did not use a proper ID? The mass production part does, so there is no need to make use of this hack. Please just list it as a normal PHY using PHY_ID_MATCH_EXACT().
drivers/net/phy/realtek.c static int rtlgen_match_phy_device(struct phy_device *phydev) · line 548
Quoted 7 lines
drivers/net/phy/realtek.c +5
-0} +static int rtl8221b_match_phy_device (struct phy_device *phydev) +{ +return (phydev->phy_id ==RTL_8221B_ES_PHYID ) || + (phydev->phy_id ==RTL_8221B_MP_PHYID ); +}
Again, these appear to be well defined ID, so just list them in the normal ways.
Andrew
Heiner Kallweit
maintainerQuoted 43 lines · Andrew Lunn
Quoted 32 lines · Willy Liu
Realtek single-port 2.5Gbps Ethernet PHY ids as below:
RTL8226-CG: 0x001cc800(ES)/0x001cc838(MP) RTL8226B-CG/RTL8221B-CG: 0x001cc840(ES)/0x001cc848(MP)
ES: engineer sample
MP: mass productionSince above PHYs are already in mass production stage, mass production id should be added.
Signed-off-by Willy Liu <[email protected]>--- drivers/net/phy/realtek.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) mode change 100644 => 100755 drivers/net/phy/realtek.cdrivers/net/phy/realtek.c +3
-0@@ -57,6 +57,9 @@#define RTLGEN_SPEED_MASK 0x0630#define RTL_GENERIC_PHYID 0x001cc800 +#define RTL_8226_MP_PHYID 0x001cc838 +#define RTL_8221B_ES_PHYID 0x001cc840 +#define RTL_8221B_MP_PHYID 0x001cc848MODULE_DESCRIPTION ("Realtek PHY driver" );MODULE_AUTHOR ("Johnson Leung" );drivers/net/phy/realtek.c static int rtlgen_match_phy_device(struct phy_device *phydev) · line 541
Quoted 7 lines
drivers/net/phy/realtek.c +2
-1@@ -533,10 +536,17 @@ 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 && +return (phydev->phy_id ==RTL_GENERIC_PHYID ) || + (phydev->phy_id ==RTL_8226_MP_PHYID ) &&rtlgen_supports_2_5gbps (phydev);Hi Willy
Quoted 5 lines
If i understand the code correctly, this match function is used because the engineering sample did not use a proper ID? The mass production part does, so there is no need to make use of this hack. Please just list it as a normal PHY using
PHY_ID_MATCH_EXACT().
Right. My understanding:
These PHY's exist as standalone chips and integrated with RTL8125 MAC. IIRC for RTL8125A the integrated PHY reports RTL_GENERIC_PHYID, since RTL8125B it reports the same PHYID as the standalone model.
Quoted 47 lines · Heiner Hallweit
Quoted 23 lines · Andrew Lunn
Quoted 22 lines · Willy Liu
Realtek single-port 2.5Gbps Ethernet PHY ids as below:
RTL8226-CG: 0x001cc800(ES)/0x001cc838(MP) RTL8226B-CG/RTL8221B-CG: 0x001cc840(ES)/0x001cc848(MP)
ES: engineer sample
MP: mass productionSince above PHYs are already in mass production stage, mass production id should be added.
Signed-off-by Willy Liu <[email protected]>--- drivers/net/phy/realtek.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) mode change 100644=> 100755
drivers/net/phy/realtek.cdrivers/net/phy/realtek.c +0
-0@@ -57,6 +57,9 @@#define RTLGEN_SPEED_MASK 0x0630Quoted 6 lines
drivers/net/phy/realtek.c line 64
Quoted 6 lines
drivers/net/phy/realtek.c +3
-0#define RTL_GENERIC_PHYID 0x001cc800 +#define RTL_8226_MP_PHYID 0x001cc838 +#define RTL_8221B_ES_PHYID 0x001cc840 +#define RTL_8221B_MP_PHYID 0x001cc848MODULE_DESCRIPTION ("Realtek PHY driver" );MODULE_AUTHOR("Johnson
Quoted 11 lines
drivers/net/phy/realtek.c static int rtlgen_match_phy_device(struct phy_device *phydev) · line 541
Quoted 8 lines
Leung"); @@ -533,10 +536,17 @@ static int
rtlgen_match_phy_device(struct phy_device *phydev)static int
rtl8226_match_phy_device(struct phy_device *phydev){drivers/net/phy/realtek.c +2
-1-return phydev->phy_id ==RTL_GENERIC_PHYID && +return (phydev->phy_id ==RTL_GENERIC_PHYID ) || + (phydev->phy_id ==RTL_8226_MP_PHYID ) &&rtlgen_supports_2_5gbps (phydev);Hi Willy
Quoted 5 lines
If i understand the code correctly, this match function is used because the engineering sample did not use a proper ID? The mass production part does, so there is no need to make use of this hack. Please just list it as a normal PHY using
PHY_ID_MATCH_EXACT().
Quoted 4 lines
Right. My understanding:
These PHY's exist as standalone chips and integrated with RTL8125 MAC. IIRC for RTL8125A the integrated PHY reportsRTL_GENERIC_PHYID, since RTL8125B it reports the same PHYID as the standalone model.
Hi Andrew && Heiner,
Thanks for your information, I will create drivers for RTL8226-CG & RTL8221B-CG as standalone models.
Quoted 1 line
------Please consider the environment before printing this e-mail.
Jakub Kicinski
maintainerQuoted 10 lines · On Thu, 29 Oct 2020 20:07:57 +0800 Willy Liu wrote:
Realtek single-port 2.5Gbps Ethernet PHY ids as below:
RTL8226-CG: 0x001cc800(ES)/0x001cc838(MP) RTL8226B-CG/RTL8221B-CG: 0x001cc840(ES)/0x001cc848(MP)
ES: engineer sample
MP: mass productionSince above PHYs are already in mass production stage, mass production id should be added.
Signed-off-by Willy Liu <[email protected]>
drivers/net/phy/realtek.c: In function ‘rtl8226_match_phy_device’:drivers/net/phy/realtek.c:540:47: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
540 | (phydev->phy_id == RTL_8226_MP_PHYID) &&
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
541 | rtlgen_supports_2_5gbps(phydev);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~