linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/7] add ti dp83td510 support
@ 2022-05-05  6:33 Oleksij Rempel
  2022-05-05  6:33 ` [PATCH net-next v3 1/7] net: phy: genphy_c45_baset1_an_config_aneg: do no set unknown configuration Oleksij Rempel
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Oleksij Rempel @ 2022-05-05  6:33 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Oleksij Rempel, kernel, linux-kernel, netdev

changes v3:
- export reusable code snippets and make use of it in the dp83td510
  driver

changes v2:
- rewrite the driver reduce usage of common code and to reduce amount of
  quirks.
- add genphy_c45_baset1_an_config_aneg fix

Oleksij Rempel (7):
  net: phy: genphy_c45_baset1_an_config_aneg: do no set unknown
    configuration
  net: phy: introduce genphy_c45_pma_base1_setup_master_slave()
  net: phy: genphy_c45_pma_base1_setup_master_slave: do no set unknown
    configuration
  net: phy: introduce genphy_c45_pma_baset1_read_master_slave()
  net: phy: genphy_c45_pma_baset1_read_master_slave: read actual
    configuration
  net: phy: export genphy_c45_baset1_read_status()
  net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY

 drivers/net/phy/Kconfig     |   6 ++
 drivers/net/phy/Makefile    |   1 +
 drivers/net/phy/dp83td510.c | 210 ++++++++++++++++++++++++++++++++++++
 drivers/net/phy/phy-c45.c   |  93 +++++++++++-----
 include/linux/phy.h         |   3 +
 5 files changed, 286 insertions(+), 27 deletions(-)
 create mode 100644 drivers/net/phy/dp83td510.c

-- 
2.30.2


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

* [PATCH net-next v3 1/7] net: phy: genphy_c45_baset1_an_config_aneg: do no set unknown configuration
  2022-05-05  6:33 [PATCH net-next v3 0/7] add ti dp83td510 support Oleksij Rempel
@ 2022-05-05  6:33 ` Oleksij Rempel
  2022-05-05  6:33 ` [PATCH net-next v3 2/7] net: phy: introduce genphy_c45_pma_base1_setup_master_slave() Oleksij Rempel
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Oleksij Rempel @ 2022-05-05  6:33 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Oleksij Rempel, kernel, linux-kernel, netdev

Do not change default master/slave autoneg configuration if no
changes was requested.

Fixes: 3da8ffd8545f ("net: phy: Add 10BASE-T1L support in phy-c45")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/phy/phy-c45.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index eefdd67d5556..0014aa6e73c0 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -191,8 +191,12 @@ static int genphy_c45_baset1_an_config_aneg(struct phy_device *phydev)
 	case MASTER_SLAVE_CFG_MASTER_PREFERRED:
 	case MASTER_SLAVE_CFG_SLAVE_PREFERRED:
 		break;
+	case MASTER_SLAVE_CFG_UNKNOWN:
+	case MASTER_SLAVE_CFG_UNSUPPORTED:
+		return 0;
 	default:
-		break;
+		phydev_warn(phydev, "Unsupported Master/Slave mode\n");
+		return -EOPNOTSUPP;
 	}
 
 	switch (phydev->master_slave_set) {
-- 
2.30.2


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

* [PATCH net-next v3 2/7] net: phy: introduce genphy_c45_pma_base1_setup_master_slave()
  2022-05-05  6:33 [PATCH net-next v3 0/7] add ti dp83td510 support Oleksij Rempel
  2022-05-05  6:33 ` [PATCH net-next v3 1/7] net: phy: genphy_c45_baset1_an_config_aneg: do no set unknown configuration Oleksij Rempel
@ 2022-05-05  6:33 ` Oleksij Rempel
  2022-05-05 12:29   ` Andrew Lunn
  2022-05-05  6:33 ` [PATCH net-next v3 3/7] net: phy: genphy_c45_pma_base1_setup_master_slave: do no set unknown configuration Oleksij Rempel
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Oleksij Rempel @ 2022-05-05  6:33 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Oleksij Rempel, kernel, linux-kernel, netdev

Move baset1 specific part of genphy_c45_pma_setup_forced() code to
separate function to make it reusable by PHY drivers.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/phy/phy-c45.c | 49 ++++++++++++++++++++++++---------------
 include/linux/phy.h       |  1 +
 2 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index 0014aa6e73c0..140cd2b42092 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -70,6 +70,35 @@ int genphy_c45_pma_suspend(struct phy_device *phydev)
 }
 EXPORT_SYMBOL_GPL(genphy_c45_pma_suspend);
 
+/**
+ * genphy_c45_pma_base1_setup_master_slave - configures forced master/slave
+ * role of BaseT1 devices.
+ * @phydev: target phy_device struct
+ */
+int genphy_c45_pma_base1_setup_master_slave(struct phy_device *phydev)
+{
+	int ctl = 0;
+
+	switch (phydev->master_slave_set) {
+	case MASTER_SLAVE_CFG_MASTER_PREFERRED:
+	case MASTER_SLAVE_CFG_MASTER_FORCE:
+		ctl = MDIO_PMA_PMD_BT1_CTRL_CFG_MST;
+		break;
+	case MASTER_SLAVE_CFG_SLAVE_FORCE:
+	case MASTER_SLAVE_CFG_SLAVE_PREFERRED:
+	case MASTER_SLAVE_CFG_UNKNOWN:
+	case MASTER_SLAVE_CFG_UNSUPPORTED:
+		break;
+	default:
+		phydev_warn(phydev, "Unsupported Master/Slave mode\n");
+		return -EOPNOTSUPP;
+	}
+
+	return phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL,
+			     MDIO_PMA_PMD_BT1_CTRL_CFG_MST, ctl);
+}
+EXPORT_SYMBOL_GPL(genphy_c45_pma_base1_setup_master_slave);
+
 /**
  * genphy_c45_pma_setup_forced - configures a forced speed
  * @phydev: target phy_device struct
@@ -141,25 +170,7 @@ int genphy_c45_pma_setup_forced(struct phy_device *phydev)
 		return ret;
 
 	if (genphy_c45_baset1_able(phydev)) {
-		int ctl = 0;
-
-		switch (phydev->master_slave_set) {
-		case MASTER_SLAVE_CFG_MASTER_PREFERRED:
-		case MASTER_SLAVE_CFG_MASTER_FORCE:
-			ctl = MDIO_PMA_PMD_BT1_CTRL_CFG_MST;
-			break;
-		case MASTER_SLAVE_CFG_SLAVE_FORCE:
-		case MASTER_SLAVE_CFG_SLAVE_PREFERRED:
-		case MASTER_SLAVE_CFG_UNKNOWN:
-		case MASTER_SLAVE_CFG_UNSUPPORTED:
-			break;
-		default:
-			phydev_warn(phydev, "Unsupported Master/Slave mode\n");
-			return -EOPNOTSUPP;
-		}
-
-		ret = phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL,
-				     MDIO_PMA_PMD_BT1_CTRL_CFG_MST, ctl);
+		ret = genphy_c45_pma_base1_setup_master_slave(phydev);
 		if (ret < 0)
 			return ret;
 	}
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 2d12054932ba..a8548c138d78 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1614,6 +1614,7 @@ int genphy_c45_read_link(struct phy_device *phydev);
 int genphy_c45_read_lpa(struct phy_device *phydev);
 int genphy_c45_read_pma(struct phy_device *phydev);
 int genphy_c45_pma_setup_forced(struct phy_device *phydev);
+int genphy_c45_pma_base1_setup_master_slave(struct phy_device *phydev);
 int genphy_c45_an_config_aneg(struct phy_device *phydev);
 int genphy_c45_an_disable_aneg(struct phy_device *phydev);
 int genphy_c45_read_mdix(struct phy_device *phydev);
-- 
2.30.2


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

* [PATCH net-next v3 3/7] net: phy: genphy_c45_pma_base1_setup_master_slave: do no set unknown configuration
  2022-05-05  6:33 [PATCH net-next v3 0/7] add ti dp83td510 support Oleksij Rempel
  2022-05-05  6:33 ` [PATCH net-next v3 1/7] net: phy: genphy_c45_baset1_an_config_aneg: do no set unknown configuration Oleksij Rempel
  2022-05-05  6:33 ` [PATCH net-next v3 2/7] net: phy: introduce genphy_c45_pma_base1_setup_master_slave() Oleksij Rempel
@ 2022-05-05  6:33 ` Oleksij Rempel
  2022-05-05 12:30   ` Andrew Lunn
  2022-05-05  6:33 ` [PATCH net-next v3 4/7] net: phy: introduce genphy_c45_pma_baset1_read_master_slave() Oleksij Rempel
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Oleksij Rempel @ 2022-05-05  6:33 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Oleksij Rempel, kernel, linux-kernel, netdev

Do not change default master/slave forced configuration if no changes was
requested.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/phy/phy-c45.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index 140cd2b42092..103a9296bbd0 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -86,9 +86,10 @@ int genphy_c45_pma_base1_setup_master_slave(struct phy_device *phydev)
 		break;
 	case MASTER_SLAVE_CFG_SLAVE_FORCE:
 	case MASTER_SLAVE_CFG_SLAVE_PREFERRED:
+		break;
 	case MASTER_SLAVE_CFG_UNKNOWN:
 	case MASTER_SLAVE_CFG_UNSUPPORTED:
-		break;
+		return 0;
 	default:
 		phydev_warn(phydev, "Unsupported Master/Slave mode\n");
 		return -EOPNOTSUPP;
-- 
2.30.2


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

* [PATCH net-next v3 4/7] net: phy: introduce genphy_c45_pma_baset1_read_master_slave()
  2022-05-05  6:33 [PATCH net-next v3 0/7] add ti dp83td510 support Oleksij Rempel
                   ` (2 preceding siblings ...)
  2022-05-05  6:33 ` [PATCH net-next v3 3/7] net: phy: genphy_c45_pma_base1_setup_master_slave: do no set unknown configuration Oleksij Rempel
@ 2022-05-05  6:33 ` Oleksij Rempel
  2022-05-05 12:31   ` Andrew Lunn
                     ` (2 more replies)
  2022-05-05  6:33 ` [PATCH net-next v3 5/7] net: phy: genphy_c45_pma_baset1_read_master_slave: read actual configuration Oleksij Rempel
                   ` (2 subsequent siblings)
  6 siblings, 3 replies; 17+ messages in thread
From: Oleksij Rempel @ 2022-05-05  6:33 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Oleksij Rempel, kernel, linux-kernel, netdev

Move baset1 specific part of genphy_c45_read_pma() code to
separate function to make it reusable by PHY drivers.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/phy/phy-c45.c | 30 ++++++++++++++++++++++++------
 include/linux/phy.h       |  1 +
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index 103a9296bbd0..6f7a03318d42 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -550,6 +550,29 @@ int genphy_c45_read_lpa(struct phy_device *phydev)
 }
 EXPORT_SYMBOL_GPL(genphy_c45_read_lpa);
 
+/**
+ * genphy_c45_baset1_read_master_slave - read forced master/slave configuration
+ * @phydev: target phy_device struct
+ */
+int genphy_c45_pma_baset1_read_master_slave(struct phy_device *phydev)
+{
+	int val;
+
+	phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN;
+
+	val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL);
+	if (val < 0)
+		return val;
+
+	if (val & MDIO_PMA_PMD_BT1_CTRL_CFG_MST)
+		phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER;
+	else
+		phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(genphy_c45_pma_baset1_read_master_slave);
+
 /**
  * genphy_c45_read_pma - read link speed etc from PMA
  * @phydev: target phy_device struct
@@ -591,14 +614,9 @@ int genphy_c45_read_pma(struct phy_device *phydev)
 	phydev->duplex = DUPLEX_FULL;
 
 	if (genphy_c45_baset1_able(phydev)) {
-		val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL);
+		val = genphy_c45_pma_baset1_read_master_slave(phydev);
 		if (val < 0)
 			return val;
-
-		if (MDIO_PMA_PMD_BT1_CTRL_CFG_MST)
-			phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER;
-		else
-			phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE;
 	}
 
 	return 0;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index a8548c138d78..a7490df8e1ec 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1619,6 +1619,7 @@ int genphy_c45_an_config_aneg(struct phy_device *phydev);
 int genphy_c45_an_disable_aneg(struct phy_device *phydev);
 int genphy_c45_read_mdix(struct phy_device *phydev);
 int genphy_c45_pma_read_abilities(struct phy_device *phydev);
+int genphy_c45_pma_baset1_read_master_slave(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);
-- 
2.30.2


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

* [PATCH net-next v3 5/7] net: phy: genphy_c45_pma_baset1_read_master_slave: read actual configuration
  2022-05-05  6:33 [PATCH net-next v3 0/7] add ti dp83td510 support Oleksij Rempel
                   ` (3 preceding siblings ...)
  2022-05-05  6:33 ` [PATCH net-next v3 4/7] net: phy: introduce genphy_c45_pma_baset1_read_master_slave() Oleksij Rempel
@ 2022-05-05  6:33 ` Oleksij Rempel
  2022-05-05 12:33   ` Andrew Lunn
  2022-05-05  6:33 ` [PATCH net-next v3 6/7] net: phy: export genphy_c45_baset1_read_status() Oleksij Rempel
  2022-05-05  6:33 ` [PATCH net-next v3 7/7] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY Oleksij Rempel
  6 siblings, 1 reply; 17+ messages in thread
From: Oleksij Rempel @ 2022-05-05  6:33 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Oleksij Rempel, kernel, linux-kernel, netdev

Since MDIO_PMA_PMD_BT1_CTRL register shows actual configuration (and
forced state configuration is equal to the state), we should show
this configuration for ethtool.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/phy/phy-c45.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index 6f7a03318d42..40620e3c9467 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -559,15 +559,19 @@ int genphy_c45_pma_baset1_read_master_slave(struct phy_device *phydev)
 	int val;
 
 	phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN;
+	phydev->master_slave_get = MASTER_SLAVE_CFG_UNKNOWN;
 
 	val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL);
 	if (val < 0)
 		return val;
 
-	if (val & MDIO_PMA_PMD_BT1_CTRL_CFG_MST)
+	if (val & MDIO_PMA_PMD_BT1_CTRL_CFG_MST) {
+		phydev->master_slave_get = MASTER_SLAVE_CFG_MASTER_FORCE;
 		phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER;
-	else
+	} else {
+		phydev->master_slave_get = MASTER_SLAVE_CFG_SLAVE_FORCE;
 		phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE;
+	}
 
 	return 0;
 }
-- 
2.30.2


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

* [PATCH net-next v3 6/7] net: phy: export genphy_c45_baset1_read_status()
  2022-05-05  6:33 [PATCH net-next v3 0/7] add ti dp83td510 support Oleksij Rempel
                   ` (4 preceding siblings ...)
  2022-05-05  6:33 ` [PATCH net-next v3 5/7] net: phy: genphy_c45_pma_baset1_read_master_slave: read actual configuration Oleksij Rempel
@ 2022-05-05  6:33 ` Oleksij Rempel
  2022-05-05 12:33   ` Andrew Lunn
  2022-05-05  6:33 ` [PATCH net-next v3 7/7] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY Oleksij Rempel
  6 siblings, 1 reply; 17+ messages in thread
From: Oleksij Rempel @ 2022-05-05  6:33 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Oleksij Rempel, kernel, linux-kernel, netdev

Export genphy_c45_baset1_read_status() to make it reusable by PHY drivers.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/phy/phy-c45.c | 3 ++-
 include/linux/phy.h       | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index 40620e3c9467..6616e4f580a4 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -784,7 +784,7 @@ EXPORT_SYMBOL_GPL(genphy_c45_pma_read_abilities);
  * is forced or not, it is read from BASE-T1 AN advertisement
  * register 7.514.
  */
-static int genphy_c45_baset1_read_status(struct phy_device *phydev)
+int genphy_c45_baset1_read_status(struct phy_device *phydev)
 {
 	int ret;
 	int cfg;
@@ -814,6 +814,7 @@ static int genphy_c45_baset1_read_status(struct phy_device *phydev)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(genphy_c45_baset1_read_status);
 
 /**
  * genphy_c45_read_status - read PHY status
diff --git a/include/linux/phy.h b/include/linux/phy.h
index a7490df8e1ec..eb3423ffa81e 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1621,6 +1621,7 @@ int genphy_c45_read_mdix(struct phy_device *phydev);
 int genphy_c45_pma_read_abilities(struct phy_device *phydev);
 int genphy_c45_pma_baset1_read_master_slave(struct phy_device *phydev);
 int genphy_c45_read_status(struct phy_device *phydev);
+int genphy_c45_baset1_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);
 int genphy_c45_pma_resume(struct phy_device *phydev);
-- 
2.30.2


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

* [PATCH net-next v3 7/7] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
  2022-05-05  6:33 [PATCH net-next v3 0/7] add ti dp83td510 support Oleksij Rempel
                   ` (5 preceding siblings ...)
  2022-05-05  6:33 ` [PATCH net-next v3 6/7] net: phy: export genphy_c45_baset1_read_status() Oleksij Rempel
@ 2022-05-05  6:33 ` Oleksij Rempel
  2022-05-05 12:12   ` Oleksij Rempel
  6 siblings, 1 reply; 17+ messages in thread
From: Oleksij Rempel @ 2022-05-05  6:33 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Oleksij Rempel, kernel, linux-kernel, netdev

The DP83TD510E is an ultra-low power Ethernet physical layer transceiver
that supports 10M single pair cable.

This driver was tested with NXP SJA1105, STMMAC and ASIX AX88772B USB Ethernet
controller.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/phy/Kconfig     |   6 ++
 drivers/net/phy/Makefile    |   1 +
 drivers/net/phy/dp83td510.c | 210 ++++++++++++++++++++++++++++++++++++
 3 files changed, 217 insertions(+)
 create mode 100644 drivers/net/phy/dp83td510.c

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index bbbf6c07ea53..9fee639ee5c8 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -342,6 +342,12 @@ config DP83869_PHY
 	  Currently supports the DP83869 PHY.  This PHY supports copper and
 	  fiber connections.
 
+config DP83TD510_PHY
+	tristate "Texas Instruments DP83TD510 Ethernet 10Base-T1L PHY"
+	help
+	  Support for the DP83TD510 Ethernet 10Base-T1L PHY. This PHY supports
+	  a 10M single pair Ethernet connection for up to 1000 meter cable.
+
 config VITESSE_PHY
 	tristate "Vitesse PHYs"
 	help
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index b82651b57043..b12b1d86fc99 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -57,6 +57,7 @@ obj-$(CONFIG_DP83848_PHY)	+= dp83848.o
 obj-$(CONFIG_DP83867_PHY)	+= dp83867.o
 obj-$(CONFIG_DP83869_PHY)	+= dp83869.o
 obj-$(CONFIG_DP83TC811_PHY)	+= dp83tc811.o
+obj-$(CONFIG_DP83TD510_PHY)	+= dp83td510.o
 obj-$(CONFIG_FIXED_PHY)		+= fixed_phy.o
 obj-$(CONFIG_ICPLUS_PHY)	+= icplus.o
 obj-$(CONFIG_INTEL_XWAY_PHY)	+= intel-xway.o
diff --git a/drivers/net/phy/dp83td510.c b/drivers/net/phy/dp83td510.c
new file mode 100644
index 000000000000..5c3251602e4a
--- /dev/null
+++ b/drivers/net/phy/dp83td510.c
@@ -0,0 +1,210 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Driver for the Texas Instruments DP83TD510 PHY
+ * Copyright (c) 2022 Pengutronix, Oleksij Rempel <kernel@pengutronix.de>
+ */
+
+#include <linux/bitfield.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/phy.h>
+
+#define DP83TD510E_PHY_ID			0x20000181
+
+/* MDIO_MMD_VEND2 registers */
+#define DP83TD510E_PHY_STS			0x10
+#define DP83TD510E_STS_MII_INT			BIT(7)
+#define DP83TD510E_LINK_STATUS			BIT(0)
+
+#define DP83TD510E_GEN_CFG			0x11
+#define DP83TD510E_GENCFG_INT_POLARITY		BIT(3)
+#define DP83TD510E_GENCFG_INT_EN		BIT(1)
+#define DP83TD510E_GENCFG_INT_OE		BIT(0)
+
+#define DP83TD510E_INTERRUPT_REG_1		0x12
+#define DP83TD510E_INT1_LINK			BIT(13)
+#define DP83TD510E_INT1_LINK_EN			BIT(5)
+
+#define DP83TD510E_AN_STAT_1			0x60c
+#define DP83TD510E_MASTER_SLAVE_RESOL_FAIL	BIT(15)
+
+static int dp83td510_config_intr(struct phy_device *phydev)
+{
+	int ret;
+
+	if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+		/* Clear any pending interrupts */
+		ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, DP83TD510E_PHY_STS,
+				    0x0);
+		if (ret)
+			return ret;
+
+		ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
+				    DP83TD510E_INTERRUPT_REG_1,
+				    DP83TD510E_INT1_LINK_EN);
+		if (ret)
+			return ret;
+
+		ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2,
+				       DP83TD510E_GEN_CFG,
+				       DP83TD510E_GENCFG_INT_POLARITY |
+				       DP83TD510E_GENCFG_INT_EN |
+				       DP83TD510E_GENCFG_INT_OE);
+	} else {
+		ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
+				    DP83TD510E_INTERRUPT_REG_1, 0x0);
+		if (ret)
+			return ret;
+
+		ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2,
+					 DP83TD510E_GEN_CFG,
+					 DP83TD510E_GENCFG_INT_EN);
+		if (ret)
+			return ret;
+
+		/* Clear any pending interrupts */
+		ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, DP83TD510E_PHY_STS,
+				    0x0);
+	}
+
+	return ret;
+}
+
+static irqreturn_t dp83td510_handle_interrupt(struct phy_device *phydev)
+{
+	int  ret;
+
+	ret = phy_read_mmd(phydev, MDIO_MMD_VEND2, DP83TD510E_PHY_STS);
+	if (ret < 0) {
+		phy_error(phydev);
+		return IRQ_NONE;
+	} else if (!(ret & DP83TD510E_STS_MII_INT)) {
+		return IRQ_NONE;
+	}
+
+	/* Read the current enabled interrupts */
+	ret = phy_read_mmd(phydev, MDIO_MMD_VEND2, DP83TD510E_INTERRUPT_REG_1);
+	if (ret < 0) {
+		phy_error(phydev);
+		return IRQ_NONE;
+	} else if (!(ret & DP83TD510E_INT1_LINK_EN) ||
+		   !(ret & DP83TD510E_INT1_LINK)) {
+		return IRQ_NONE;
+	}
+
+	phy_trigger_machine(phydev);
+
+	return IRQ_HANDLED;
+}
+
+static int dp83td510_read_status(struct phy_device *phydev)
+{
+	u16 phy_sts;
+	int ret, cfg;
+
+	phydev->speed = SPEED_UNKNOWN;
+	phydev->duplex = DUPLEX_UNKNOWN;
+	phydev->pause = 0;
+	phydev->asym_pause = 0;
+	linkmode_zero(phydev->lp_advertising);
+
+	phy_sts = phy_read(phydev, DP83TD510E_PHY_STS);
+
+	phydev->link = !!(phy_sts & DP83TD510E_LINK_STATUS);
+	if (phydev->link) {
+		/* This PHY supports only one link mode: 10BaseT1L_Full */
+		phydev->duplex = DUPLEX_FULL;
+		phydev->speed = SPEED_10;
+
+		if (phydev->autoneg == AUTONEG_ENABLE) {
+			ret = genphy_c45_read_lpa(phydev);
+			if (ret)
+				return ret;
+
+			phy_resolve_aneg_linkmode(phydev);
+		}
+	}
+
+	if (phydev->autoneg == AUTONEG_ENABLE) {
+		ret = genphy_c45_baset1_read_status(phydev);
+		if (ret < 0)
+			return ret;
+
+		ret = phy_read_mmd(phydev, MDIO_MMD_VEND2,
+				   DP83TD510E_AN_STAT_1);
+		if (ret < 0)
+			return ret;
+
+		if (ret & DP83TD510E_MASTER_SLAVE_RESOL_FAIL)
+			phydev->master_slave_state = MASTER_SLAVE_STATE_ERR;
+	} else {
+		return genphy_c45_pma_baset1_read_master_slave(phydev);
+	}
+
+	return 0;
+}
+
+static int dp83td510_config_aneg(struct phy_device *phydev)
+{
+	bool changed = false;
+	int ctl = 0;
+	int ret;
+
+	ret = genphy_c45_pma_base1_setup_master_slave(phydev);
+	if (ret < 0)
+		return ret;
+
+	if (phydev->autoneg == AUTONEG_DISABLE)
+		return genphy_c45_an_disable_aneg(phydev);
+
+	ret = genphy_c45_an_config_aneg(phydev);
+	if (ret < 0)
+		return ret;
+	if (ret > 0)
+		changed = true;
+
+	return genphy_c45_check_and_restart_aneg(phydev, changed);
+}
+
+static int dp83td510_get_features(struct phy_device *phydev)
+{
+	/* This PHY can't respond on MDIO bus if no RMII clock is enabled.
+	 * In case RMII mode is used (most meaningful mode for this PHY) and
+	 * the PHY do not have own XTAL, and CLK providing MAC is not probed,
+	 * we won't be able to read all needed ability registers.
+	 * So provide it manually.
+	 */
+
+	linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported);
+	linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydev->supported);
+	linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev->supported);
+	linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT1L_Full_BIT,
+			 phydev->supported);
+
+	return 0;
+}
+
+static struct phy_driver dp83td510_driver[] = {
+{
+	PHY_ID_MATCH_MODEL(DP83TD510E_PHY_ID),
+	.name		= "TI DP83TD510E",
+
+	.config_aneg	= dp83td510_config_aneg,
+	.read_status	= dp83td510_read_status,
+	.get_features	= dp83td510_get_features,
+	.config_intr	= dp83td510_config_intr,
+	.handle_interrupt = dp83td510_handle_interrupt,
+
+	.suspend	= genphy_suspend,
+	.resume		= genphy_resume,
+} };
+module_phy_driver(dp83td510_driver);
+
+static struct mdio_device_id __maybe_unused dp83td510_tbl[] = {
+	{ PHY_ID_MATCH_MODEL(DP83TD510E_PHY_ID) },
+	{ }
+};
+MODULE_DEVICE_TABLE(mdio, dp83td510_tbl);
+
+MODULE_DESCRIPTION("Texas Instruments DP83TD510E PHY driver");
+MODULE_AUTHOR("Oleksij Rempel <kernel@pengutronix.de>");
+MODULE_LICENSE("GPL v2");
-- 
2.30.2


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

* Re: [PATCH net-next v3 7/7] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
  2022-05-05  6:33 ` [PATCH net-next v3 7/7] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY Oleksij Rempel
@ 2022-05-05 12:12   ` Oleksij Rempel
  2022-05-05 12:36     ` Andrew Lunn
  0 siblings, 1 reply; 17+ messages in thread
From: Oleksij Rempel @ 2022-05-05 12:12 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, kernel, netdev

On Thu, May 05, 2022 at 08:33:18AM +0200, Oleksij Rempel wrote:
> The DP83TD510E is an ultra-low power Ethernet physical layer transceiver
> that supports 10M single pair cable.
> 
> This driver was tested with NXP SJA1105, STMMAC and ASIX AX88772B USB Ethernet
> controller.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  drivers/net/phy/Kconfig     |   6 ++
>  drivers/net/phy/Makefile    |   1 +
>  drivers/net/phy/dp83td510.c | 210 ++++++++++++++++++++++++++++++++++++
>  3 files changed, 217 insertions(+)
>  create mode 100644 drivers/net/phy/dp83td510.c
> 
> diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
> index bbbf6c07ea53..9fee639ee5c8 100644
> --- a/drivers/net/phy/Kconfig
> +++ b/drivers/net/phy/Kconfig
> @@ -342,6 +342,12 @@ config DP83869_PHY
>  	  Currently supports the DP83869 PHY.  This PHY supports copper and
>  	  fiber connections.
>  
> +config DP83TD510_PHY
> +	tristate "Texas Instruments DP83TD510 Ethernet 10Base-T1L PHY"
> +	help
> +	  Support for the DP83TD510 Ethernet 10Base-T1L PHY. This PHY supports
> +	  a 10M single pair Ethernet connection for up to 1000 meter cable.
> +
>  config VITESSE_PHY
>  	tristate "Vitesse PHYs"
>  	help
> diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
> index b82651b57043..b12b1d86fc99 100644
> --- a/drivers/net/phy/Makefile
> +++ b/drivers/net/phy/Makefile
> @@ -57,6 +57,7 @@ obj-$(CONFIG_DP83848_PHY)	+= dp83848.o
>  obj-$(CONFIG_DP83867_PHY)	+= dp83867.o
>  obj-$(CONFIG_DP83869_PHY)	+= dp83869.o
>  obj-$(CONFIG_DP83TC811_PHY)	+= dp83tc811.o
> +obj-$(CONFIG_DP83TD510_PHY)	+= dp83td510.o
>  obj-$(CONFIG_FIXED_PHY)		+= fixed_phy.o
>  obj-$(CONFIG_ICPLUS_PHY)	+= icplus.o
>  obj-$(CONFIG_INTEL_XWAY_PHY)	+= intel-xway.o
> diff --git a/drivers/net/phy/dp83td510.c b/drivers/net/phy/dp83td510.c
> new file mode 100644
> index 000000000000..5c3251602e4a
> --- /dev/null
> +++ b/drivers/net/phy/dp83td510.c
> @@ -0,0 +1,210 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Driver for the Texas Instruments DP83TD510 PHY
> + * Copyright (c) 2022 Pengutronix, Oleksij Rempel <kernel@pengutronix.de>
> + */
> +
> +#include <linux/bitfield.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/phy.h>
> +
> +#define DP83TD510E_PHY_ID			0x20000181
> +
> +/* MDIO_MMD_VEND2 registers */
> +#define DP83TD510E_PHY_STS			0x10
> +#define DP83TD510E_STS_MII_INT			BIT(7)
> +#define DP83TD510E_LINK_STATUS			BIT(0)
> +
> +#define DP83TD510E_GEN_CFG			0x11
> +#define DP83TD510E_GENCFG_INT_POLARITY		BIT(3)
> +#define DP83TD510E_GENCFG_INT_EN		BIT(1)
> +#define DP83TD510E_GENCFG_INT_OE		BIT(0)
> +
> +#define DP83TD510E_INTERRUPT_REG_1		0x12
> +#define DP83TD510E_INT1_LINK			BIT(13)
> +#define DP83TD510E_INT1_LINK_EN			BIT(5)
> +
> +#define DP83TD510E_AN_STAT_1			0x60c
> +#define DP83TD510E_MASTER_SLAVE_RESOL_FAIL	BIT(15)
> +
> +static int dp83td510_config_intr(struct phy_device *phydev)
> +{
> +	int ret;
> +
> +	if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
> +		/* Clear any pending interrupts */
> +		ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, DP83TD510E_PHY_STS,
> +				    0x0);
> +		if (ret)
> +			return ret;
> +
> +		ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
> +				    DP83TD510E_INTERRUPT_REG_1,
> +				    DP83TD510E_INT1_LINK_EN);
> +		if (ret)
> +			return ret;
> +
> +		ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2,
> +				       DP83TD510E_GEN_CFG,
> +				       DP83TD510E_GENCFG_INT_POLARITY |
> +				       DP83TD510E_GENCFG_INT_EN |
> +				       DP83TD510E_GENCFG_INT_OE);
> +	} else {
> +		ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
> +				    DP83TD510E_INTERRUPT_REG_1, 0x0);
> +		if (ret)
> +			return ret;
> +
> +		ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2,
> +					 DP83TD510E_GEN_CFG,
> +					 DP83TD510E_GENCFG_INT_EN);
> +		if (ret)
> +			return ret;
> +
> +		/* Clear any pending interrupts */
> +		ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, DP83TD510E_PHY_STS,
> +				    0x0);
> +	}
> +
> +	return ret;
> +}
> +
> +static irqreturn_t dp83td510_handle_interrupt(struct phy_device *phydev)
> +{
> +	int  ret;
> +
> +	ret = phy_read_mmd(phydev, MDIO_MMD_VEND2, DP83TD510E_PHY_STS);
> +	if (ret < 0) {
> +		phy_error(phydev);
> +		return IRQ_NONE;
> +	} else if (!(ret & DP83TD510E_STS_MII_INT)) {
> +		return IRQ_NONE;
> +	}
> +
> +	/* Read the current enabled interrupts */
> +	ret = phy_read_mmd(phydev, MDIO_MMD_VEND2, DP83TD510E_INTERRUPT_REG_1);
> +	if (ret < 0) {
> +		phy_error(phydev);
> +		return IRQ_NONE;
> +	} else if (!(ret & DP83TD510E_INT1_LINK_EN) ||
> +		   !(ret & DP83TD510E_INT1_LINK)) {
> +		return IRQ_NONE;
> +	}
> +
> +	phy_trigger_machine(phydev);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static int dp83td510_read_status(struct phy_device *phydev)
> +{
> +	u16 phy_sts;
> +	int ret, cfg;

Heh, here is unused variable. Need to fix it.

Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH net-next v3 2/7] net: phy: introduce genphy_c45_pma_base1_setup_master_slave()
  2022-05-05  6:33 ` [PATCH net-next v3 2/7] net: phy: introduce genphy_c45_pma_base1_setup_master_slave() Oleksij Rempel
@ 2022-05-05 12:29   ` Andrew Lunn
  0 siblings, 0 replies; 17+ messages in thread
From: Andrew Lunn @ 2022-05-05 12:29 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, kernel, linux-kernel, netdev

> +/**
> + * genphy_c45_pma_base1_setup_master_slave - configures forced master/slave
> + * role of BaseT1 devices.
> + * @phydev: target phy_device struct
> + */
> +int genphy_c45_pma_base1_setup_master_slave(struct phy_device *phydev)

The naming convection is baset1

Please add my

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

when you respin.

    Andrew

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

* Re: [PATCH net-next v3 3/7] net: phy: genphy_c45_pma_base1_setup_master_slave: do no set unknown configuration
  2022-05-05  6:33 ` [PATCH net-next v3 3/7] net: phy: genphy_c45_pma_base1_setup_master_slave: do no set unknown configuration Oleksij Rempel
@ 2022-05-05 12:30   ` Andrew Lunn
  0 siblings, 0 replies; 17+ messages in thread
From: Andrew Lunn @ 2022-05-05 12:30 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, kernel, linux-kernel, netdev

On Thu, May 05, 2022 at 08:33:14AM +0200, Oleksij Rempel wrote:
> Do not change default master/slave forced configuration if no changes was
> requested.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew



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

* Re: [PATCH net-next v3 4/7] net: phy: introduce genphy_c45_pma_baset1_read_master_slave()
  2022-05-05  6:33 ` [PATCH net-next v3 4/7] net: phy: introduce genphy_c45_pma_baset1_read_master_slave() Oleksij Rempel
@ 2022-05-05 12:31   ` Andrew Lunn
  2022-05-05 13:41   ` kernel test robot
  2022-05-05 20:42   ` kernel test robot
  2 siblings, 0 replies; 17+ messages in thread
From: Andrew Lunn @ 2022-05-05 12:31 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, kernel, linux-kernel, netdev

On Thu, May 05, 2022 at 08:33:15AM +0200, Oleksij Rempel wrote:
> Move baset1 specific part of genphy_c45_read_pma() code to
> separate function to make it reusable by PHY drivers.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v3 5/7] net: phy: genphy_c45_pma_baset1_read_master_slave: read actual configuration
  2022-05-05  6:33 ` [PATCH net-next v3 5/7] net: phy: genphy_c45_pma_baset1_read_master_slave: read actual configuration Oleksij Rempel
@ 2022-05-05 12:33   ` Andrew Lunn
  0 siblings, 0 replies; 17+ messages in thread
From: Andrew Lunn @ 2022-05-05 12:33 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, kernel, linux-kernel, netdev

On Thu, May 05, 2022 at 08:33:16AM +0200, Oleksij Rempel wrote:
> Since MDIO_PMA_PMD_BT1_CTRL register shows actual configuration (and
> forced state configuration is equal to the state), we should show
> this configuration for ethtool.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v3 6/7] net: phy: export genphy_c45_baset1_read_status()
  2022-05-05  6:33 ` [PATCH net-next v3 6/7] net: phy: export genphy_c45_baset1_read_status() Oleksij Rempel
@ 2022-05-05 12:33   ` Andrew Lunn
  0 siblings, 0 replies; 17+ messages in thread
From: Andrew Lunn @ 2022-05-05 12:33 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, kernel, linux-kernel, netdev

On Thu, May 05, 2022 at 08:33:17AM +0200, Oleksij Rempel wrote:
> Export genphy_c45_baset1_read_status() to make it reusable by PHY drivers.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v3 7/7] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
  2022-05-05 12:12   ` Oleksij Rempel
@ 2022-05-05 12:36     ` Andrew Lunn
  0 siblings, 0 replies; 17+ messages in thread
From: Andrew Lunn @ 2022-05-05 12:36 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-kernel, kernel, netdev

On Thu, May 05, 2022 at 02:12:41PM +0200, Oleksij Rempel wrote:
> On Thu, May 05, 2022 at 08:33:18AM +0200, Oleksij Rempel wrote:
> > The DP83TD510E is an ultra-low power Ethernet physical layer transceiver
> > that supports 10M single pair cable.
> > 
> > This driver was tested with NXP SJA1105, STMMAC and ASIX AX88772B USB Ethernet
> > controller.
> > 
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> > +static int dp83td510_read_status(struct phy_device *phydev)
> > +{
> > +	u16 phy_sts;
> > +	int ret, cfg;
> 
> Heh, here is unused variable. Need to fix it.

Apart from that:

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Thanks for the rework, it made the driver much better.

    Andrew

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

* Re: [PATCH net-next v3 4/7] net: phy: introduce genphy_c45_pma_baset1_read_master_slave()
  2022-05-05  6:33 ` [PATCH net-next v3 4/7] net: phy: introduce genphy_c45_pma_baset1_read_master_slave() Oleksij Rempel
  2022-05-05 12:31   ` Andrew Lunn
@ 2022-05-05 13:41   ` kernel test robot
  2022-05-05 20:42   ` kernel test robot
  2 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2022-05-05 13:41 UTC (permalink / raw)
  To: Oleksij Rempel, Andrew Lunn, Heiner Kallweit, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: llvm, kbuild-all, netdev, Oleksij Rempel, kernel, linux-kernel

Hi Oleksij,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Oleksij-Rempel/add-ti-dp83td510-support/20220505-143922
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 4950b6990e3b1efae64a5f6fc5738d25e3b816b3
config: x86_64-randconfig-a016 (https://download.01.org/0day-ci/archive/20220505/202205052146.y8znPT8Q-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5e004fb787698440a387750db7f8028e7cb14cfc)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/80dad43edb356876484acb116b8a906dd4bef941
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Oleksij-Rempel/add-ti-dp83td510-support/20220505-143922
        git checkout 80dad43edb356876484acb116b8a906dd4bef941
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/net/phy/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/net/phy/phy-c45.c:558: warning: expecting prototype for genphy_c45_baset1_read_master_slave(). Prototype was for genphy_c45_pma_baset1_read_master_slave() instead


vim +558 drivers/net/phy/phy-c45.c

   552	
   553	/**
   554	 * genphy_c45_baset1_read_master_slave - read forced master/slave configuration
   555	 * @phydev: target phy_device struct
   556	 */
   557	int genphy_c45_pma_baset1_read_master_slave(struct phy_device *phydev)
 > 558	{
   559		int val;
   560	
   561		phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN;
   562	
   563		val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL);
   564		if (val < 0)
   565			return val;
   566	
   567		if (val & MDIO_PMA_PMD_BT1_CTRL_CFG_MST)
   568			phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER;
   569		else
   570			phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE;
   571	
   572		return 0;
   573	}
   574	EXPORT_SYMBOL_GPL(genphy_c45_pma_baset1_read_master_slave);
   575	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [PATCH net-next v3 4/7] net: phy: introduce genphy_c45_pma_baset1_read_master_slave()
  2022-05-05  6:33 ` [PATCH net-next v3 4/7] net: phy: introduce genphy_c45_pma_baset1_read_master_slave() Oleksij Rempel
  2022-05-05 12:31   ` Andrew Lunn
  2022-05-05 13:41   ` kernel test robot
@ 2022-05-05 20:42   ` kernel test robot
  2 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2022-05-05 20:42 UTC (permalink / raw)
  To: Oleksij Rempel, Andrew Lunn, Heiner Kallweit, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: kbuild-all, netdev, Oleksij Rempel, kernel, linux-kernel

Hi Oleksij,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Oleksij-Rempel/add-ti-dp83td510-support/20220505-143922
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 4950b6990e3b1efae64a5f6fc5738d25e3b816b3
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20220506/202205060406.gHnrGdXy-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/80dad43edb356876484acb116b8a906dd4bef941
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Oleksij-Rempel/add-ti-dp83td510-support/20220505-143922
        git checkout 80dad43edb356876484acb116b8a906dd4bef941
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/net/phy/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/net/phy/phy-c45.c:558: warning: expecting prototype for genphy_c45_baset1_read_master_slave(). Prototype was for genphy_c45_pma_baset1_read_master_slave() instead


vim +558 drivers/net/phy/phy-c45.c

   552	
   553	/**
   554	 * genphy_c45_baset1_read_master_slave - read forced master/slave configuration
   555	 * @phydev: target phy_device struct
   556	 */
   557	int genphy_c45_pma_baset1_read_master_slave(struct phy_device *phydev)
 > 558	{
   559		int val;
   560	
   561		phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN;
   562	
   563		val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL);
   564		if (val < 0)
   565			return val;
   566	
   567		if (val & MDIO_PMA_PMD_BT1_CTRL_CFG_MST)
   568			phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER;
   569		else
   570			phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE;
   571	
   572		return 0;
   573	}
   574	EXPORT_SYMBOL_GPL(genphy_c45_pma_baset1_read_master_slave);
   575	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

end of thread, other threads:[~2022-05-05 20:42 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05  6:33 [PATCH net-next v3 0/7] add ti dp83td510 support Oleksij Rempel
2022-05-05  6:33 ` [PATCH net-next v3 1/7] net: phy: genphy_c45_baset1_an_config_aneg: do no set unknown configuration Oleksij Rempel
2022-05-05  6:33 ` [PATCH net-next v3 2/7] net: phy: introduce genphy_c45_pma_base1_setup_master_slave() Oleksij Rempel
2022-05-05 12:29   ` Andrew Lunn
2022-05-05  6:33 ` [PATCH net-next v3 3/7] net: phy: genphy_c45_pma_base1_setup_master_slave: do no set unknown configuration Oleksij Rempel
2022-05-05 12:30   ` Andrew Lunn
2022-05-05  6:33 ` [PATCH net-next v3 4/7] net: phy: introduce genphy_c45_pma_baset1_read_master_slave() Oleksij Rempel
2022-05-05 12:31   ` Andrew Lunn
2022-05-05 13:41   ` kernel test robot
2022-05-05 20:42   ` kernel test robot
2022-05-05  6:33 ` [PATCH net-next v3 5/7] net: phy: genphy_c45_pma_baset1_read_master_slave: read actual configuration Oleksij Rempel
2022-05-05 12:33   ` Andrew Lunn
2022-05-05  6:33 ` [PATCH net-next v3 6/7] net: phy: export genphy_c45_baset1_read_status() Oleksij Rempel
2022-05-05 12:33   ` Andrew Lunn
2022-05-05  6:33 ` [PATCH net-next v3 7/7] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY Oleksij Rempel
2022-05-05 12:12   ` Oleksij Rempel
2022-05-05 12:36     ` Andrew Lunn

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).