Skip to contentSkip to conversation

net: phy: dp83867: Add TI dp83867 phy

PATCH Applied Dan Murphy 3 participants 5 messages Jun 2, 2015 – Jun 8, 2015

Subsystems (4)
lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

PATCH v2 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.

---

v2 - Add device tree support and other minor changes. Added change for rgmii helper
http://patchwork.ozlabs.org/patch/476446/

 .../devicetree/bindings/net/ti,dp83867.txt         |  19 ++
 drivers/net/phy/Kconfig                            |   6 +-
 drivers/net/phy/Makefile                           |   1 +
 drivers/net/phy/dp83867.c                          | 239 +++++++++++++++++++++
 include/dt-bindings/net/ti-dp83867.h               |  45 ++++
 5 files changed, 309 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/net/ti,dp83867.txt
 create mode 100644 drivers/net/phy/dp83867.c
 create mode 100644 include/dt-bindings/net/ti-dp83867.h
Documentation/devicetree/bindings/net/ti,dp83867.txt new file +19 -0
new file mode 100644
index 0000000..46bb67a
@@ -0,0 +1,19 @@
+* Texas Instruments - dp83867 Giga bit ethernet phy
+
+Required properties:
+	- reg - The ID number for the phy, usually a small integer
+	- ti,rx_int_delay - RGMII Recieve Clock Delay - see dt-bindings/net/ti-dp83867.h
+		for applicable values
+	- ti,tx_int_delay - RGMII Transmit Clock Delay - see dt-bindings/net/ti-dp83867.h
+		for applicable values
+	- ti,fifo_depth - Transmitt FIFO depth- see dt-bindings/net/ti-dp83867.h
+		for applicable values
+
+Example:
+
+	ethernet-phy@0 {
+		reg = <0>;
+		ti,rx_int_delay = <DP83867_RGMIIDCTL_2_25_NS>;
+		ti,tx_int_delay = <DP83867_RGMIIDCTL_2_75_NS>;
+		ti,fifo_depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
+	};
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 +239 -0

239 lines not on this page · raw message

include/dt-bindings/net/ti-dp83867.h new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw

From: Dan Murphy <[email protected]>
Date: Tue, 2 Jun 2015 09:34:37 -0500

Quoted 9 lines

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.

Applied to net-next, thanks.

#2 lore raw
In reply to Dan Murphy
Quoted 7 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.

Sorry for the late feedback, since this is a new driver, things outline below can still be submitted as incremental fixes.

[snip]

Documentation/devicetree/bindings/net/ti,dp83867.txt line 10

Quoted 8 lines
Documentation/devicetree/bindings/net/ti,dp83867.txt new file +8 -0
+Required properties:
+	- reg - The ID number for the phy, usually a small integer
+	- ti,rx_int_delay - RGMII Recieve Clock Delay - see dt-bindings/net/ti-dp83867.h
+		for applicable values
+	- ti,tx_int_delay - RGMII Transmit Clock Delay - see dt-bindings/net/ti-dp83867.h
+		for applicable values
+	- ti,fifo_depth - Transmitt FIFO depth- see dt-bindings/net/ti-dp83867.h
+		for applicable values

We typically use "-" to separate words in DT properties, not "_". I am not sure about the required nature of these 3 proprietary/specific properties, cannot there be good reset defaults from the HW in any case?

You might want to add a reference to net/phy.txt for the remaiming DT properties.

[snip]

drivers/net/phy/dp83867.c line 168

Quoted 10 lines
drivers/net/phy/dp83867.c new file +10 -0
+
+	if (phy_interface_is_rgmii(phydev)) {
+		ret = phy_write(phydev, MII_DP83867_PHYCTRL,
+			(dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT));
+		if (ret)
+			return ret;
+	}
+
+	if ((phydev->interface >= PHY_INTERFACE_MODE_RGMII_ID) ||
+	    (phydev->interface <= PHY_INTERFACE_MODE_RGMII_RXID)) {

This one has not been converted to use the phy_interface_is_rgmii() helper, but in fact, once you do that, you could probably just add an early check for this condition, return, and reduce the indentation for the normal case/RGMII, and eliminate two redundant condition checks.

Thanks!

Signature · 1 line
Florian
author
#3 lore raw

Florian

Thanks for the re-review

Quoted 13 lines · Florian Fainelli
Quoted 7 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.

Sorry for the late feedback, since this is a new driver, things outline below can still be submitted as incremental fixes.

[snip]

Quoted 11 lines

Documentation/devicetree/bindings/net/ti,dp83867.txt line 10

Quoted 8 lines
Documentation/devicetree/bindings/net/ti,dp83867.txt new file +8 -0
+Required properties:
+	- reg - The ID number for the phy, usually a small integer
+	- ti,rx_int_delay - RGMII Recieve Clock Delay - see dt-bindings/net/ti-dp83867.h
+		for applicable values
+	- ti,tx_int_delay - RGMII Transmit Clock Delay - see dt-bindings/net/ti-dp83867.h
+		for applicable values
+	- ti,fifo_depth - Transmitt FIFO depth- see dt-bindings/net/ti-dp83867.h
+		for applicable values

We typically use "-" to separate words in DT properties, not "_". I am not sure about the required nature of these 3 proprietary/specific properties, cannot there be good reset defaults from the HW in any case?

Yes you are correct I will modify as an incremental fix.

The hardware is defaulted to an internal delay of 2 ns. This value needs to be adjusted per product based on trace length. I would anticipate the DT properties to grow a little as the part gets used more.

Quoted 5 lines

You might want to add a reference to net/phy.txt for the remaiming DT properties.

[snip]

Quoted 14 lines

drivers/net/phy/dp83867.c line 168

Quoted 10 lines
drivers/net/phy/dp83867.c new file +10 -0
+
+	if (phy_interface_is_rgmii(phydev)) {
+		ret = phy_write(phydev, MII_DP83867_PHYCTRL,
+			(dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT));
+		if (ret)
+			return ret;
+	}
+
+	if ((phydev->interface >= PHY_INTERFACE_MODE_RGMII_ID) ||
+	    (phydev->interface <= PHY_INTERFACE_MODE_RGMII_RXID)) {

This one has not been converted to use the phy_interface_is_rgmii() helper, but in fact, once you do that, you could probably just add an early check for this condition, return, and reduce the indentation for the normal case/RGMII, and eliminate two redundant condition checks.

This check is different then the generic RGMII check. I am checking to see if the interface has the internal delay flag set. The RGMII check is to broad. Maybe I can add a helper for this
if it makes sense thoughts? Maybe a phy_interface_has_rgmii_int_delay API just to enter this check.

Dan

Quoted 1 line

Thanks!

Signature · 2 lines
------------------
Dan Murphy
#4 lore raw
Quoted 30 lines · Dan Murphy

Florian

Thanks for the re-review

Quoted 13 lines · Florian Fainelli
Quoted 7 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.

Sorry for the late feedback, since this is a new driver, things outline below can still be submitted as incremental fixes.

[snip]

Quoted 11 lines

Documentation/devicetree/bindings/net/ti,dp83867.txt line 10

Quoted 8 lines
Documentation/devicetree/bindings/net/ti,dp83867.txt new file +8 -0
+Required properties:
+	- reg - The ID number for the phy, usually a small integer
+	- ti,rx_int_delay - RGMII Recieve Clock Delay - see dt-bindings/net/ti-dp83867.h
+		for applicable values
+	- ti,tx_int_delay - RGMII Transmit Clock Delay - see dt-bindings/net/ti-dp83867.h
+		for applicable values
+	- ti,fifo_depth - Transmitt FIFO depth- see dt-bindings/net/ti-dp83867.h
+		for applicable values

We typically use "-" to separate words in DT properties, not "_". I am not sure about the required nature of these 3 proprietary/specific properties, cannot there be good reset defaults from the HW in any case?

Quoted 5 lines

Yes you are correct I will modify as an incremental fix.

The hardware is defaulted to an internal delay of 2 ns. This value needs to be adjusted per product based on trace length. I would anticipate the DT properties to grow a little as the part gets used more.

Ok, that makes sense then.

Quoted 21 lines
Quoted 6 lines

You might want to add a reference to net/phy.txt for the remaiming DT properties.

[snip]

Quoted 14 lines

drivers/net/phy/dp83867.c line 168

Quoted 10 lines
drivers/net/phy/dp83867.c new file +10 -0
+
+	if (phy_interface_is_rgmii(phydev)) {
+		ret = phy_write(phydev, MII_DP83867_PHYCTRL,
+			(dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT));
+		if (ret)
+			return ret;
+	}
+
+	if ((phydev->interface >= PHY_INTERFACE_MODE_RGMII_ID) ||
+	    (phydev->interface <= PHY_INTERFACE_MODE_RGMII_RXID)) {

This one has not been converted to use the phy_interface_is_rgmii() helper, but in fact, once you do that, you could probably just add an early check for this condition, return, and reduce the indentation for the normal case/RGMII, and eliminate two redundant condition checks.

Quoted 3 lines

This check is different then the generic RGMII check. I am checking to see if the interface has the internal delay flag set. The RGMII check is to broad. Maybe I can add a helper for this
if it makes sense thoughts? Maybe a phy_interface_has_rgmii_int_delay API just to enter this check.

Oh, I misread the range check. I do not think this deserves a helper function for now, since that seems to be pretty unique and localized to your driver for now, but if we have more than one users, factoring things out would definitively make sense then.

Thanks.

Signature · 1 line
Florian