All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/2] net: phy: qcom: qca808x: fill in possible_interfaces
@ 2024-02-28 17:24 Robert Marko
  2024-02-28 17:24 ` [PATCH net-next v2 1/2] net: phy: qcom: qca808x: add helper for checking for 1G only model Robert Marko
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Robert Marko @ 2024-02-28 17:24 UTC (permalink / raw
  To: andersson, konrad.dybcio, andrew, hkallweit1, linux, davem,
	edumazet, kuba, pabeni, linux-arm-msm, netdev, linux-kernel
  Cc: Robert Marko

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.

Changes in v2:
* Get rid of the if/else by Russels suggestion in the helper

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 | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

-- 
2.44.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next v2 1/2] net: phy: qcom: qca808x: add helper for checking for 1G only model
  2024-02-28 17:24 [PATCH net-next v2 0/2] net: phy: qcom: qca808x: fill in possible_interfaces Robert Marko
@ 2024-02-28 17:24 ` Robert Marko
  2024-02-28 17:24 ` [PATCH net-next v2 2/2] net: phy: qcom: qca808x: fill in possible_interfaces Robert Marko
  2024-03-01  9:00 ` [PATCH net-next v2 0/2] " patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Robert Marko @ 2024-02-28 17:24 UTC (permalink / raw
  To: andersson, konrad.dybcio, andrew, hkallweit1, linux, davem,
	edumazet, kuba, pabeni, linux-arm-msm, netdev, linux-kernel
  Cc: Robert Marko

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.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
Changes in v2:
* Get rid of the if/else by Russels suggestion

 drivers/net/phy/qcom/qca808x.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/net/phy/qcom/qca808x.c b/drivers/net/phy/qcom/qca808x.c
index 2acf852fb4de..a4c61a8e07c3 100644
--- a/drivers/net/phy/qcom/qca808x.c
+++ b/drivers/net/phy/qcom/qca808x.c
@@ -156,6 +156,17 @@ 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;
+
+	return !!(QCA808X_PHY_CHIP_TYPE_1G & ret);
+}
+
 static int qca808x_probe(struct phy_device *phydev)
 {
 	struct device *dev = &phydev->mdio.dev;
@@ -350,11 +361,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;
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next v2 2/2] net: phy: qcom: qca808x: fill in possible_interfaces
  2024-02-28 17:24 [PATCH net-next v2 0/2] net: phy: qcom: qca808x: fill in possible_interfaces Robert Marko
  2024-02-28 17:24 ` [PATCH net-next v2 1/2] net: phy: qcom: qca808x: add helper for checking for 1G only model Robert Marko
@ 2024-02-28 17:24 ` Robert Marko
  2024-02-28 18:04   ` Russell King (Oracle)
  2024-03-01  9:00 ` [PATCH net-next v2 0/2] " patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Robert Marko @ 2024-02-28 17:24 UTC (permalink / raw
  To: andersson, konrad.dybcio, andrew, hkallweit1, linux, davem,
	edumazet, kuba, pabeni, linux-arm-msm, netdev, linux-kernel
  Cc: 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.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
 drivers/net/phy/qcom/qca808x.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/phy/qcom/qca808x.c b/drivers/net/phy/qcom/qca808x.c
index a4c61a8e07c3..5048304ccc9e 100644
--- a/drivers/net/phy/qcom/qca808x.c
+++ b/drivers/net/phy/qcom/qca808x.c
@@ -167,6 +167,16 @@ static bool qca808x_is_1g_only(struct phy_device *phydev)
 	return !!(QCA808X_PHY_CHIP_TYPE_1G & ret);
 }
 
+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;
@@ -231,6 +241,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,
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next v2 2/2] net: phy: qcom: qca808x: fill in possible_interfaces
  2024-02-28 17:24 ` [PATCH net-next v2 2/2] net: phy: qcom: qca808x: fill in possible_interfaces Robert Marko
@ 2024-02-28 18:04   ` Russell King (Oracle)
  0 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2024-02-28 18:04 UTC (permalink / raw
  To: Robert Marko
  Cc: andersson, konrad.dybcio, andrew, hkallweit1, davem, edumazet,
	kuba, pabeni, linux-arm-msm, netdev, linux-kernel

On Wed, Feb 28, 2024 at 06:24:10PM +0100, Robert Marko wrote:
> 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.
> 
> Signed-off-by: Robert Marko <robimarko@gmail.com>

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks!

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next v2 0/2] net: phy: qcom: qca808x: fill in possible_interfaces
  2024-02-28 17:24 [PATCH net-next v2 0/2] net: phy: qcom: qca808x: fill in possible_interfaces Robert Marko
  2024-02-28 17:24 ` [PATCH net-next v2 1/2] net: phy: qcom: qca808x: add helper for checking for 1G only model Robert Marko
  2024-02-28 17:24 ` [PATCH net-next v2 2/2] net: phy: qcom: qca808x: fill in possible_interfaces Robert Marko
@ 2024-03-01  9:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-03-01  9:00 UTC (permalink / raw
  To: Robert Marko
  Cc: andersson, konrad.dybcio, andrew, hkallweit1, linux, davem,
	edumazet, kuba, pabeni, linux-arm-msm, netdev, linux-kernel

Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Wed, 28 Feb 2024 18:24:08 +0100 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/2] net: phy: qcom: qca808x: add helper for checking for 1G only model
    https://git.kernel.org/netdev/net-next/c/f058b2dd70b1
  - [net-next,v2,2/2] net: phy: qcom: qca808x: fill in possible_interfaces
    https://git.kernel.org/netdev/net-next/c/cb28f7029606

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-01  9:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-28 17:24 [PATCH net-next v2 0/2] net: phy: qcom: qca808x: fill in possible_interfaces Robert Marko
2024-02-28 17:24 ` [PATCH net-next v2 1/2] net: phy: qcom: qca808x: add helper for checking for 1G only model Robert Marko
2024-02-28 17:24 ` [PATCH net-next v2 2/2] net: phy: qcom: qca808x: fill in possible_interfaces Robert Marko
2024-02-28 18:04   ` Russell King (Oracle)
2024-03-01  9:00 ` [PATCH net-next v2 0/2] " patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.