From: "Marek Behún" <kabel@kernel.org>
To: netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <rmk+kernel@armlinux.org.uk>,
kuba@kernel.org
Cc: "Marek Behún" <kabel@kernel.org>
Subject: [PATCH net-next v2 11/12] net: phy: marvell10g: print exact model
Date: Thu, 25 Mar 2021 14:12:49 +0100 [thread overview]
Message-ID: <20210325131250.15901-12-kabel@kernel.org> (raw)
In-Reply-To: <20210325131250.15901-1-kabel@kernel.org>
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
next prev parent reply other threads:[~2021-03-25 13:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-25 13:12 [PATCH net-next v2 00/12] net: phy: marvell10g updates Marek Behún
2021-03-25 13:12 ` [PATCH net-next v2 01/12] net: phy: marvell10g: rename register Marek Behún
2021-03-25 13:12 ` [PATCH net-next v2 02/12] net: phy: marvell10g: fix typo Marek Behún
2021-03-25 13:12 ` [PATCH net-next v2 03/12] net: phy: marvell10g: allow 5gbase-r and usxgmii Marek Behún
2021-03-25 13:12 ` [PATCH net-next v2 04/12] net: phy: marvell10g: indicate 88X33X0 only port control registers Marek Behún
2021-03-25 13:12 ` [PATCH net-next v2 05/12] net: phy: marvell10g: add MACTYPE definitions for 88X33X0/88X33X0P Marek Behún
2021-03-25 13:12 ` [PATCH net-next v2 06/12] net: phy: marvell10g: add MACTYPE definitions for 88E21XX Marek Behún
2021-03-25 13:12 ` [PATCH net-next v2 07/12] net: phy: marvell10g: add code to determine number of ports Marek Behún
2021-03-25 13:12 ` [PATCH net-next v2 08/12] net: phy: marvell10g: support all rate matching modes Marek Behún
2021-03-25 13:12 ` [PATCH net-next v2 09/12] net: phy: marvell10g: support other MACTYPEs Marek Behún
2021-03-25 13:12 ` [PATCH net-next v2 10/12] net: phy: add constants for 2.5G and 5G speed in PCS speed register Marek Behún
2021-03-25 13:12 ` Marek Behún [this message]
2021-03-25 15:36 ` [PATCH net-next v2 11/12] net: phy: marvell10g: print exact model Marek Behún
2021-03-25 15:54 ` Russell King - ARM Linux admin
2021-03-25 16:56 ` Marek Behún
2021-03-25 20:29 ` Marek Behún
2021-03-25 20:44 ` Heiner Kallweit
2021-03-25 20:54 ` Marek Behún
2021-03-26 9:07 ` Russell King - ARM Linux admin
2021-03-26 11:11 ` Marek Behún
2021-03-25 13:12 ` [PATCH net-next v2 12/12] net: phy: marvell10g: better check for compatible interface Marek Behún
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210325131250.15901-12-kabel@kernel.org \
--to=kabel@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rmk+kernel@armlinux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).