ptp: IEEE 1588 hardware clock support
Subsystems (12)
Richard Cochran
maintainerv13 cover ptp: IEEE 1588 hardware clock support
* Introduction
The aim of this patch set is to add support for PTP Hardware Clocks (PHCs) into the Linux kernel. The patch series builds upon the dynamic posix clock work appearing in kernel version 2.6.39.
Support for obtaining timestamps from a PHC already exists via the SO_TIMESTAMPING socket option, integrated in kernel version 2.6.30. This patch set completes the picture by allow user space programs to adjust the PHC and to control its ancillary features.
* Why all the CCs?
- One driver is for PowerPC, and adds device tree stuff.
- One driver is for the ARM Xscale IXP465.
* PHC Patch ChangeLog
** v13
*** Incorporate v12 review from Andrew Morton
- external timestamp read: mutex was held unnecessarily long
- external timestamp read: require size to be multiple of sizeof(extts)
- replaced 'uint' with 'unsigned int' in poll function
- replaced empty release function with NULL function pointer
*** Incorporate v12 review from John Stultz
- added comment to explain the ppm to ppb conversion
- commented the locking rules for the queue_cnt() function
- commented the ppb to ppm conversion in the example program
- fixed incomplete locking of external timestamp queue
- gianfar, dp83640: comment on the locking rules
- gianfar: fixed unlikely unprotected register access in probe()
- ixp4xx: gave some private functions more unique names
* Previous Discussions
- [V12] http://lkml.org/lkml/2011/2/28/53
- [V11] http://lkml.org/lkml/2011/2/23/107
- [V10] http://lkml.org/lkml/2011/1/27/71
Richard Cochran (4):
ptp: Added a brand new class driver for ptp clocks.
ptp: Added a clock that uses the eTSEC found on the MPC85xx.
ptp: Added a clock driver for the IXP46x.
ptp: Added a clock driver for the National Semiconductor PHYTER.
Documentation/ABI/testing/sysfs-ptp | 98 ++ .../devicetree/bindings/net/fsl-tsec-phy.txt | 54 + Documentation/ptp/ptp.txt | 89 ++ Documentation/ptp/testptp.c | 368 +++++++ Documentation/ptp/testptp.mk | 33 + arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h | 78 ++ arch/powerpc/boot/dts/mpc8313erdb.dts | 13 + arch/powerpc/boot/dts/mpc8572ds.dts | 13 + arch/powerpc/boot/dts/p2020ds.dts | 13 + arch/powerpc/boot/dts/p2020rdb.dts | 13 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/net/Makefile | 1 + drivers/net/arm/ixp4xx_eth.c | 192 ++++- drivers/net/gianfar_ptp.c | 588 +++++++++++ drivers/net/phy/Makefile | 1 + drivers/net/phy/dp83640.c | 1015 ++++++++++++++++++++ drivers/net/phy/dp83640_reg.h | 267 +++++ drivers/ptp/Kconfig | 75 ++ drivers/ptp/Makefile | 7 + drivers/ptp/ptp_chardev.c | 155 +++ drivers/ptp/ptp_clock.c | 339 +++++++ drivers/ptp/ptp_ixp46x.c | 332 +++++++ drivers/ptp/ptp_private.h | 91 ++ drivers/ptp/ptp_sysfs.c | 230 +++++ include/linux/Kbuild | 1 + include/linux/ptp_clock.h | 84 ++ include/linux/ptp_clock_kernel.h | 139 +++ 28 files changed, 4289 insertions(+), 3 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-ptp create mode 100644 Documentation/ptp/ptp.txt create mode 100644 Documentation/ptp/testptp.c create mode 100644 Documentation/ptp/testptp.mk create mode 100644 arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h create mode 100644 drivers/net/gianfar_ptp.c create mode 100644 drivers/net/phy/dp83640.c create mode 100644 drivers/net/phy/dp83640_reg.h create mode 100644 drivers/ptp/Kconfig create mode 100644 drivers/ptp/Makefile create mode 100644 drivers/ptp/ptp_chardev.c create mode 100644 drivers/ptp/ptp_clock.c create mode 100644 drivers/ptp/ptp_ixp46x.c create mode 100644 drivers/ptp/ptp_private.h create mode 100644 drivers/ptp/ptp_sysfs.c create mode 100644 include/linux/ptp_clock.h create mode 100644 include/linux/ptp_clock_kernel.h
Richard Cochran
maintainerPATCH v13 1/4 ptp: Added a brand new class driver for ptp clocks.
This patch adds an infrastructure for hardware clocks that implement IEEE 1588, the Precision Time Protocol (PTP). A class driver offers a registration method to particular hardware clock drivers. Each clock is presented as a standard POSIX clock.
The ancillary clock features are exposed in two different ways, via the sysfs and by a character device.
--- Documentation/ABI/testing/sysfs-ptp | 98 +++++++++ Documentation/ptp/ptp.txt | 89 +++++++++ Documentation/ptp/testptp.c | 368 +++++++++++++++++++++++++++++++++++ Documentation/ptp/testptp.mk | 33 +++ drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/ptp/Kconfig | 30 +++ drivers/ptp/Makefile | 6 + drivers/ptp/ptp_chardev.c | 155 +++++++++++++++ drivers/ptp/ptp_clock.c | 339 ++++++++++++++++++++++++++++++++ drivers/ptp/ptp_private.h | 91 +++++++++ drivers/ptp/ptp_sysfs.c | 230 ++++++++++++++++++++++ include/linux/Kbuild | 1 + include/linux/ptp_clock.h | 84 ++++++++ include/linux/ptp_clock_kernel.h | 139 +++++++++++++ 15 files changed, 1666 insertions(+), 0 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-ptp create mode 100644 Documentation/ptp/ptp.txt create mode 100644 Documentation/ptp/testptp.c create mode 100644 Documentation/ptp/testptp.mk create mode 100644 drivers/ptp/Kconfig create mode 100644 drivers/ptp/Makefile create mode 100644 drivers/ptp/ptp_chardev.c create mode 100644 drivers/ptp/ptp_clock.c create mode 100644 drivers/ptp/ptp_private.h create mode 100644 drivers/ptp/ptp_sysfs.c create mode 100644 include/linux/ptp_clock.h create mode 100644 include/linux/ptp_clock_kernel.h
Documentation/ABI/testing/sysfs-ptp new file +98 -0
@@ -0,0 +1,98 @@ +What: /sys/class/ptp/ +Date: September 2010 +Contact: Richard Cochran <[email protected]> +Description: + This directory contains files and directories + providing a standardized interface to the ancillary + features of PTP hardware clocks. + +What: /sys/class/ptp/ptpN/ +Date: September 2010 +Contact: Richard Cochran <[email protected]> +Description: + This directory contains the attributes of the Nth PTP + hardware clock registered into the PTP class driver + subsystem. + +What: /sys/class/ptp/ptpN/clock_name +Date: September 2010 +Contact: Richard Cochran <[email protected]> +Description: + This file contains the name of the PTP hardware clock + as a human readable string. + +What: /sys/class/ptp/ptpN/max_adjustment +Date: September 2010 +Contact: Richard Cochran <[email protected]> +Description: + This file contains the PTP hardware clock's maximum + frequency adjustment value (a positive integer) in + parts per billion. + +What: /sys/class/ptp/ptpN/n_alarms +Date: September 2010 +Contact: Richard Cochran <[email protected]> +Description: + This file contains the number of periodic or one shot + alarms offer by the PTP hardware clock. + +What: /sys/class/ptp/ptpN/n_external_timestamps +Date: September 2010 +Contact: Richard Cochran <[email protected]> +Description: + This file contains the number of external timestamp + channels offered by the PTP hardware clock. + +What: /sys/class/ptp/ptpN/n_periodic_outputs +Date: September 2010 +Contact: Richard Cochran <[email protected]> +Description: + This file contains the number of programmable periodic + output channels offered by the PTP hardware clock. + +What: /sys/class/ptp/ptpN/pps_avaiable +Date: September 2010 +Contact: Richard Cochran <[email protected]> +Description: + This file indicates whether the PTP hardware clock + supports a Pulse Per Second to the host CPU. Reading + "1" means that the PPS is supported, while "0" means + not supported. + +What: /sys/class/ptp/ptpN/extts_enable +Date: September 2010 +Contact: Richard Cochran <[email protected]> +Description: + This write-only file enables or disables external + timestamps. To enable external timestamps, write the + channel index followed by a "1" into the file. + To disable external timestamps, write the channel + index followed by a "0" into the file. + +What: /sys/class/ptp/ptpN/fifo +Date: September 2010 +Contact: Richard Cochran <[email protected]> +Description: + This file provides timestamps on external events, in + the form of three integers: channel index, seconds, + and nanoseconds. + +What: /sys/class/ptp/ptpN/period +Date: September 2010 +Contact: Richard Cochran <[email protected]> +Description: + This write-only file enables or disables periodic + outputs. To enable a periodic output, write five + integers into the file: channel index, start time + seconds, start time nanoseconds, period seconds, and + period nanoseconds. To disable a periodic output, set + all the seconds and nanoseconds values to zero. + +What: /sys/class/ptp/ptpN/pps_enable +Date: September 2010 +Contact: Richard Cochran <[email protected]> +Description: + This write-only file enables or disables delivery of + PPS events to the Linux PPS subsystem. To enable PPS + events, write a "1" into the file. To disable events, + write a "0" into the file.
Documentation/ptp/ptp.txt new file +89 -0
89 lines not on this page · raw message
Documentation/ptp/testptp.c new file +368 -0
368 lines not on this page · raw message
Documentation/ptp/testptp.mk new file +33 -0
@@ -0,0 +1,33 @@ +# PTP 1588 clock support - User space test program +# +# Copyright (C) 2010 OMICRON electronics GmbH +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +CC = $(CROSS_COMPILE)gcc +INC = -I$(KBUILD_OUTPUT)/usr/include +CFLAGS = -Wall $(INC) +LDLIBS = -lrt +PROGS = testptp + +all: $(PROGS) + +testptp: testptp.o + +clean: + rm -f testptp.o + +distclean: clean + rm -f $(PROGS)
drivers/Kconfig +2 -0
@@ -54,6 +54,8 @@ source "drivers/spi/Kconfig" source "drivers/pps/Kconfig" +source "drivers/ptp/Kconfig" + source "drivers/gpio/Kconfig" source "drivers/w1/Kconfig"
drivers/Makefile +1 -0
@@ -76,6 +76,7 @@ obj-$(CONFIG_I2O) += message/ obj-$(CONFIG_RTC_LIB) += rtc/ obj-y += i2c/ media/ obj-$(CONFIG_PPS) += pps/ +obj-$(CONFIG_PTP_1588_CLOCK) += ptp/ obj-$(CONFIG_W1) += w1/ obj-$(CONFIG_POWER_SUPPLY) += power/ obj-$(CONFIG_HWMON) += hwmon/
drivers/ptp/Kconfig new file +30 -0
@@ -0,0 +1,30 @@ +# +# PTP clock support configuration +# + +menu "PTP clock support" + +comment "Enable Device Drivers -> PPS to see the PTP clock options." + depends on PPS=n + +config PTP_1588_CLOCK + tristate "PTP clock support" + depends on EXPERIMENTAL + depends on PPS + help + The IEEE 1588 standard defines a method to precisely + synchronize distributed clocks over Ethernet networks. The + standard defines a Precision Time Protocol (PTP), which can + be used to achieve synchronization within a few dozen + microseconds. In addition, with the help of special hardware + time stamping units, it can be possible to achieve + synchronization to within a few hundred nanoseconds. + + This driver adds support for PTP clocks as character + devices. If you want to use a PTP clock, then you should + also enable at least one clock driver as well. + + To compile this driver as a module, choose M here: the module + will be called ptp. + +endmenu
drivers/ptp/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# +# Makefile for PTP 1588 clock support. +# + +ptp-y := ptp_clock.o ptp_chardev.o ptp_sysfs.o +obj-$(CONFIG_PTP_1588_CLOCK) += ptp.o
drivers/ptp/ptp_chardev.c new file +155 -0
155 lines not on this page · raw message
drivers/ptp/ptp_clock.c new file +339 -0
339 lines not on this page · raw message
drivers/ptp/ptp_private.h new file +91 -0
91 lines not on this page · raw message
drivers/ptp/ptp_sysfs.c new file +230 -0
230 lines not on this page · raw message
include/linux/Kbuild +1 -0
@@ -302,6 +302,7 @@ header-y += ppp-comp.h header-y += ppp_defs.h header-y += pps.h header-y += prctl.h +header-y += ptp_clock.h header-y += ptrace.h header-y += qnx4_fs.h header-y += qnxtypes.h
include/linux/ptp_clock.h new file +84 -0
84 lines not on this page · raw message
include/linux/ptp_clock_kernel.h new file +139 -0
139 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Re: [PATCH V13 1/4] ptp: Added a brand new class driver for ptp clocks.
Quoted 9 lines · Richard Cochran
This patch adds an infrastructure for hardware clocks that implement IEEE 1588, the Precision Time Protocol (PTP). A class driver offers a registration method to particular hardware clock drivers. Each clock is presented as a standard POSIX clock.
The ancillary clock features are exposed in two different ways, via the sysfs and by a character device.
thanks
-john
Richard Cochran
maintainerPATCH v13 2/4 ptp: Added a clock that uses the eTSEC found on the MPC85xx.
In reply to Richard CochranThe eTSEC includes a PTP clock with quite a few features. This patch adds support for the basic clock adjustment functions, plus two external time stamps, one alarm, and the PPS callback.
--- .../devicetree/bindings/net/fsl-tsec-phy.txt | 54 ++ arch/powerpc/boot/dts/mpc8313erdb.dts | 13 + arch/powerpc/boot/dts/mpc8572ds.dts | 13 + arch/powerpc/boot/dts/p2020ds.dts | 13 + arch/powerpc/boot/dts/p2020rdb.dts | 13 + drivers/net/Makefile | 1 + drivers/net/gianfar_ptp.c | 588 ++++++++++++++++++++ drivers/ptp/Kconfig | 13 + 8 files changed, 708 insertions(+), 0 deletions(-) create mode 100644 drivers/net/gianfar_ptp.c
Documentation/devicetree/bindings/net/fsl-tsec-phy.txt +54 -0
@@ -74,3 +74,57 @@ Example: interrupt-parent = <&mpic>; phy-handle = <&phy0> }; + +* Gianfar PTP clock nodes + +General Properties: + + - compatible Should be "fsl,etsec-ptp" + - reg Offset and length of the register set for the device + - interrupts There should be at least two interrupts. Some devices + have as many as four PTP related interrupts. + +Clock Properties: + + - fsl,tclk-period Timer reference clock period in nanoseconds. + - fsl,tmr-prsc Prescaler, divides the output clock. + - fsl,tmr-add Frequency compensation value. + - fsl,tmr-fiper1 Fixed interval period pulse generator. + - fsl,tmr-fiper2 Fixed interval period pulse generator. + - fsl,max-adj Maximum frequency adjustment in parts per billion. + + These properties set the operational parameters for the PTP + clock. You must choose these carefully for the clock to work right. + Here is how to figure good values: + + TimerOsc = system clock MHz + tclk_period = desired clock period nanoseconds + NominalFreq = 1000 / tclk_period MHz + FreqDivRatio = TimerOsc / NominalFreq (must be greater that 1.0) + tmr_add = ceil(2^32 / FreqDivRatio) + OutputClock = NominalFreq / tmr_prsc MHz + PulseWidth = 1 / OutputClock microseconds + FiperFreq1 = desired frequency in Hz + FiperDiv1 = 1000000 * OutputClock / FiperFreq1 + tmr_fiper1 = tmr_prsc * tclk_period * FiperDiv1 - tclk_period + max_adj = 1000000000 * (FreqDivRatio - 1.0) - 1 + + The calculation for tmr_fiper2 is the same as for tmr_fiper1. The + driver expects that tmr_fiper1 will be correctly set to produce a 1 + Pulse Per Second (PPS) signal, since this will be offered to the PPS + subsystem to synchronize the Linux clock. + +Example: + + ptp_clock@24E00 { + compatible = "fsl,etsec-ptp"; + reg = <0x24E00 0xB0>; + interrupts = <12 0x8 13 0x8>; + interrupt-parent = < &ipic >; + fsl,tclk-period = <10>; + fsl,tmr-prsc = <100>; + fsl,tmr-add = <0x999999A4>; + fsl,tmr-fiper1 = <0x3B9AC9F6>; + fsl,tmr-fiper2 = <0x00018696>; + fsl,max-adj = <659999998>; + };
arch/powerpc/boot/dts/mpc8313erdb.dts +13 -0
@@ -208,6 +208,19 @@ sleep = <&pmc 0x00300000>; }; + ptp_clock@24E00 { + compatible = "fsl,etsec-ptp"; + reg = <0x24E00 0xB0>; + interrupts = <12 0x8 13 0x8>; + interrupt-parent = < &ipic >; + fsl,tclk-period = <10>; + fsl,tmr-prsc = <100>; + fsl,tmr-add = <0x999999A4>; + fsl,tmr-fiper1 = <0x3B9AC9F6>; + fsl,tmr-fiper2 = <0x00018696>; + fsl,max-adj = <659999998>; + }; + enet0: ethernet@24000 { #address-cells = <1>; #size-cells = <1>;
arch/powerpc/boot/dts/mpc8572ds.dts +13 -0
@@ -324,6 +324,19 @@ }; }; + ptp_clock@24E00 { + compatible = "fsl,etsec-ptp"; + reg = <0x24E00 0xB0>; + interrupts = <68 2 69 2 70 2 71 2>; + interrupt-parent = < &mpic >; + fsl,tclk-period = <5>; + fsl,tmr-prsc = <200>; + fsl,tmr-add = <0xAAAAAAAB>; + fsl,tmr-fiper1 = <0x3B9AC9FB>; + fsl,tmr-fiper2 = <0x3B9AC9FB>; + fsl,max-adj = <499999999>; + }; + enet0: ethernet@24000 { #address-cells = <1>; #size-cells = <1>;
arch/powerpc/boot/dts/p2020ds.dts +13 -0
@@ -336,6 +336,19 @@ phy_type = "ulpi"; }; + ptp_clock@24E00 { + compatible = "fsl,etsec-ptp"; + reg = <0x24E00 0xB0>; + interrupts = <68 2 69 2 70 2>; + interrupt-parent = < &mpic >; + fsl,tclk-period = <5>; + fsl,tmr-prsc = <200>; + fsl,tmr-add = <0xCCCCCCCD>; + fsl,tmr-fiper1 = <0x3B9AC9FB>; + fsl,tmr-fiper2 = <0x0001869B>; + fsl,max-adj = <249999999>; + }; + enet0: ethernet@24000 { #address-cells = <1>; #size-cells = <1>;
arch/powerpc/boot/dts/p2020rdb.dts +13 -0
@@ -396,6 +396,19 @@ phy_type = "ulpi"; }; + ptp_clock@24E00 { + compatible = "fsl,etsec-ptp"; + reg = <0x24E00 0xB0>; + interrupts = <68 2 69 2 70 2>; + interrupt-parent = < &mpic >; + fsl,tclk-period = <5>; + fsl,tmr-prsc = <200>; + fsl,tmr-add = <0xCCCCCCCD>; + fsl,tmr-fiper1 = <0x3B9AC9FB>; + fsl,tmr-fiper2 = <0x0001869B>; + fsl,max-adj = <249999999>; + }; + enet0: ethernet@24000 { #address-cells = <1>; #size-cells = <1>;
drivers/net/Makefile +1 -0
@@ -31,6 +31,7 @@ obj-$(CONFIG_ATL2) += atlx/ obj-$(CONFIG_ATL1E) += atl1e/ obj-$(CONFIG_ATL1C) += atl1c/ obj-$(CONFIG_GIANFAR) += gianfar_driver.o +obj-$(CONFIG_PTP_1588_CLOCK_GIANFAR) += gianfar_ptp.o obj-$(CONFIG_TEHUTI) += tehuti.o obj-$(CONFIG_ENIC) += enic/ obj-$(CONFIG_JME) += jme.o
drivers/net/gianfar_ptp.c new file +588 -0
588 lines not on this page · raw message
drivers/ptp/Kconfig +13 -0
@@ -27,4 +27,17 @@ config PTP_1588_CLOCK To compile this driver as a module, choose M here: the module will be called ptp. +config PTP_1588_CLOCK_GIANFAR + tristate "Freescale eTSEC as PTP clock" + depends on PTP_1588_CLOCK + depends on GIANFAR + help + This driver adds support for using the eTSEC as a PTP + clock. This clock is only useful if your PTP programs are + getting hardware time stamps on the PTP Ethernet packets + using the SO_TIMESTAMPING API. + + To compile this driver as a module, choose M here: the module + will be called gianfar_ptp. + endmenu
Signature · 1 line
1.7.0.4
Re: [PATCH V13 2/4] ptp: Added a clock that uses the eTSEC found on the MPC85xx.
Quoted 5 lines · Richard Cochran
The eTSEC includes a PTP clock with quite a few features. This patch adds support for the basic clock adjustment functions, plus two external time stamps, one alarm, and the PPS callback.
Signed-off-by Richard Cochran <[email protected]>
Richard Cochran
maintainerPATCH v13 3/4 ptp: Added a clock driver for the IXP46x.
In reply to Richard CochranThis patch adds a driver for the hardware time stamping unit found on the IXP465. The basic clock operations and an external trigger are implemented.
--- arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h | 78 ++++++ drivers/net/arm/ixp4xx_eth.c | 192 ++++++++++++++- drivers/ptp/Kconfig | 13 + drivers/ptp/Makefile | 1 + drivers/ptp/ptp_ixp46x.c | 332 +++++++++++++++++++++++++ 5 files changed, 613 insertions(+), 3 deletions(-) create mode 100644 arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h create mode 100644 drivers/ptp/ptp_ixp46x.c
arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h new file +78 -0
@@ -0,0 +1,78 @@ +/* +* PTP 1588 clock using the IXP46X +* +* Copyright (C) 2010 OMICRON electronics GmbH +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _IXP46X_TS_H_ +#define _IXP46X_TS_H_ + +#define DEFAULT_ADDEND 0xF0000029 +#define TICKS_NS_SHIFT 4 + +struct ixp46x_channel_ctl { +u32 ch_control;/* 0x40 Time Synchronization Channel Control */ +u32 ch_event;/* 0x44 Time Synchronization Channel Event */ +u32 tx_snap_lo;/* 0x48 Transmit Snapshot Low Register */ +u32 tx_snap_hi;/* 0x4C Transmit Snapshot High Register */ +u32 rx_snap_lo;/* 0x50 Receive Snapshot Low Register */ +u32 rx_snap_hi;/* 0x54 Receive Snapshot High Register */ +u32 src_uuid_lo;/* 0x58 Source UUID0 Low Register */ +u32 src_uuid_hi;/* 0x5C Sequence Identifier/Source UUID0 High */ +}; + +struct ixp46x_ts_regs { +u32 control;/* 0x00 Time Sync Control Register */ +u32 event;/* 0x04 Time Sync Event Register */ +u32 addend;/* 0x08 Time Sync Addend Register */ +u32 accum;/* 0x0C Time Sync Accumulator Register */ +u32 test;/* 0x10 Time Sync Test Register */ +u32 unused;/* 0x14 */ +u32 rsystime_lo;/* 0x18 RawSystemTime_Low Register */ +u32 rsystime_hi;/* 0x1C RawSystemTime_High Register */ +u32 systime_lo;/* 0x20 SystemTime_Low Register */ +u32 systime_hi;/* 0x24 SystemTime_High Register */ +u32 trgt_lo;/* 0x28 TargetTime_Low Register */ +u32 trgt_hi;/* 0x2C TargetTime_High Register */ +u32 asms_lo;/* 0x30 Auxiliary Slave Mode Snapshot Low */ +u32 asms_hi;/* 0x34 Auxiliary Slave Mode Snapshot High */ +u32 amms_lo;/* 0x38 Auxiliary Master Mode Snapshot Low */ +u32 amms_hi;/* 0x3C Auxiliary Master Mode Snapshot High */ + +struct ixp46x_channel_ctl channel[3 ]; +}; + +/* 0x00 Time Sync Control Register Bits */ +#define TSCR_AMM (1<<3) +#define TSCR_ASM (1<<2) +#define TSCR_TTM (1<<1) +#define TSCR_RST (1<<0) + +/* 0x04 Time Sync Event Register Bits */ +#define TSER_SNM (1<<3) +#define TSER_SNS (1<<2) +#define TTIPEND (1<<1) + +/* 0x40 Time Synchronization Channel Control Register Bits */ +#define MASTER_MODE (1<<0) +#define TIMESTAMP_ALL (1<<1) + +/* 0x44 Time Synchronization Channel Event Register Bits */ +#define TX_SNAPSHOT_LOCKED (1<<0) +#define RX_SNAPSHOT_LOCKED (1<<1) + +#endif
drivers/net/arm/ixp4xx_eth.c +189 -3
254 lines not on this page · raw message
drivers/ptp/Kconfig +13 -0
@@ -40,4 +40,17 @@ config PTP_1588_CLOCK_GIANFAR To compile this driver as a module, choose M here: the module will be called gianfar_ptp. +config PTP_1588_CLOCK_IXP46X + tristate "Intel IXP46x as PTP clock" + depends on PTP_1588_CLOCK + depends on IXP4XX_ETH + help + This driver adds support for using the IXP46X as a PTP + clock. This clock is only useful if your PTP programs are + getting hardware time stamps on the PTP Ethernet packets + using the SO_TIMESTAMPING API. + + To compile this driver as a module, choose M here: the module + will be called ptp_ixp46x. + endmenu
drivers/ptp/Makefile +1 -0
@@ -4,3 +4,4 @@ ptp-y := ptp_clock.o ptp_chardev.o ptp_sysfs.o obj-$(CONFIG_PTP_1588_CLOCK) += ptp.o +obj-$(CONFIG_PTP_1588_CLOCK_IXP46X) += ptp_ixp46x.o
drivers/ptp/ptp_ixp46x.c new file +332 -0
332 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Re: [PATCH V13 3/4] ptp: Added a clock driver for the IXP46x.
Quoted 4 lines · Richard Cochran
This patch adds a driver for the hardware time stamping unit found on the IXP465. The basic clock operations and an external trigger are implemented.
Signed-off-by Richard Cochran <[email protected]>
Richard Cochran
maintainerPATCH v13 4/4 ptp: Added a clock driver for the National Semiconductor PHYTER.
In reply to Richard CochranThis patch adds support for the PTP clock found on the DP83640. The basic clock operations and one external time stamp have been implemented.
--- drivers/net/phy/Makefile | 1 + drivers/net/phy/dp83640.c | 1015 +++++++++++++++++++++++++++++++++++++++++ drivers/net/phy/dp83640_reg.h | 267 +++++++++++ drivers/ptp/Kconfig | 19 + 4 files changed, 1302 insertions(+), 0 deletions(-) create mode 100644 drivers/net/phy/dp83640.c create mode 100644 drivers/net/phy/dp83640_reg.h
drivers/net/phy/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_FIXED_PHY) += fixed.o 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_STE10XP) += ste10Xp.o obj-$(CONFIG_MICREL_PHY) += micrel.o obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o
drivers/net/phy/dp83640.c new file +1015 -0
1,015 lines not on this page · raw message
drivers/net/phy/dp83640_reg.h new file +267 -0
267 lines not on this page · raw message
drivers/ptp/Kconfig +19 -0
@@ -53,4 +53,23 @@ config PTP_1588_CLOCK_IXP46X To compile this driver as a module, choose M here: the module will be called ptp_ixp46x. +comment "Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks." + depends on PTP_1588_CLOCK && (PHYLIB=n || NETWORK_PHY_TIMESTAMPING=n) + +config DP83640_PHY + tristate "Driver for the National Semiconductor DP83640 PHYTER" + depends on PTP_1588_CLOCK + depends on NETWORK_PHY_TIMESTAMPING + depends on PHYLIB + ---help--- + Supports the DP83640 PHYTER with IEEE 1588 features. + + This driver adds support for using the DP83640 as a PTP + clock. This clock is only useful if your PTP programs are + getting hardware time stamps on the PTP Ethernet packets + using the SO_TIMESTAMPING API. + + In order for this to work, your MAC driver must also + implement the skb_tx_timetamp() function. + endmenu
Signature · 1 line
1.7.0.4
Re: [PATCH V13 4/4] ptp: Added a clock driver for the National Semiconductor PHYTER.
Quoted 5 lines · Richard Cochran
This patch adds support for the PTP clock found on the DP83640. The basic clock operations and one external time stamp have been implemented.
Signed-off-by Richard Cochran <[email protected]>