1616#include <linux/clk.h>
1717#include <linux/string_choices.h>
1818
19- #define RTL821x_PHYSR 0x11
20- #define RTL821x_PHYSR_DUPLEX BIT(13)
21- #define RTL821x_PHYSR_SPEED GENMASK(15, 14)
19+ #include "realtek.h"
2220
2321#define RTL8201F_IER 0x13
2422
@@ -1025,6 +1023,15 @@ static int rtl822x_write_mmd(struct phy_device *phydev, int devnum, u16 regnum,
10251023 return ret ;
10261024}
10271025
1026+ static int rtl822x_probe (struct phy_device * phydev )
1027+ {
1028+ if (IS_ENABLED (CONFIG_REALTEK_PHY_HWMON ) &&
1029+ phydev -> phy_id != RTL_GENERIC_PHYID )
1030+ return rtl822x_hwmon_init (phydev );
1031+
1032+ return 0 ;
1033+ }
1034+
10281035static int rtl822xb_config_init (struct phy_device * phydev )
10291036{
10301037 bool has_2500 , has_sgmii ;
@@ -1684,6 +1691,7 @@ static struct phy_driver realtek_drvs[] = {
16841691 }, {
16851692 .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device ,
16861693 .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)" ,
1694+ .probe = rtl822x_probe ,
16871695 .get_features = rtl822x_get_features ,
16881696 .config_aneg = rtl822x_config_aneg ,
16891697 .config_init = rtl822xb_config_init ,
@@ -1696,6 +1704,7 @@ static struct phy_driver realtek_drvs[] = {
16961704 }, {
16971705 .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device ,
16981706 .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)" ,
1707+ .probe = rtl822x_probe ,
16991708 .config_init = rtl822xb_config_init ,
17001709 .get_rate_matching = rtl822xb_get_rate_matching ,
17011710 .get_features = rtl822x_c45_get_features ,
@@ -1706,6 +1715,7 @@ static struct phy_driver realtek_drvs[] = {
17061715 }, {
17071716 .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device ,
17081717 .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)" ,
1718+ .probe = rtl822x_probe ,
17091719 .get_features = rtl822x_get_features ,
17101720 .config_aneg = rtl822x_config_aneg ,
17111721 .config_init = rtl822xb_config_init ,
@@ -1718,6 +1728,7 @@ static struct phy_driver realtek_drvs[] = {
17181728 }, {
17191729 .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device ,
17201730 .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)" ,
1731+ .probe = rtl822x_probe ,
17211732 .config_init = rtl822xb_config_init ,
17221733 .get_rate_matching = rtl822xb_get_rate_matching ,
17231734 .get_features = rtl822x_c45_get_features ,
@@ -1728,6 +1739,7 @@ static struct phy_driver realtek_drvs[] = {
17281739 }, {
17291740 .match_phy_device = rtl8251b_c45_match_phy_device ,
17301741 .name = "RTL8251B 5Gbps PHY" ,
1742+ .probe = rtl822x_probe ,
17311743 .get_features = rtl822x_get_features ,
17321744 .config_aneg = rtl822x_config_aneg ,
17331745 .read_status = rtl822x_read_status ,
@@ -1739,6 +1751,7 @@ static struct phy_driver realtek_drvs[] = {
17391751 .match_phy_device = rtl_internal_nbaset_match_phy_device ,
17401752 .name = "Realtek Internal NBASE-T PHY" ,
17411753 .flags = PHY_IS_INTERNAL ,
1754+ .probe = rtl822x_probe ,
17421755 .get_features = rtl822x_get_features ,
17431756 .config_aneg = rtl822x_config_aneg ,
17441757 .read_status = rtl822x_read_status ,
0 commit comments