Skip to contentSkip to conversation

Add support for Clause-45 PHY Loopback

PATCH Applied Wong Vee Khee 4 participants 7 messages Mar 23, 2021 – Mar 24, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Add support for Clause-45 PHY Loopback

This patch series add support for Clause-45 PHY loopback.

It involves adding a generic API in the PHY framework, which can be accessed by all C45 PHY drivers using the .set_loopback callback.

Also, enable PHY loopback for the Marvell 88x3310/88x2110 driver.

Wong Vee Khee (2):
net: phy: add genphy_c45_loopback
net: phy: marvell10g: Add PHY loopback support

 drivers/net/phy/marvell10g.c | 2 ++
 drivers/net/phy/phy-c45.c    | 8 ++++++++
 include/linux/phy.h          | 1 +
 3 files changed, 11 insertions(+)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 net: phy: add genphy_c45_loopback

Add generic code to enable C45 PHY loopback into the common phy-c45.c file. This will allow C45 PHY drivers aceess this by setting .set_loopback.

---
 drivers/net/phy/phy-c45.c | 8 ++++++++
 include/linux/phy.h       | 1 +
 2 files changed, 9 insertions(+)
drivers/net/phy/phy-c45.c +8 -0
index 077f2929c45e..91e3acb9e397 100644
@@ -560,6 +560,14 @@ int gen10g_config_aneg(struct phy_device *phydev)
 }
 EXPORT_SYMBOL_GPL(gen10g_config_aneg);
 
+int genphy_c45_loopback(struct phy_device *phydev, bool enable)
+{
+	return phy_modify_mmd(phydev, MDIO_MMD_PCS, MDIO_CTRL1,
+			      MDIO_PCS_CTRL1_LOOPBACK,
+			      enable ? MDIO_PCS_CTRL1_LOOPBACK : 0);
+}
+EXPORT_SYMBOL_GPL(genphy_c45_loopback);
+
 struct phy_driver genphy_c45_driver = {
 	.phy_id         = 0xffffffff,
 	.phy_id_mask    = 0xffffffff,
include/linux/phy.h +1 -0
index 1a12e4436b5b..8e2cf84b2318 100644
@@ -1532,6 +1532,7 @@ int genphy_c45_read_mdix(struct phy_device *phydev);
 int genphy_c45_pma_read_abilities(struct phy_device *phydev);
 int genphy_c45_read_status(struct phy_device *phydev);
 int genphy_c45_config_aneg(struct phy_device *phydev);
+int genphy_c45_loopback(struct phy_device *phydev, bool enable);
 
 /* Generic C45 PHY driver */
 extern struct phy_driver genphy_c45_driver;
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH net-next 1/2] net: phy: add genphy_c45_loopback

Quoted 11 lines · Wong Vee Khee

Add generic code to enable C45 PHY loopback into the common phy-c45.c file. This will allow C45 PHY drivers aceess this by setting .set_loopback.

---
 drivers/net/phy/phy-c45.c | 8 ++++++++
 include/linux/phy.h       | 1 +
 2 files changed, 9 insertions(+)

LGTM

#4 lore raw

PATCH 2/2 net: phy: marvell10g: Add PHY loopback support

In reply to Wong Vee Khee

Add support for PHY loopback for Marvell 88x2110 and Marvell 88x3310.

This allow user to perform PHY loopback test using ethtool selftest.

---
 drivers/net/phy/marvell10g.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/phy/marvell10g.c +2 -0
index b1bb9b8e1e4e..74b64e52ffa2 100644
@@ -781,6 +781,7 @@ static struct phy_driver mv3310_drivers[] = {
 		.get_tunable	= mv3310_get_tunable,
 		.set_tunable	= mv3310_set_tunable,
 		.remove		= mv3310_remove,
+		.set_loopback	= genphy_c45_loopback,
 	},
 	{
 		.phy_id		= MARVELL_PHY_ID_88E2110,
@@ -796,6 +797,7 @@ static struct phy_driver mv3310_drivers[] = {
 		.get_tunable	= mv3310_get_tunable,
 		.set_tunable	= mv3310_set_tunable,
 		.remove		= mv3310_remove,
+		.set_loopback	= genphy_c45_loopback,
 	},
 };
 
Signature · 1 line
2.25.1
#6 lore raw
In reply to Wong Vee Khee
This series was applied to netdev/net-next.git (refs/heads/master):

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

Quoted 8 lines · On Wed, 24 Mar 2021 00:46:39 +0800 you wrote:

This patch series add support for Clause-45 PHY loopback.

It involves adding a generic API in the PHY framework, which can be accessed by all C45 PHY drivers using the .set_loopback callback.

Also, enable PHY loopback for the Marvell 88x3310/88x2110 driver.

[...]

Here is the summary with links:
- [net-next,1/2] net: phy: add genphy_c45_loopback

    https://git.kernel.org/netdev/net-next/c/0ef25ed104ac
  - [net-next,2/2] net: phy: marvell10g: Add PHY loopback support
    https://git.kernel.org/netdev/net-next/c/d137c70d0e7a

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html