Skip to content

Commit 4291488

Browse files
Ansuelfrank-w
authored andcommitted
net: phy: as21xxx: fill in inband caps and better handle inband
It was reported that it's possible to enable inband by not enabling DPC_RA on a Banana Pi R4 Pro (MT7988a). This was also confirmed on an Airoha SoC (AN7583) to make sure we are not facing some internal workaround with the USXGMII PCS. (on the Airoha SoC the PCS is configured to enable AN when inband is enabled and to disable AN when it's disabled) With this new information, fill in the .inband_caps() OP and set the .config_inband() to enable DPC_RA when inband is enabled. Tested-by: Frank Wunderlich <frank-w@public-files.de> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
1 parent a157ea5 commit 4291488

1 file changed

Lines changed: 37 additions & 6 deletions

File tree

drivers/net/phy/as21xxx.c

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -632,12 +632,8 @@ static int as21xxx_probe(struct phy_device *phydev)
632632
return ret;
633633

634634
/* Enable PTP clk if not already Enabled */
635-
ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, VEND1_PTP_CLK,
636-
VEND1_PTP_CLK_EN);
637-
if (ret)
638-
return ret;
639-
640-
return aeon_dpc_ra_enable(phydev);
635+
return phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, VEND1_PTP_CLK,
636+
VEND1_PTP_CLK_EN);
641637
}
642638

643639
static int as21xxx_read_link(struct phy_device *phydev, int *bmcr)
@@ -967,6 +963,21 @@ static int as21xxx_match_phy_device(struct phy_device *phydev,
967963
return ret;
968964
}
969965

966+
static unsigned int as21xxx_inband_caps(struct phy_device *phydev,
967+
phy_interface_t interface)
968+
{
969+
return LINK_INBAND_ENABLE | LINK_INBAND_DISABLE;
970+
}
971+
972+
static int as21xxx_config_inband(struct phy_device *phydev,
973+
unsigned int modes)
974+
{
975+
if (modes == LINK_INBAND_ENABLE)
976+
return aeon_dpc_ra_enable(phydev);
977+
978+
return 0;
979+
}
980+
970981
static struct phy_driver as21xxx_drivers[] = {
971982
{
972983
/* PHY expose in C45 as 0x7500 0x9410
@@ -982,6 +993,8 @@ static struct phy_driver as21xxx_drivers[] = {
982993
PHY_ID_MATCH_EXACT(PHY_ID_AS21011JB1),
983994
.name = "Aeonsemi AS21011JB1",
984995
.probe = as21xxx_probe,
996+
.inband_caps = as21xxx_inband_caps,
997+
.config_inband = as21xxx_config_inband,
985998
.match_phy_device = as21xxx_match_phy_device,
986999
.read_status = as21xxx_read_status,
9871000
.led_brightness_set = as21xxx_led_brightness_set,
@@ -995,6 +1008,8 @@ static struct phy_driver as21xxx_drivers[] = {
9951008
PHY_ID_MATCH_EXACT(PHY_ID_AS21011PB1),
9961009
.name = "Aeonsemi AS21011PB1",
9971010
.probe = as21xxx_probe,
1011+
.inband_caps = as21xxx_inband_caps,
1012+
.config_inband = as21xxx_config_inband,
9981013
.match_phy_device = as21xxx_match_phy_device,
9991014
.read_status = as21xxx_read_status,
10001015
.led_brightness_set = as21xxx_led_brightness_set,
@@ -1008,6 +1023,8 @@ static struct phy_driver as21xxx_drivers[] = {
10081023
PHY_ID_MATCH_EXACT(PHY_ID_AS21010PB1),
10091024
.name = "Aeonsemi AS21010PB1",
10101025
.probe = as21xxx_probe,
1026+
.inband_caps = as21xxx_inband_caps,
1027+
.config_inband = as21xxx_config_inband,
10111028
.match_phy_device = as21xxx_match_phy_device,
10121029
.read_status = as21xxx_read_status,
10131030
.led_brightness_set = as21xxx_led_brightness_set,
@@ -1021,6 +1038,8 @@ static struct phy_driver as21xxx_drivers[] = {
10211038
PHY_ID_MATCH_EXACT(PHY_ID_AS21010JB1),
10221039
.name = "Aeonsemi AS21010JB1",
10231040
.probe = as21xxx_probe,
1041+
.inband_caps = as21xxx_inband_caps,
1042+
.config_inband = as21xxx_config_inband,
10241043
.match_phy_device = as21xxx_match_phy_device,
10251044
.read_status = as21xxx_read_status,
10261045
.led_brightness_set = as21xxx_led_brightness_set,
@@ -1034,6 +1053,8 @@ static struct phy_driver as21xxx_drivers[] = {
10341053
PHY_ID_MATCH_EXACT(PHY_ID_AS21210PB1),
10351054
.name = "Aeonsemi AS21210PB1",
10361055
.probe = as21xxx_probe,
1056+
.inband_caps = as21xxx_inband_caps,
1057+
.config_inband = as21xxx_config_inband,
10371058
.match_phy_device = as21xxx_match_phy_device,
10381059
.read_status = as21xxx_read_status,
10391060
.led_brightness_set = as21xxx_led_brightness_set,
@@ -1047,6 +1068,8 @@ static struct phy_driver as21xxx_drivers[] = {
10471068
PHY_ID_MATCH_EXACT(PHY_ID_AS21510JB1),
10481069
.name = "Aeonsemi AS21510JB1",
10491070
.probe = as21xxx_probe,
1071+
.inband_caps = as21xxx_inband_caps,
1072+
.config_inband = as21xxx_config_inband,
10501073
.match_phy_device = as21xxx_match_phy_device,
10511074
.read_status = as21xxx_read_status,
10521075
.led_brightness_set = as21xxx_led_brightness_set,
@@ -1060,6 +1083,8 @@ static struct phy_driver as21xxx_drivers[] = {
10601083
PHY_ID_MATCH_EXACT(PHY_ID_AS21510PB1),
10611084
.name = "Aeonsemi AS21510PB1",
10621085
.probe = as21xxx_probe,
1086+
.inband_caps = as21xxx_inband_caps,
1087+
.config_inband = as21xxx_config_inband,
10631088
.match_phy_device = as21xxx_match_phy_device,
10641089
.read_status = as21xxx_read_status,
10651090
.led_brightness_set = as21xxx_led_brightness_set,
@@ -1073,6 +1098,8 @@ static struct phy_driver as21xxx_drivers[] = {
10731098
PHY_ID_MATCH_EXACT(PHY_ID_AS21511JB1),
10741099
.name = "Aeonsemi AS21511JB1",
10751100
.probe = as21xxx_probe,
1101+
.inband_caps = as21xxx_inband_caps,
1102+
.config_inband = as21xxx_config_inband,
10761103
.match_phy_device = as21xxx_match_phy_device,
10771104
.read_status = as21xxx_read_status,
10781105
.led_brightness_set = as21xxx_led_brightness_set,
@@ -1086,6 +1113,8 @@ static struct phy_driver as21xxx_drivers[] = {
10861113
PHY_ID_MATCH_EXACT(PHY_ID_AS21210JB1),
10871114
.name = "Aeonsemi AS21210JB1",
10881115
.probe = as21xxx_probe,
1116+
.inband_caps = as21xxx_inband_caps,
1117+
.config_inband = as21xxx_config_inband,
10891118
.match_phy_device = as21xxx_match_phy_device,
10901119
.read_status = as21xxx_read_status,
10911120
.led_brightness_set = as21xxx_led_brightness_set,
@@ -1099,6 +1128,8 @@ static struct phy_driver as21xxx_drivers[] = {
10991128
PHY_ID_MATCH_EXACT(PHY_ID_AS21511PB1),
11001129
.name = "Aeonsemi AS21511PB1",
11011130
.probe = as21xxx_probe,
1131+
.inband_caps = as21xxx_inband_caps,
1132+
.config_inband = as21xxx_config_inband,
11021133
.match_phy_device = as21xxx_match_phy_device,
11031134
.read_status = as21xxx_read_status,
11041135
.led_brightness_set = as21xxx_led_brightness_set,

0 commit comments

Comments
 (0)