All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch net-next v3 0/2] add ethtool SQI support for LAN87xx T1 Phy
@ 2022-04-20 15:20 Arun Ramadoss
  2022-04-20 15:20 ` [Patch net-next v3 1/2] net: phy: LAN87xx: add ethtool SQI support Arun Ramadoss
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Arun Ramadoss @ 2022-04-20 15:20 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Paolo Abeni, Jakub Kicinski, David S. Miller, Russell King,
	Heiner Kallweit, Andrew Lunn, UNGLinuxDriver, Arun Ramadoss

This patch series add the Signal Quality Index measurement for the LAN87xx and
LAN937x T1 phy. Updated the maintainers file for microchip_t1.c.

v2 - v3
------
Rebased to latest commit

v1 - v2
------
- Seperated the PHY_POLL_CABLE_TEST flag patch as a fix to net tree.
- Updated the individual people as Maintainer.

Arun Ramadoss (2):
  net: phy: LAN87xx: add ethtool SQI support
  MAINTAINERS: Add maintainers for Microchip T1 Phy driver

 MAINTAINERS                    |  7 +++++
 drivers/net/phy/microchip_t1.c | 48 ++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)


base-commit: 365014f5c39422fa7ccd75b36235155d9041f883
-- 
2.33.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Patch net-next v3 1/2] net: phy: LAN87xx: add ethtool SQI support
  2022-04-20 15:20 [Patch net-next v3 0/2] add ethtool SQI support for LAN87xx T1 Phy Arun Ramadoss
@ 2022-04-20 15:20 ` Arun Ramadoss
  2022-04-20 15:20 ` [Patch net-next v3 2/2] MAINTAINERS: Add maintainers for Microchip T1 Phy driver Arun Ramadoss
  2022-04-22 23:40 ` [Patch net-next v3 0/2] add ethtool SQI support for LAN87xx T1 Phy patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Arun Ramadoss @ 2022-04-20 15:20 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Paolo Abeni, Jakub Kicinski, David S. Miller, Russell King,
	Heiner Kallweit, Andrew Lunn, UNGLinuxDriver, Arun Ramadoss

This patch add the support for measuring Signal Quality Index for
LAN87xx and LAN937x T1 Phy. It uses the SQI Method 5 for obtaining the
values.

Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/phy/microchip_t1.c | 48 ++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c
index 3f79bbbe62d3..54f1fab9d8f8 100644
--- a/drivers/net/phy/microchip_t1.c
+++ b/drivers/net/phy/microchip_t1.c
@@ -68,7 +68,12 @@
 #define T1_POST_LCK_MUFACT_CFG_REG	0x1C
 #define T1_TX_RX_FIFO_CFG_REG		0x02
 #define T1_TX_LPF_FIR_CFG_REG		0x55
+#define T1_COEF_CLK_PWR_DN_CFG		0x04
+#define T1_COEF_RW_CTL_CFG		0x0D
 #define T1_SQI_CONFIG_REG		0x2E
+#define T1_SQI_CONFIG2_REG		0x4A
+#define T1_DCQ_SQI_REG			0xC3
+#define T1_DCQ_SQI_MSK			GENMASK(3, 1)
 #define T1_MDIO_CONTROL2_REG		0x10
 #define T1_INTERRUPT_SOURCE_REG		0x18
 #define T1_INTERRUPT2_SOURCE_REG	0x08
@@ -82,6 +87,9 @@
 #define T1_MODE_STAT_REG		0x11
 #define T1_LINK_UP_MSK			BIT(0)
 
+/* SQI defines */
+#define LAN87XX_MAX_SQI			0x07
+
 #define DRIVER_AUTHOR	"Nisar Sayed <nisar.sayed@microchip.com>"
 #define DRIVER_DESC	"Microchip LAN87XX/LAN937x T1 PHY driver"
 
@@ -346,9 +354,20 @@ static int lan87xx_phy_init(struct phy_device *phydev)
 		  T1_TX_LPF_FIR_CFG_REG, 0x1011, 0 },
 		{ PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP,
 		  T1_TX_LPF_FIR_CFG_REG, 0x1000, 0 },
+		/* Setup SQI measurement */
+		{ PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP,
+		  T1_COEF_CLK_PWR_DN_CFG,	0x16d6, 0 },
 		/* SQI enable */
 		{ PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP,
 		  T1_SQI_CONFIG_REG,		0x9572, 0 },
+		/* SQI select mode 5 */
+		{ PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP,
+		  T1_SQI_CONFIG2_REG,		0x0001, 0 },
+		/* Throws the first SQI reading */
+		{ PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_DSP,
+		  T1_COEF_RW_CTL_CFG,		0x0301,	0 },
+		{ PHYACC_ATTR_MODE_READ, PHYACC_ATTR_BANK_DSP,
+		  T1_DCQ_SQI_REG,		0,	0 },
 		/* Flag LPS and WUR as idle errors */
 		{ PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_SMI,
 		  T1_MDIO_CONTROL2_REG,		0x0014, 0 },
@@ -724,6 +743,31 @@ static int lan87xx_config_aneg(struct phy_device *phydev)
 	return phy_modify_changed(phydev, MII_CTRL1000, CTL1000_AS_MASTER, ctl);
 }
 
+static int lan87xx_get_sqi(struct phy_device *phydev)
+{
+	u8 sqi_value = 0;
+	int rc;
+
+	rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE,
+			 PHYACC_ATTR_BANK_DSP, T1_COEF_RW_CTL_CFG, 0x0301);
+	if (rc < 0)
+		return rc;
+
+	rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ,
+			 PHYACC_ATTR_BANK_DSP, T1_DCQ_SQI_REG, 0x0);
+	if (rc < 0)
+		return rc;
+
+	sqi_value = FIELD_GET(T1_DCQ_SQI_MSK, rc);
+
+	return sqi_value;
+}
+
+static int lan87xx_get_sqi_max(struct phy_device *phydev)
+{
+	return LAN87XX_MAX_SQI;
+}
+
 static struct phy_driver microchip_t1_phy_driver[] = {
 	{
 		PHY_ID_MATCH_MODEL(PHY_ID_LAN87XX),
@@ -737,6 +781,8 @@ static struct phy_driver microchip_t1_phy_driver[] = {
 		.resume         = genphy_resume,
 		.config_aneg    = lan87xx_config_aneg,
 		.read_status	= lan87xx_read_status,
+		.get_sqi	= lan87xx_get_sqi,
+		.get_sqi_max	= lan87xx_get_sqi_max,
 		.cable_test_start = lan87xx_cable_test_start,
 		.cable_test_get_status = lan87xx_cable_test_get_status,
 	},
@@ -749,6 +795,8 @@ static struct phy_driver microchip_t1_phy_driver[] = {
 		.resume		= genphy_resume,
 		.config_aneg    = lan87xx_config_aneg,
 		.read_status	= lan87xx_read_status,
+		.get_sqi	= lan87xx_get_sqi,
+		.get_sqi_max	= lan87xx_get_sqi_max,
 		.cable_test_start = lan87xx_cable_test_start,
 		.cable_test_get_status = lan87xx_cable_test_get_status,
 	}
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Patch net-next v3 2/2] MAINTAINERS: Add maintainers for Microchip T1 Phy driver
  2022-04-20 15:20 [Patch net-next v3 0/2] add ethtool SQI support for LAN87xx T1 Phy Arun Ramadoss
  2022-04-20 15:20 ` [Patch net-next v3 1/2] net: phy: LAN87xx: add ethtool SQI support Arun Ramadoss
@ 2022-04-20 15:20 ` Arun Ramadoss
  2022-04-22 23:40 ` [Patch net-next v3 0/2] add ethtool SQI support for LAN87xx T1 Phy patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Arun Ramadoss @ 2022-04-20 15:20 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Paolo Abeni, Jakub Kicinski, David S. Miller, Russell King,
	Heiner Kallweit, Andrew Lunn, UNGLinuxDriver, Arun Ramadoss

Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 25d2a5d417bc..1adf2cac1865 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12920,6 +12920,13 @@ F:	drivers/net/dsa/microchip/*
 F:	include/linux/platform_data/microchip-ksz.h
 F:	net/dsa/tag_ksz.c
 
+MICROCHIP LAN87xx/LAN937x T1 PHY DRIVER
+M:	Arun Ramadoss <arun.ramadoss@microchip.com>
+R:	UNGLinuxDriver@microchip.com
+L:	netdev@vger.kernel.org
+S:	Maintained
+F:	drivers/net/phy/microchip_t1.c
+
 MICROCHIP LAN743X ETHERNET DRIVER
 M:	Bryan Whitehead <bryan.whitehead@microchip.com>
 M:	UNGLinuxDriver@microchip.com
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Patch net-next v3 0/2] add ethtool SQI support for LAN87xx T1 Phy
  2022-04-20 15:20 [Patch net-next v3 0/2] add ethtool SQI support for LAN87xx T1 Phy Arun Ramadoss
  2022-04-20 15:20 ` [Patch net-next v3 1/2] net: phy: LAN87xx: add ethtool SQI support Arun Ramadoss
  2022-04-20 15:20 ` [Patch net-next v3 2/2] MAINTAINERS: Add maintainers for Microchip T1 Phy driver Arun Ramadoss
@ 2022-04-22 23:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-04-22 23:40 UTC (permalink / raw)
  To: Arun Ramadoss
  Cc: netdev, linux-kernel, pabeni, kuba, davem, linux, hkallweit1,
	andrew, UNGLinuxDriver

Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 20 Apr 2022 20:50:14 +0530 you wrote:
> This patch series add the Signal Quality Index measurement for the LAN87xx and
> LAN937x T1 phy. Updated the maintainers file for microchip_t1.c.
> 
> v2 - v3
> ------
> Rebased to latest commit
> 
> [...]

Here is the summary with links:
  - [net-next,v3,1/2] net: phy: LAN87xx: add ethtool SQI support
    https://git.kernel.org/netdev/net-next/c/b649695248b1
  - [net-next,v3,2/2] MAINTAINERS: Add maintainers for Microchip T1 Phy driver
    https://git.kernel.org/netdev/net-next/c/58f373f8d787

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-22 23:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20 15:20 [Patch net-next v3 0/2] add ethtool SQI support for LAN87xx T1 Phy Arun Ramadoss
2022-04-20 15:20 ` [Patch net-next v3 1/2] net: phy: LAN87xx: add ethtool SQI support Arun Ramadoss
2022-04-20 15:20 ` [Patch net-next v3 2/2] MAINTAINERS: Add maintainers for Microchip T1 Phy driver Arun Ramadoss
2022-04-22 23:40 ` [Patch net-next v3 0/2] add ethtool SQI support for LAN87xx T1 Phy patchwork-bot+netdevbpf

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.