Skip to contentSkip to conversation

net: phy: qcom: qca808x: fill in possible_interfaces

PATCH Superseded Robert Marko 2 participants 4 messages Feb 27, 2024

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover net: phy: qcom: qca808x: fill in possible_interfaces

QCA808x does not currently fill in the possible_interfaces.

This leads to Phylink not being aware that it supports 2500Base-X as well so in cases where it is connected to a DSA switch like MV88E6393 it will limit that port to phy-mode set in the DTS.

That means that if SGMII is used you are limited to 1G only while if 2500Base-X was set you are limited to 2.5G only.

Populating the possible_interfaces fixes this.

Robert Marko (2):
net: phy: qcom: qca808x: add helper for checking for 1G only model
net: phy: qcom: qca808x: fill in possible_interfaces

 drivers/net/phy/qcom/qca808x.c | 32 +++++++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)
Signature · 1 line
2.43.2
#1 lore raw

PATCH 1/2 net: phy: qcom: qca808x: add helper for checking for 1G only model

There are 2 versions of QCA808x, one 2.5G capable and one 1G capable. Currently, this matter only in the .get_features call however, it will be required for filling supported interface modes so lets add a helper that can be reused.

---
 drivers/net/phy/qcom/qca808x.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/net/phy/qcom/qca808x.c +15 -5
index 2acf852fb4de..16c94e77646f 100644
@@ -156,6 +156,20 @@ static bool qca808x_has_fast_retrain_or_slave_seed(struct phy_device *phydev)
 	return linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported);
 }
 
+static bool qca808x_is_1g_only(struct phy_device *phydev)
+{
+	int ret;
+
+	ret = phy_read_mmd(phydev, MDIO_MMD_AN, QCA808X_PHY_MMD7_CHIP_TYPE);
+	if (ret < 0)
+		return true;
+
+	if (QCA808X_PHY_CHIP_TYPE_1G & ret)
+		return true;
+	else
+		return false;
+}
+
 static int qca808x_probe(struct phy_device *phydev)
 {
 	struct device *dev = &phydev->mdio.dev;
@@ -350,11 +364,7 @@ static int qca808x_get_features(struct phy_device *phydev)
 	 * existed in the bit0 of MMD1.21, we need to remove it manually if
 	 * it is the qca8081 1G chip according to the bit0 of MMD7.0x901d.
 	 */
-	ret = phy_read_mmd(phydev, MDIO_MMD_AN, QCA808X_PHY_MMD7_CHIP_TYPE);
-	if (ret < 0)
-		return ret;
-
-	if (QCA808X_PHY_CHIP_TYPE_1G & ret)
+	if (qca808x_is_1g_only(phydev))
 		linkmode_clear_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported);
 
 	return 0;
Signature · 1 line
2.43.2
#3 lore raw

PATCH 2/2 net: phy: qcom: qca808x: fill in possible_interfaces

In reply to Robert Marko

Currently QCA808x driver does not fill the possible_interfaces. 2.5G QCA808x support SGMII and 2500Base-X while 1G model only supports SGMII, so fill the possible_interfaces accordingly.

---
 drivers/net/phy/qcom/qca808x.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/net/phy/qcom/qca808x.c +12 -0
index 16c94e77646f..bd36f5b90391 100644
@@ -170,6 +170,16 @@ static bool qca808x_is_1g_only(struct phy_device *phydev)
 		return false;
 }
 
+static void qca808x_fill_possible_interfaces(struct phy_device *phydev)
+{
+	unsigned long *possible = phydev->possible_interfaces;
+
+	__set_bit(PHY_INTERFACE_MODE_SGMII, possible);
+
+	if (!qca808x_is_1g_only(phydev))
+		__set_bit(PHY_INTERFACE_MODE_2500BASEX, possible);
+}
+
 static int qca808x_probe(struct phy_device *phydev)
 {
 	struct device *dev = &phydev->mdio.dev;
@@ -234,6 +244,8 @@ static int qca808x_config_init(struct phy_device *phydev)
 		}
 	}
 
+	qca808x_fill_possible_interfaces(phydev);
+
 	/* Configure adc threshold as 100mv for the link 10M */
 	return at803x_debug_reg_mask(phydev, QCA808X_PHY_DEBUG_ADC_THRESHOLD,
 				     QCA808X_ADC_THRESHOLD_MASK,
Signature · 1 line
2.43.2
#2 lore raw

Re: [PATCH net-next 1/2] net: phy: qcom: qca808x: add helper for checking for 1G only model

In reply to Robert Marko

drivers/net/phy/qcom/qca808x.c static bool qca808x_has_fast_retrain_or_slave_seed(struct phy_device *phydev) · line 170

Quoted 4 lines · Robert Marko
drivers/net/phy/qcom/qca808x.c +4 -0
+	if (QCA808X_PHY_CHIP_TYPE_1G & ret)
+		return true;
+	else
+		return false;
	return !!(QCA808X_PHY_CHIP_TYPE_1G & ret);

is a shorter way to write that.

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!