mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v1] net: phy: add TI DP83TD510E T1L PHY support
@ 2022-04-14 10:04 Oleksij Rempel
  2022-04-19  7:27 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Oleksij Rempel @ 2022-04-14 10:04 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

Add basic driver for TI DP83TD510E T1L PHY

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

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 9f74335443..cd20e1de27 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -29,6 +29,12 @@ config DP83867_PHY
 	help
 	  Currently supports the DP83867 PHY.
 
+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 LXT_PHY
 	bool "Driver for the Intel LXT PHYs"
 	help
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index 54b83e06dd..83f46f11d3 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -17,4 +17,5 @@ obj-$(CONFIG_MDIO_GPIO)		+= mdio-gpio.o
 obj-$(CONFIG_MDIO_BUS_MUX)	+= mdio-mux.o
 obj-$(CONFIG_MDIO_BUS_MUX_GPIO)	+= mdio-mux-gpio.o
 obj-$(CONFIG_DP83867_PHY)	+= dp83867.o
+obj-$(CONFIG_DP83TD510_PHY)	+= dp83td510.o
 
diff --git a/drivers/net/phy/dp83td510.c b/drivers/net/phy/dp83td510.c
new file mode 100644
index 0000000000..44c551e795
--- /dev/null
+++ b/drivers/net/phy/dp83td510.c
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <common.h>
+#include <linux/phy.h>
+
+#define DP83TD510E_PHY_ID		0x20000181
+
+#define DP83TD510E_PHY_STS		0x10
+#define DP83TD510E_LINK_STATUS		BIT(0)
+
+static int dp83td510_read_status(struct phy_device *phydev)
+{
+	u16 phy_sts;
+
+	phy_sts = phy_read(phydev, DP83TD510E_PHY_STS);
+
+	phydev->link = !!(phy_sts & DP83TD510E_LINK_STATUS);
+	if (phydev->link) {
+		phydev->duplex = DUPLEX_FULL;
+		phydev->speed = SPEED_10;
+	} else {
+		phydev->speed = SPEED_UNKNOWN;
+		phydev->duplex = DUPLEX_UNKNOWN;
+	}
+
+	return 0;
+}
+
+static int dp83td510_config_init(struct phy_device *phydev)
+{
+	phydev->supported = SUPPORTED_10baseT_Full | SUPPORTED_Autoneg;
+	phydev->advertising = SUPPORTED_10baseT_Full | SUPPORTED_Autoneg;
+
+	return 0;
+}
+
+static struct phy_driver dp83td510_driver[] = {
+	{
+		PHY_ID_MATCH_MODEL(DP83TD510E_PHY_ID),
+		.drv.name	= "TI DP83TD510E",
+		.read_status	= dp83td510_read_status,
+		.config_init	= dp83td510_config_init,
+	}
+};
+device_phy_drivers(dp83td510_driver);
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

end of thread, other threads:[~2022-04-19  7:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14 10:04 [PATCH v1] net: phy: add TI DP83TD510E T1L PHY support Oleksij Rempel
2022-04-19  7:27 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox