Skip to contentSkip to conversation

ptp: Add a driver for InES time stamping IP core.

PATCH Superseded Richard Cochran 2 participants 3 messages Oct 7, 2018 – May 21, 2019

Subsystems (4)

v2 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Richard Cochran

author maintainer
#0 lore raw

PATCH v2 5/5 ptp: Add a driver for InES time stamping IP core.

The InES at the ZHAW offers a PTP time stamping IP core. The FPGA logic recognizes and time stamps PTP frames on the MII bus. This patch adds a driver for the core along with a device tree binding to allow hooking the driver to MII buses.

---
 Documentation/devicetree/bindings/ptp/ptp-ines.txt |  37 +
 drivers/ptp/Kconfig                                |  10 +
 drivers/ptp/Makefile                               |   1 +
 drivers/ptp/ptp_ines.c                             | 870 +++++++++++++++++++++
 4 files changed, 918 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/ptp/ptp-ines.txt
 create mode 100644 drivers/ptp/ptp_ines.c
Documentation/devicetree/bindings/ptp/ptp-ines.txt new file +37 -0
new file mode 100644
index 000000000000..1484b62802c7
@@ -0,0 +1,37 @@
+ZHAW InES PTP time stamping IP core
+
+The IP core needs two different kinds of nodes.  The control node
+lives somewhere in the memory map and specifies the address of the
+control registers.  There can be up to three port handles placed as
+attributes of PHY nodes.  These associate a particular MII bus with a
+port index within the IP core.
+
+Required properties of the control node:
+
+- compatible:		"ines,ptp-ctrl"
+- reg:			physical address and size of the register bank
+- #phandle-cells:	must be one (1)
+
+Required format of the port handle within the PHY node:
+
+- timestamper:		provides control node reference and
+			the port channel within the IP core
+
+Example:
+
+	tstamper: timestamper@60000000 {
+		compatible = "ines,ptp-ctrl";
+		reg = <0x60000000 0x80>;
+		#phandle-cells = <1>;
+	};
+
+	ethernet@80000000 {
+		...
+		mdio {
+			...
+			phy@3 {
+				...
+				timestamper = <&tstamper 0>;
+			};
+		};
+	};
drivers/ptp/Kconfig +10 -0
index d137c480db46..475aa6f32edd 100644
@@ -88,6 +88,16 @@ config DP83640_PHY
 	  In order for this to work, your MAC driver must also
 	  implement the skb_tx_timestamp() function.
 
+config PTP_1588_CLOCK_INES
+	tristate "ZHAW InES PTP time stamping IP core"
+	depends on NETWORK_PHY_TIMESTAMPING
+	depends on PHYLIB
+	depends on PTP_1588_CLOCK
+	help
+	  This driver adds support for using the ZHAW InES 1588 IP
+	  core.  This clock is only useful if the MII bus of your MAC
+	  is wired up to the core.
+
 config PTP_1588_CLOCK_PCH
 	tristate "Intel PCH EG20T as PTP clock"
 	depends on X86_32 || COMPILE_TEST
drivers/ptp/Makefile +1 -0
index 19efa9cfa950..15b656712897 100644
@@ -6,6 +6,7 @@
 ptp-y					:= ptp_clock.o ptp_chardev.o ptp_sysfs.o
 obj-$(CONFIG_PTP_1588_CLOCK)		+= ptp.o
 obj-$(CONFIG_PTP_1588_CLOCK_DTE)	+= ptp_dte.o
+obj-$(CONFIG_PTP_1588_CLOCK_INES)	+= ptp_ines.o
 obj-$(CONFIG_PTP_1588_CLOCK_IXP46X)	+= ptp_ixp46x.o
 obj-$(CONFIG_PTP_1588_CLOCK_PCH)	+= ptp_pch.o
 obj-$(CONFIG_PTP_1588_CLOCK_KVM)	+= ptp_kvm.o
drivers/ptp/ptp_ines.c new file +870 -0

870 lines not on this page · raw message

Signature · 1 line
2.11.0
maintainer
#1 lore raw
Quoted 8 lines · Richard Cochran

The InES at the ZHAW offers a PTP time stamping IP core. The FPGA logic recognizes and time stamps PTP frames on the MII bus. This patch adds a driver for the core along with a device tree binding to allow hooking the driver to MII buses.

---
 Documentation/devicetree/bindings/ptp/ptp-ines.txt |  37 +

Bindings should be separate patch.

Quoted 14 lines
 drivers/ptp/Kconfig                                |  10 +
 drivers/ptp/Makefile                               |   1 +
 drivers/ptp/ptp_ines.c                             | 870 +++++++++++++++++++++
 4 files changed, 918 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/ptp/ptp-ines.txt
 create mode 100644 drivers/ptp/ptp_ines.c
Documentation/devicetree/bindings/ptp/ptp-ines.txt new file +1 -0
new file mode 100644
index 000000000000..1484b62802c7
@@ -0,0 +1,37 @@
+ZHAW InES PTP time stamping IP core

Documentation/devicetree/bindings/ptp/ptp-ines.txt line 11

Quoted 10 lines
Documentation/devicetree/bindings/ptp/ptp-ines.txt new file +10 -0
+
+The IP core needs two different kinds of nodes.  The control node
+lives somewhere in the memory map and specifies the address of the
+control registers.  There can be up to three port handles placed as
+attributes of PHY nodes.  These associate a particular MII bus with a
+port index within the IP core.
+
+Required properties of the control node:
+
+- compatible:		"ines,ptp-ctrl"

ines is not registered vendor prefix. Should it be 'zhaw' instead?

Documentation/devicetree/bindings/ptp/ptp-ines.txt line 13

Quoted 2 lines
Documentation/devicetree/bindings/ptp/ptp-ines.txt new file +2 -0
+- reg:			physical address and size of the register bank
+- #phandle-cells:	must be one (1)

#timestamper-cells

Or if it is always 1, you could omit it.

Documentation/devicetree/bindings/ptp/ptp-ines.txt line 18

Quoted 5 lines
Documentation/devicetree/bindings/ptp/ptp-ines.txt new file +5 -0
+
+Required format of the port handle within the PHY node:
+
+- timestamper:		provides control node reference and
+			the port channel within the IP core

This and #timestamper-cells need to be in a common binding doc.

And bonus points if you add a check in dtc for this. Should be a one-liner.

Quoted 19 lines
Documentation/devicetree/bindings/ptp/ptp-ines.txt new file +19 -0
+
+Example:
+
+	tstamper: timestamper@60000000 {
+		compatible = "ines,ptp-ctrl";
+		reg = <0x60000000 0x80>;
+		#phandle-cells = <1>;
+	};
+
+	ethernet@80000000 {
+		...
+		mdio {
+			...
+			phy@3 {
+				...
+				timestamper = <&tstamper 0>;
+			};
+		};
+	};
author maintainer
#2 lore raw
Quoted 7 lines · Rob Herring

Documentation/devicetree/bindings/ptp/ptp-ines.txt line 11

Quoted 4 lines · Richard Cochran
Documentation/devicetree/bindings/ptp/ptp-ines.txt new file +4 -0
+
+Required properties of the control node:
+
+- compatible:		"ines,ptp-ctrl"

ines is not registered vendor prefix. Should it be 'zhaw' instead?

I am preparing V3. Can you explain what you mean by "registered vendor prefix" please?

This IP Core comes from the ZHAW School of Engineering, Institute of Embedded Systems (InES).

ZHAW stands for "Zürcher Hochschule für Angewandte Wissenschaften."

Thanks,
Richard