Thread (21 messages) flat view 21 messages, 3 authors, 2021-03-26
STALE1976d

Revision v2 of 3 in this series.

Revisions (3)
  1. v2 current
  2. v3 [diff vs current]
  3. v4 [diff vs current]

[PATCH net-next v2 11/12] net: phy: marvell10g: print exact model

From: Marek Behún <kabel@kernel.org>
Date: 2021-03-25 13:14:40
Subsystem: ethernet phy library, marvell mv88x3310 phy driver, networking drivers, the rest · Maintainers: Andrew Lunn, Heiner Kallweit, Russell King, Marek Behún, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Print exact mode, one of
  88E2110
  88E2111
  88E2180
  88E2181
  88X3310
  88X3310P
  88X3340
  88X3340P

Signed-off-by: Marek Behún <kabel@kernel.org>
---
 drivers/net/phy/marvell10g.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index 6df67c12f012..84f24fcb832c 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -33,6 +33,8 @@
 #define MV_PHY_ALASKA_NBT_QUIRK_REV	(MARVELL_PHY_ID_88X3310 | 0xa)
 
 enum {
+	MV_PMA_XGSTAT		= 0xc001,
+	MV_PMA_XGSTAT_NO_MACSEC	= BIT(12),
 	MV_PMA_FW_VER0		= 0xc011,
 	MV_PMA_FW_VER1		= 0xc012,
 	MV_PMA_21X0_PORT_CTRL	= 0xc04a,
@@ -397,6 +399,7 @@ static int mv3310_probe(struct phy_device *phydev)
 {
 	struct mv3310_priv *priv;
 	u32 mmd_mask = MDIO_DEVS_PMAPMD | MDIO_DEVS_AN;
+	bool has_5g, has_macsec;
 	int ret, nports;
 
 	if (!phydev->is_c45 ||
@@ -443,12 +446,24 @@ static int mv3310_probe(struct phy_device *phydev)
 
 	switch (phydev->drv->phy_id) {
 	case MARVELL_PHY_ID_88X3310:
+		ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_XGSTAT);
+		if (ret < 0)
+			return ret;
+
+		has_macsec = !(ret & MV_PMA_XGSTAT_NO_MACSEC);
+
 		if (nports == 4)
 			priv->model = MV_MODEL_88X3340;
 		else if (nports == 1)
 			priv->model = MV_MODEL_88X3310;
 		break;
 	case MARVELL_PHY_ID_88E2110:
+		ret = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_SPEED);
+		if (ret < 0)
+			return ret;
+
+		has_5g = ret & MDIO_PCS_SPEED_5G;
+
 		if (nports == 8)
 			priv->model = MV_MODEL_88E218X;
 		else if (nports == 1)
@@ -458,7 +473,17 @@ static int mv3310_probe(struct phy_device *phydev)
 		unreachable();
 	}
 
-	if (!priv->model) {
+	switch (priv->model) {
+	case MV_MODEL_88E211X:
+	case MV_MODEL_88E218X:
+		phydev_info(phydev, "model 88E21%d%d\n", nports, !has_5g);
+		break;
+	case MV_MODEL_88X3310:
+	case MV_MODEL_88X3340:
+		phydev_info(phydev, "model 88X33%d0%s\n", nports,
+			    has_macsec ? "P" : "");
+		break;
+	default:
 		phydev_err(phydev, "unknown PHY model (nports = %i)\n", nports);
 		return -ENODEV;
 	}
-- 
2.26.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help