Skip to contentSkip to conversation

net: phy: as21xxx: fill in inband caps and better handle inband

PATCH In review Christian Marangi 2 participants 3 messages Oct 16, 2025

Subsystems (4)
lore
Share & tools
lore

Christian Marangi

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 drivers/net/phy/as21xxx.c | 43 +++++++++++++++++++++++++++++++++------
 1 file changed, 37 insertions(+), 6 deletions(-)
drivers/net/phy/as21xxx.c +37 -6
index 005277360656..2dd808186642 100644
@@ -625,12 +625,8 @@ static int as21xxx_probe(struct phy_device *phydev)
 		return ret;
 
 	/* Enable PTP clk if not already Enabled */
-	ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, VEND1_PTP_CLK,
-			       VEND1_PTP_CLK_EN);
-	if (ret)
-		return ret;
-
-	return aeon_dpc_ra_enable(phydev);
+	return phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, VEND1_PTP_CLK,
+				VEND1_PTP_CLK_EN);
 }
 
 static int as21xxx_read_link(struct phy_device *phydev, int *bmcr)
@@ -943,6 +939,21 @@ static int as21xxx_match_phy_device(struct phy_device *phydev,
 	return ret;
 }
 
+static unsigned int as21xxx_inband_caps(struct phy_device *phydev,
+					phy_interface_t interface)
+{
+	return LINK_INBAND_ENABLE | LINK_INBAND_DISABLE;
+}
+
+static int as21xxx_config_inband(struct phy_device *phydev,
+				 unsigned int modes)
+{
+	if (modes == LINK_INBAND_ENABLE)
+		return aeon_dpc_ra_enable(phydev);
+
+	return 0;
+}
+
 static struct phy_driver as21xxx_drivers[] = {
 	{
 		/* PHY expose in C45 as 0x7500 0x9410
@@ -958,6 +969,8 @@ static struct phy_driver as21xxx_drivers[] = {
 		PHY_ID_MATCH_EXACT(PHY_ID_AS21011JB1),
 		.name		= "Aeonsemi AS21011JB1",
 		.probe		= as21xxx_probe,
+		.inband_caps	= as21xxx_inband_caps,
+		.config_inband	= as21xxx_config_inband,
 		.match_phy_device = as21xxx_match_phy_device,
 		.read_status	= as21xxx_read_status,
 		.led_brightness_set = as21xxx_led_brightness_set,
@@ -970,6 +983,8 @@ static struct phy_driver as21xxx_drivers[] = {
 		PHY_ID_MATCH_EXACT(PHY_ID_AS21011PB1),
 		.name		= "Aeonsemi AS21011PB1",
 		.probe		= as21xxx_probe,
+		.inband_caps	= as21xxx_inband_caps,
+		.config_inband	= as21xxx_config_inband,
 		.match_phy_device = as21xxx_match_phy_device,
 		.read_status	= as21xxx_read_status,
 		.led_brightness_set = as21xxx_led_brightness_set,
@@ -982,6 +997,8 @@ static struct phy_driver as21xxx_drivers[] = {
 		PHY_ID_MATCH_EXACT(PHY_ID_AS21010PB1),
 		.name		= "Aeonsemi AS21010PB1",
 		.probe		= as21xxx_probe,
+		.inband_caps	= as21xxx_inband_caps,
+		.config_inband	= as21xxx_config_inband,
 		.match_phy_device = as21xxx_match_phy_device,
 		.read_status	= as21xxx_read_status,
 		.led_brightness_set = as21xxx_led_brightness_set,
@@ -994,6 +1011,8 @@ static struct phy_driver as21xxx_drivers[] = {
 		PHY_ID_MATCH_EXACT(PHY_ID_AS21010JB1),
 		.name		= "Aeonsemi AS21010JB1",
 		.probe		= as21xxx_probe,
+		.inband_caps	= as21xxx_inband_caps,
+		.config_inband	= as21xxx_config_inband,
 		.match_phy_device = as21xxx_match_phy_device,
 		.read_status	= as21xxx_read_status,
 		.led_brightness_set = as21xxx_led_brightness_set,
@@ -1006,6 +1025,8 @@ static struct phy_driver as21xxx_drivers[] = {
 		PHY_ID_MATCH_EXACT(PHY_ID_AS21210PB1),
 		.name		= "Aeonsemi AS21210PB1",
 		.probe		= as21xxx_probe,
+		.inband_caps	= as21xxx_inband_caps,
+		.config_inband	= as21xxx_config_inband,
 		.match_phy_device = as21xxx_match_phy_device,
 		.read_status	= as21xxx_read_status,
 		.led_brightness_set = as21xxx_led_brightness_set,
@@ -1018,6 +1039,8 @@ static struct phy_driver as21xxx_drivers[] = {
 		PHY_ID_MATCH_EXACT(PHY_ID_AS21510JB1),
 		.name		= "Aeonsemi AS21510JB1",
 		.probe		= as21xxx_probe,
+		.inband_caps	= as21xxx_inband_caps,
+		.config_inband	= as21xxx_config_inband,
 		.match_phy_device = as21xxx_match_phy_device,
 		.read_status	= as21xxx_read_status,
 		.led_brightness_set = as21xxx_led_brightness_set,
@@ -1030,6 +1053,8 @@ static struct phy_driver as21xxx_drivers[] = {
 		PHY_ID_MATCH_EXACT(PHY_ID_AS21510PB1),
 		.name		= "Aeonsemi AS21510PB1",
 		.probe		= as21xxx_probe,
+		.inband_caps	= as21xxx_inband_caps,
+		.config_inband	= as21xxx_config_inband,
 		.match_phy_device = as21xxx_match_phy_device,
 		.read_status	= as21xxx_read_status,
 		.led_brightness_set = as21xxx_led_brightness_set,
@@ -1042,6 +1067,8 @@ static struct phy_driver as21xxx_drivers[] = {
 		PHY_ID_MATCH_EXACT(PHY_ID_AS21511JB1),
 		.name		= "Aeonsemi AS21511JB1",
 		.probe		= as21xxx_probe,
+		.inband_caps	= as21xxx_inband_caps,
+		.config_inband	= as21xxx_config_inband,
 		.match_phy_device = as21xxx_match_phy_device,
 		.read_status	= as21xxx_read_status,
 		.led_brightness_set = as21xxx_led_brightness_set,
@@ -1054,6 +1081,8 @@ static struct phy_driver as21xxx_drivers[] = {
 		PHY_ID_MATCH_EXACT(PHY_ID_AS21210JB1),
 		.name		= "Aeonsemi AS21210JB1",
 		.probe		= as21xxx_probe,
+		.inband_caps	= as21xxx_inband_caps,
+		.config_inband	= as21xxx_config_inband,
 		.match_phy_device = as21xxx_match_phy_device,
 		.read_status	= as21xxx_read_status,
 		.led_brightness_set = as21xxx_led_brightness_set,
@@ -1066,6 +1095,8 @@ static struct phy_driver as21xxx_drivers[] = {
 		PHY_ID_MATCH_EXACT(PHY_ID_AS21511PB1),
 		.name		= "Aeonsemi AS21511PB1",
 		.probe		= as21xxx_probe,
+		.inband_caps	= as21xxx_inband_caps,
+		.config_inband	= as21xxx_config_inband,
 		.match_phy_device = as21xxx_match_phy_device,
 		.read_status	= as21xxx_read_status,
 		.led_brightness_set = as21xxx_led_brightness_set,
Signature · 1 line
2.51.0
#1 lore raw

drivers/net/phy/as21xxx.c static int as21xxx_match_phy_device(struct phy_device *phydev, · line 952

Quoted 5 lines · Christian Marangi
drivers/net/phy/as21xxx.c +5 -0
+static int as21xxx_config_inband(struct phy_device *phydev,
+				 unsigned int modes)
+{
+	if (modes == LINK_INBAND_ENABLE)
+		return aeon_dpc_ra_enable(phydev);

So what happens when phylink requests inband to be disabled?

I really don't like implementations that enable something but then provide no way to disable it.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
author maintainer
#2 lore raw
Quoted 9 lines · Russell King (Oracle)

drivers/net/phy/as21xxx.c static int as21xxx_match_phy_device(struct phy_device *phydev, · line 952

Quoted 5 lines · Christian Marangi
drivers/net/phy/as21xxx.c +5 -0
+static int as21xxx_config_inband(struct phy_device *phydev,
+				 unsigned int modes)
+{
+	if (modes == LINK_INBAND_ENABLE)
+		return aeon_dpc_ra_enable(phydev);

So what happens when phylink requests inband to be disabled?

Quoted 3 lines

I really don't like implementations that enable something but then provide no way to disable it.

On firmware load it's disabled by default. Can phylink ask to disable inband at runtime?

I will try to check if there is a way to disable it.

Quoted 3 lines
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Signature · 1 line
	Ansuel