Skip to contentSkip to conversation

net: phy: dp83867: Add TI dp83867 phy

PATCH Superseded Dan Murphy 2 participants 3 messages May 26, 2015

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

PATCH 1/1 net: phy: dp83867: Add TI dp83867 phy

Add support for the TI dp83867 Gigabit ethernet phy device.

The DP83867 is a robust, low power, fully featured Physical Layer transceiver with integrated PMD sublayers to support 10BASE-T, 100BASE-TX and 1000BASE-T Ethernet protocols.

---
 drivers/net/phy/Kconfig   |   6 +-
 drivers/net/phy/Makefile  |   1 +
 drivers/net/phy/dp83867.c | 208 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 214 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/phy/dp83867.c
drivers/net/phy/Kconfig +5 -1
index 70641d2..939f06e 100644
@@ -119,6 +119,11 @@ config MICREL_PHY
 	---help---
 	  Supports the KSZ9021, VSC8201, KS8001 PHYs.
 
+config DP83867_PHY
+	tristate "Drivers for Texas Instruments DP83867 Gigabit PHY"
+	---help---
+	  Currently supports the DP83867 PHY.
+
 config FIXED_PHY
 	tristate "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
 	depends on PHYLIB
@@ -212,7 +217,6 @@ config MDIO_BCM_UNIMAC
 	  This hardware can be found in the Broadcom GENET Ethernet MAC
 	  controllers as well as some Broadcom Ethernet switches such as the
 	  Starfighter 2 switches.
-
 endif # PHYLIB
 
 config MICREL_KS8995MA
drivers/net/phy/Makefile +1 -0
index 501ea76..58e6131 100644
@@ -22,6 +22,7 @@ obj-$(CONFIG_MDIO_BITBANG)	+= mdio-bitbang.o
 obj-$(CONFIG_MDIO_GPIO)		+= mdio-gpio.o
 obj-$(CONFIG_NATIONAL_PHY)	+= national.o
 obj-$(CONFIG_DP83640_PHY)	+= dp83640.o
+obj-$(CONFIG_DP83867_PHY)	+= dp83867.o
 obj-$(CONFIG_STE10XP)		+= ste10Xp.o
 obj-$(CONFIG_MICREL_PHY)	+= micrel.o
 obj-$(CONFIG_MDIO_OCTEON)	+= mdio-octeon.o
drivers/net/phy/dp83867.c new file +208 -0

208 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw
Quoted 10 lines · Dan Murphy

Add support for the TI dp83867 Gigabit ethernet phy device.

The DP83867 is a robust, low power, fully featured Physical Layer transceiver with integrated PMD sublayers to support 10BASE-T, 100BASE-TX and 1000BASE-T Ethernet protocols.

---

[snip]

drivers/net/phy/dp83867.c line 84

Quoted 3 lines
drivers/net/phy/dp83867.c new file +3 -0
+
+int rx_tx_delay = (DP83867_RGMIIDCTL_2_75_NS << DP83867_RGMII_RX_CLK_DELAY_SHIFT) | DP83867_RGMIIDCTL_2_25_NS;
+module_param(rx_tx_delay, int, 0664);

This is not going to work, rx and tx delays are inherent properties of PCB/board designs, you want to be able to get that value from your platform configuration, Device Tree would certainly be preferred here. Asking an user to figure this out through module parameters is going to be both error prone, and limiting yourself to no more than one instance.

[snip]

drivers/net/phy/dp83867.c line 161

Quoted 11 lines
drivers/net/phy/dp83867.c new file +11 -0
+
+static int dp83867_phy_reset(struct phy_device *phydev)
+{
+	int err;
+
+	err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESET);
+	if (err < 0)
+		return err;
+
+	err = dp83867_config_init(phydev);
+	return err;

you could do a tail-call return directly?

[snip]

drivers/net/phy/dp83867.c line 197

Quoted 13 lines
drivers/net/phy/dp83867.c new file +13 -0
+
+static int __init dp83867_init(void)
+{
+	return phy_driver_register(&dp83867_driver);
+}
+
+static void __exit dp83867_exit(void)
+{
+	phy_driver_unregister(&dp83867_driver);
+}
+
+module_init(dp83867_init);
+module_exit(dp83867_exit);

You could use module_phy_driver to eliminate some boilerplate here.

Signature · 1 line
Florian
author
#2 lore raw

Florian

Thanks for the review!

Quoted 13 lines · Florian Fainelli
Quoted 10 lines · Dan Murphy

Add support for the TI dp83867 Gigabit ethernet phy device.

The DP83867 is a robust, low power, fully featured Physical Layer transceiver with integrated PMD sublayers to support 10BASE-T, 100BASE-TX and 1000BASE-T Ethernet protocols.

---

[snip]

Quoted 8 lines

drivers/net/phy/dp83867.c line 84

Quoted 3 lines
drivers/net/phy/dp83867.c new file +3 -0
+
+int rx_tx_delay = (DP83867_RGMIIDCTL_2_75_NS << DP83867_RGMII_RX_CLK_DELAY_SHIFT) | DP83867_RGMIIDCTL_2_25_NS;
+module_param(rx_tx_delay, int, 0664);

This is not going to work, rx and tx delays are inherent properties of PCB/board designs, you want to be able to get that value from your platform configuration, Device Tree would certainly be preferred here. Asking an user to figure this out through module parameters is going to be both error prone, and limiting yourself to no more than one instance.

Yeah I agree. I also have platform data for legacy products that I could put in the DT as well.

Quoted 14 lines

[snip]

drivers/net/phy/dp83867.c line 161

Quoted 11 lines
drivers/net/phy/dp83867.c new file +11 -0
+
+static int dp83867_phy_reset(struct phy_device *phydev)
+{
+	int err;
+
+	err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESET);
+	if (err < 0)
+		return err;
+
+	err = dp83867_config_init(phydev);
+	return err;

you could do a tail-call return directly?

Yep. Will change that

Quoted 17 lines

[snip]

drivers/net/phy/dp83867.c line 197

Quoted 13 lines
drivers/net/phy/dp83867.c new file +13 -0
+
+static int __init dp83867_init(void)
+{
+	return phy_driver_register(&dp83867_driver);
+}
+
+static void __exit dp83867_exit(void)
+{
+	phy_driver_unregister(&dp83867_driver);
+}
+
+module_init(dp83867_init);
+module_exit(dp83867_exit);

You could use module_phy_driver to eliminate some boilerplate here.

Nice I will do that.

Dan

Signature · 2 lines
------------------
Dan Murphy