From: Wong Vee Khee <vee.khee.wong@linux.intel.com>
To: Russell King <linux@armlinux.org.uk>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Voon Weifeng <weifeng.voon@intel.com>,
Ong Boong Leong <boon.leong.ong@intel.com>
Subject: [PATCH net-next 1/1] net: phy: marvell10g: Add PHY loopback support for 88E2110 PHY
Date: Tue, 23 Mar 2021 16:48:53 +0800 [thread overview]
Message-ID: <20210323084853.25432-1-vee.khee.wong@linux.intel.com> (raw)
From: Tan Tee Min <tee.min.tan@intel.com>
Add support for PHY loopback for the Marvell 88E2110 PHY.
This allow user to perform selftest using ethtool.
Signed-off-by: Tan Tee Min <tee.min.tan@intel.com>
Signed-off-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
---
drivers/net/phy/marvell10g.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index b1bb9b8e1e4e..c45a8f11bdcf 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -89,6 +89,8 @@ enum {
MV_V2_TEMP_CTRL_DISABLE = 0xc000,
MV_V2_TEMP = 0xf08c,
MV_V2_TEMP_UNKNOWN = 0x9600, /* unknown function */
+
+ MV_LOOPBACK = BIT(14), /* Loopback (88E2110 only) */
};
struct mv3310_priv {
@@ -765,6 +767,15 @@ static int mv3310_set_tunable(struct phy_device *phydev,
}
}
+static int mv3310_loopback(struct phy_device *phydev, bool enable)
+{
+ if (phydev->drv->phy_id != MARVELL_PHY_ID_88E2110)
+ return -EOPNOTSUPP;
+
+ return phy_modify_mmd(phydev, MDIO_MMD_PCS, MV_PCS_BASE_T,
+ MV_LOOPBACK, enable ? MV_LOOPBACK : 0);
+}
+
static struct phy_driver mv3310_drivers[] = {
{
.phy_id = MARVELL_PHY_ID_88X3310,
@@ -796,6 +807,7 @@ static struct phy_driver mv3310_drivers[] = {
.get_tunable = mv3310_get_tunable,
.set_tunable = mv3310_set_tunable,
.remove = mv3310_remove,
+ .set_loopback = mv3310_loopback,
},
};
--
2.25.1
next reply other threads:[~2021-03-23 8:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-23 8:48 Wong Vee Khee [this message]
2021-03-23 9:37 ` [PATCH net-next 1/1] net: phy: marvell10g: Add PHY loopback support for 88E2110 PHY Heiner Kallweit
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=20210323084853.25432-1-vee.khee.wong@linux.intel.com \
--to=vee.khee.wong@linux.intel.com \
--cc=andrew@lunn.ch \
--cc=boon.leong.ong@intel.com \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=weifeng.voon@intel.com \
/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 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.