netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Marek Behún" <kabel@kernel.org>
To: netdev@vger.kernel.org, Russell King <rmk+kernel@armlinux.org.uk>
Cc: "David S . Miller" <davem@davemloft.net>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	kuba@kernel.org, "Marek Behún" <kabel@kernel.org>
Subject: [PATCH net-next v3 13/18] net: phy: marvell10g: add separate structure for 88X3340
Date: Wed,  7 Apr 2021 00:11:02 +0200	[thread overview]
Message-ID: <20210406221107.1004-14-kabel@kernel.org> (raw)
In-Reply-To: <20210406221107.1004-1-kabel@kernel.org>

The 88X3340 contains 4 cores similar to 88X3310, but there is a
difference: it does not support xaui host mode. Instead the
corresponding MACTYPE means
  rxaui / 5gbase-r / 2500base-x / sgmii without AN

Signed-off-by: Marek Behún <kabel@kernel.org>
---
 drivers/net/phy/marvell10g.c | 55 ++++++++++++++++++++++++++++++++++--
 include/linux/marvell_phy.h  |  6 +++-
 2 files changed, 58 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index 2fd823318de8..74a91853ef46 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -553,6 +553,21 @@ static int mv3310_init_interface(struct phy_device *phydev, int mactype)
 	return 0;
 }
 
+static int mv3340_init_interface(struct phy_device *phydev, int mactype)
+{
+	struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
+	int err = 0;
+
+	priv->rate_match = false;
+
+	if (mactype == MV_V2_3340_PORT_CTRL_MACTYPE_RXAUI_NO_SGMII_AN)
+		priv->const_interface = PHY_INTERFACE_MODE_RXAUI;
+	else
+		err = mv3310_init_interface(phydev, mactype);
+
+	return err;
+}
+
 static int mv3310_config_init(struct phy_device *phydev)
 {
 	const struct mv3310_chip *chip = to_mv3310_chip(phydev);
@@ -886,6 +901,23 @@ static const struct mv3310_chip mv3310_type = {
 #endif
 };
 
+static const struct mv3310_chip mv3340_type = {
+	.supported_interfaces =
+		INITIALIZE_BITMAP(PHY_INTERFACE_MODE_MAX,
+				  PHY_INTERFACE_MODE_SGMII,
+				  PHY_INTERFACE_MODE_2500BASEX,
+				  PHY_INTERFACE_MODE_5GBASER,
+				  PHY_INTERFACE_MODE_RXAUI,
+				  PHY_INTERFACE_MODE_10GBASER,
+				  PHY_INTERFACE_MODE_USXGMII),
+	.get_mactype = mv3310_get_mactype,
+	.init_interface = mv3340_init_interface,
+
+#ifdef CONFIG_HWMON
+	.hwmon_read_temp_reg = mv3310_hwmon_read_temp_reg,
+#endif
+};
+
 static const struct mv3310_chip mv2110_type = {
 	.supported_interfaces =
 		INITIALIZE_BITMAP(PHY_INTERFACE_MODE_MAX,
@@ -905,7 +937,7 @@ static const struct mv3310_chip mv2110_type = {
 static struct phy_driver mv3310_drivers[] = {
 	{
 		.phy_id		= MARVELL_PHY_ID_88X3310,
-		.phy_id_mask	= MARVELL_PHY_ID_MASK,
+		.phy_id_mask	= MARVELL_PHY_ID_88X33X0_MASK,
 		.name		= "mv88x3310",
 		.driver_data	= &mv3310_type,
 		.get_features	= mv3310_get_features,
@@ -921,6 +953,24 @@ static struct phy_driver mv3310_drivers[] = {
 		.remove		= mv3310_remove,
 		.set_loopback	= genphy_c45_loopback,
 	},
+	{
+		.phy_id		= MARVELL_PHY_ID_88X3340,
+		.phy_id_mask	= MARVELL_PHY_ID_88X33X0_MASK,
+		.name		= "mv88x3340",
+		.driver_data	= &mv3340_type,
+		.get_features	= mv3310_get_features,
+		.config_init	= mv3310_config_init,
+		.probe		= mv3310_probe,
+		.suspend	= mv3310_suspend,
+		.resume		= mv3310_resume,
+		.config_aneg	= mv3310_config_aneg,
+		.aneg_done	= mv3310_aneg_done,
+		.read_status	= mv3310_read_status,
+		.get_tunable	= mv3310_get_tunable,
+		.set_tunable	= mv3310_set_tunable,
+		.remove		= mv3310_remove,
+		.set_loopback	= genphy_c45_loopback,
+	},
 	{
 		.phy_id		= MARVELL_PHY_ID_88E2110,
 		.phy_id_mask	= MARVELL_PHY_ID_MASK,
@@ -943,7 +993,8 @@ static struct phy_driver mv3310_drivers[] = {
 module_phy_driver(mv3310_drivers);
 
 static struct mdio_device_id __maybe_unused mv3310_tbl[] = {
-	{ MARVELL_PHY_ID_88X3310, MARVELL_PHY_ID_MASK },
+	{ MARVELL_PHY_ID_88X3310, MARVELL_PHY_ID_88X33X0_MASK },
+	{ MARVELL_PHY_ID_88X3340, MARVELL_PHY_ID_88X33X0_MASK },
 	{ MARVELL_PHY_ID_88E2110, MARVELL_PHY_ID_MASK },
 	{ },
 };
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index 274abd5fbac3..6b11a5411082 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -22,10 +22,14 @@
 #define MARVELL_PHY_ID_88E1545		0x01410ea0
 #define MARVELL_PHY_ID_88E1548P		0x01410ec0
 #define MARVELL_PHY_ID_88E3016		0x01410e60
-#define MARVELL_PHY_ID_88X3310		0x002b09a0
 #define MARVELL_PHY_ID_88E2110		0x002b09b0
 #define MARVELL_PHY_ID_88X2222		0x01410f10
 
+/* PHY IDs and mask for Alaska 10G PHYs */
+#define MARVELL_PHY_ID_88X33X0_MASK	0xfffffff8
+#define MARVELL_PHY_ID_88X3310		0x002b09a0
+#define MARVELL_PHY_ID_88X3340		0x002b09a8
+
 /* Marvel 88E1111 in Finisar SFP module with modified PHY ID */
 #define MARVELL_PHY_ID_88E1111_FINISAR	0x01ff0cc0
 
-- 
2.26.2


  parent reply	other threads:[~2021-04-06 22:12 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06 22:10 [PATCH net-next v3 00/18] net: phy: marvell10g updates Marek Behún
2021-04-06 22:10 ` [PATCH net-next v3 01/18] net: phy: marvell10g: rename register Marek Behún
2021-04-06 22:37   ` Andrew Lunn
2021-04-06 22:10 ` [PATCH net-next v3 02/18] net: phy: marvell10g: fix typo Marek Behún
2021-04-06 22:38   ` Andrew Lunn
2021-04-06 22:10 ` [PATCH net-next v3 03/18] net: phy: marvell10g: allow 5gbase-r and usxgmii Marek Behún
2021-04-06 22:39   ` Andrew Lunn
2021-04-06 22:10 ` [PATCH net-next v3 04/18] net: phy: marvell10g: indicate 88X33x0 only port control registers Marek Behún
2021-04-07  0:10   ` Andrew Lunn
2021-04-07  0:22     ` Marek Behún
2021-04-06 22:10 ` [PATCH net-next v3 05/18] net: phy: marvell10g: add all MACTYPE definitions for 88X33x0 Marek Behún
2021-04-06 23:22   ` Andrew Lunn
2021-04-06 22:10 ` [PATCH net-next v3 06/18] net: phy: marvell10g: add MACTYPE definitions for 88E21xx Marek Behún
2021-04-06 23:22   ` Andrew Lunn
2021-04-06 22:10 ` [PATCH net-next v3 07/18] net: phy: marvell10g: support all rate matching modes Marek Behún
2021-04-06 23:30   ` Andrew Lunn
2021-04-06 23:36     ` Marek Behún
2021-04-06 23:33   ` Andrew Lunn
2021-04-06 23:53     ` Marek Behún
2021-04-06 22:10 ` [PATCH net-next v3 08/18] include: add library helpers for variadic macro expansion Marek Behún
2021-04-06 22:10 ` [PATCH net-next v3 09/18] include: bitmap: add macro for bitmap initialization Marek Behún
2021-04-06 23:38   ` Andrew Lunn
2021-04-06 23:50     ` Marek Behún
2021-04-06 22:10 ` [PATCH net-next v3 10/18] net: phy: marvell10g: check for correct supported interface mode Marek Behún
2021-04-06 23:40   ` Andrew Lunn
2021-04-06 22:11 ` [PATCH net-next v3 11/18] net: phy: marvell10g: store temperature read method in chip strucutre Marek Behún
2021-04-06 23:42   ` Andrew Lunn
2021-04-06 22:11 ` [PATCH net-next v3 12/18] net: phy: marvell10g: support other MACTYPEs Marek Behún
2021-04-06 22:11 ` Marek Behún [this message]
2021-04-06 23:47   ` [PATCH net-next v3 13/18] net: phy: marvell10g: add separate structure for 88X3340 Andrew Lunn
2021-04-06 22:11 ` [PATCH net-next v3 14/18] net: phy: marvell10g: fix driver name for mv88e2110 Marek Behún
2021-04-06 23:49   ` Andrew Lunn
2021-04-06 22:11 ` [PATCH net-next v3 15/18] net: phy: add constants for 2.5G and 5G speed in PCS speed register Marek Behún
2021-04-06 23:59   ` Andrew Lunn
2021-04-06 22:11 ` [PATCH net-next v3 16/18] net: phy: marvell10g: differentiate 88E2110 vs 88E2111 Marek Behún
2021-04-07  0:01   ` Andrew Lunn
2021-04-06 22:11 ` [PATCH net-next v3 17/18] net: phy: marvell10g: change module description Marek Behún
2021-04-07  0:01   ` Andrew Lunn
2021-04-06 22:11 ` [PATCH net-next v3 18/18] MAINTAINERS: add myself as maintainer of marvell10g driver 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=20210406221107.1004-14-kabel@kernel.org \
    --to=kabel@kernel.org \
    --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).