netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: mvneta: Fix validation of 2.5G HSGMII without comphy
@ 2020-11-15  0:41 Andreas Färber
  2020-11-15  1:02 ` Russell King - ARM Linux admin
  2020-11-15  8:48 ` Marek Behún
  0 siblings, 2 replies; 6+ messages in thread
From: Andreas Färber @ 2020-11-15  0:41 UTC (permalink / raw)
  To: David S . Miller, Thomas Petazzoni
  Cc: Uwe Kleine-König, Michal Hrusecki, Tomas Hlavacek,
	Bedřicha Košatu, Andreas Färber, Sascha Hauer,
	Marek Behún, Andrew Lunn, Jason Cooper, Gregory CLEMENT,
	Jakub Kicinski, Russell King, netdev, linux-kernel

Commit 1a642ca7f38992b086101fe204a1ae3c90ed8016 (net: ethernet: mvneta:
Add 2500BaseX support for SoCs without comphy) added support for 2500BaseX.

In case a comphy is not provided, mvneta_validate()'s check
  state->interface == PHY_INTERFACE_MODE_2500BASEX
could never be true (it would've returned with empty bitmask before),
so that 2500baseT_Full and 2500baseX_Full do net get added to the mask.

This causes phylink_sfp_config() to fail validation of 2.5G SFP support.

Address this by adding 2500baseX_Full and 2500baseT_Full to the mask for
  state->interface == PHY_INTERFACE_MODE_NA
as well.

Also handle PHY_INTERFACE_MODE_2500BASEX in two checks for allowed modes
and update a comment.

Tested with 2.5G and 1G SFPs on Turris Omnia before assigning comphy.

Fixes: 1a642ca7f389 ("net: ethernet: mvneta: Add 2500BaseX support for SoCs without comphy")
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Marek Behún <kabel@kernel.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 drivers/net/ethernet/marvell/mvneta.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 54b0bf574c05..c5016036de3a 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -3812,10 +3812,11 @@ static void mvneta_validate(struct phylink_config *config,
 	struct mvneta_port *pp = netdev_priv(ndev);
 	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
 
-	/* We only support QSGMII, SGMII, 802.3z and RGMII modes */
+	/* We only support QSGMII, SGMII, HSGMII, 802.3z and RGMII modes */
 	if (state->interface != PHY_INTERFACE_MODE_NA &&
 	    state->interface != PHY_INTERFACE_MODE_QSGMII &&
 	    state->interface != PHY_INTERFACE_MODE_SGMII &&
+	    state->interface != PHY_INTERFACE_MODE_2500BASEX &&
 	    !phy_interface_mode_is_8023z(state->interface) &&
 	    !phy_interface_mode_is_rgmii(state->interface)) {
 		bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
@@ -3834,7 +3835,8 @@ static void mvneta_validate(struct phylink_config *config,
 		phylink_set(mask, 1000baseT_Full);
 		phylink_set(mask, 1000baseX_Full);
 	}
-	if (pp->comphy || state->interface == PHY_INTERFACE_MODE_2500BASEX) {
+	if (pp->comphy || state->interface == PHY_INTERFACE_MODE_2500BASEX
+		       || state->interface == PHY_INTERFACE_MODE_NA) {
 		phylink_set(mask, 2500baseT_Full);
 		phylink_set(mask, 2500baseX_Full);
 	}
@@ -5038,6 +5040,7 @@ static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
 
 	if (phy_mode != PHY_INTERFACE_MODE_QSGMII &&
 	    phy_mode != PHY_INTERFACE_MODE_SGMII &&
+	    phy_mode != PHY_INTERFACE_MODE_2500BASEX &&
 	    !phy_interface_mode_is_8023z(phy_mode) &&
 	    !phy_interface_mode_is_rgmii(phy_mode))
 		return -EINVAL;
-- 
2.28.0


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

end of thread, other threads:[~2020-11-15 10:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-15  0:41 [PATCH net-next] net: mvneta: Fix validation of 2.5G HSGMII without comphy Andreas Färber
2020-11-15  1:02 ` Russell King - ARM Linux admin
2020-11-15  2:26   ` Andreas Färber
2020-11-15  8:56     ` Marek Behún
2020-11-15 10:04     ` Russell King - ARM Linux admin
2020-11-15  8:48 ` Marek Behún

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).