xref: /linux/Documentation/ABI/testing/sysfs-timecard (revision 70c29b35fd87f87a7b8dad6eb8d55ce54a0d549a)
1What:		/sys/class/timecard/
2Date:		September 2021
3Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
4Description:	This directory contains files and directories
5		providing a standardized interface to the ancillary
6		features of the OpenCompute timecard.
7
8What:		/sys/class/timecard/ocpN/
9Date:		September 2021
10Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
11Description:	This directory contains the attributes of the Nth timecard
12		registered.
13
14What:		/sys/class/timecard/ocpN/cpld_status
15Date:		July 2026
16Contact:	Sagi Maimon <maimon.sagi@gmail.com>
17Description:	(RO, root only) The flags set in the status register of the
18		TAP CPLD, space separated, or an empty line when none is
19		set.  Only present on ADVA x1 TAP boards (PCI ID
20		0xad5a:0x0410).
21
22		==========  ================================================
23		done        the configuration flash holds a valid image and
24			    it is active
25		busy        an internal operation is in progress
26		failed      the last ISC operation failed
27		==========  ================================================
28
29		For example "busy" while an operation runs, or "busy failed"
30		if a failure is latched while another one is in progress.
31
32		A read arbitrates for the shared I2C bus and reprograms the
33		on-card mux, so it is restricted to root.  The Lattice device
34		ID of the CPLD is read by the driver shortly after probe,
35		and again after a successful CPLD update, and reported from
36		that cached value as the fixed "cpld.id" version by
37		devlink dev info.
38
39		New CPLD firmware is programmed with devlink dev flash,
40		selecting the "fw.cpld" component; see
41		Documentation/networking/devlink/ptp_ocp.rst.
42
43What:		/sys/class/timecard/ocpN/available_clock_sources
44Date:		September 2021
45Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
46Description:	(RO) The list of available time sources that the PHC
47		uses for clock adjustments.
48
49		====  =================================================
50                NONE  no adjustments
51                PPS   adjustments come from the PPS1 selector (default)
52                TOD   adjustments from the GNSS/TOD module
53                IRIG  adjustments from external IRIG-B signal
54                DCF   adjustments from external DCF signal
55                ====  =================================================
56
57What:		/sys/class/timecard/ocpN/available_sma_inputs
58Date:		September 2021
59Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
60Description:	(RO) Set of available destinations (sinks) for a SMA
61		input signal.
62
63                =====  ================================================
64                10Mhz  signal is used as the 10Mhz reference clock
65                PPS1   signal is sent to the PPS1 selector
66                PPS2   signal is sent to the PPS2 selector
67                TS1    signal is sent to timestamper 1
68                TS2    signal is sent to timestamper 2
69                TS3    signal is sent to timestamper 3
70                TS4    signal is sent to timestamper 4
71                IRIG   signal is sent to the IRIG-B module
72                DCF    signal is sent to the DCF module
73                FREQ1  signal is sent to frequency counter 1
74                FREQ2  signal is sent to frequency counter 2
75                FREQ3  signal is sent to frequency counter 3
76                FREQ4  signal is sent to frequency counter 4
77                None   signal input is disabled
78                =====  ================================================
79
80What:		/sys/class/timecard/ocpN/available_sma_outputs
81Date:		May 2021
82Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
83Description:	(RO) Set of available sources for a SMA output signal.
84
85                =====  ================================================
86                10Mhz  output is from the 10Mhz reference clock
87                PHC    output PPS is from the PHC clock
88                MAC    output PPS is from the Miniature Atomic Clock
89                GNSS1  output PPS is from the first GNSS module
90                GNSS2  output PPS is from the second GNSS module
91                IRIG   output is from the PHC, in IRIG-B format
92                DCF    output is from the PHC, in DCF format
93                GEN1   output is from frequency generator 1
94                GEN2   output is from frequency generator 2
95                GEN3   output is from frequency generator 3
96                GEN4   output is from frequency generator 4
97                GND    output is GND
98                VCC    output is VCC
99                =====  ================================================
100
101What:		/sys/class/timecard/ocpN/clock_source
102Date:		September 2021
103Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
104Description:	(RW) Contains the current synchronization source used by
105		the PHC.  May be changed by writing one of the listed
106		values from the available_clock_sources attribute set.
107
108What:		/sys/class/timecard/ocpN/clock_status_drift
109Date:		March 2022
110Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
111Description:	(RO) Contains the current drift value used by the firmware
112		for internal disciplining of the atomic clock.
113
114What:		/sys/class/timecard/ocpN/clock_status_offset
115Date:		March 2022
116Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
117Description:	(RO) Contains the current offset value used by the firmware
118		for internal disciplining of the atomic clock.
119
120What:		/sys/class/timecard/ocpN/freqX
121Date:		March 2022
122Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
123Description:	(RO) Optional directory containing the sysfs nodes for
124		frequency counter <X>.
125
126What:		/sys/class/timecard/ocpN/freqX/frequency
127Date:		March 2022
128Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
129Description:	(RO) Contains the measured frequency over the specified
130		measurement period.
131
132What:		/sys/class/timecard/ocpN/freqX/seconds
133Date:		March 2022
134Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
135Description:	(RW) Specifies the number of seconds from 0-255 that the
136		frequency should be measured over.  Write 0 to disable.
137
138What:		/sys/class/timecard/ocpN/genX
139Date:		March 2022
140Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
141Description:	(RO) Optional directory containing the sysfs nodes for
142		frequency generator <X>.
143
144What:		/sys/class/timecard/ocpN/genX/duty
145Date:		March 2022
146Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
147Description:	(RO) Specifies the signal duty cycle as a percentage from 1-99.
148
149What:		/sys/class/timecard/ocpN/genX/period
150Date:		March 2022
151Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
152Description:	(RO) Specifies the signal period in nanoseconds.
153
154What:		/sys/class/timecard/ocpN/genX/phase
155Date:		March 2022
156Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
157Description:	(RO) Specifies the signal phase offset in nanoseconds.
158
159What:		/sys/class/timecard/ocpN/genX/polarity
160Date:		March 2022
161Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
162Description:	(RO) Specifies the signal polarity, either 1 or 0.
163
164What:		/sys/class/timecard/ocpN/genX/running
165Date:		March 2022
166Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
167Description:	(RO) Either 0 or 1, showing if the signal generator is running.
168
169What:		/sys/class/timecard/ocpN/genX/start
170Date:		March 2022
171Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
172Description:	(RO) Shows the time in <sec>.<nsec> that the signal generator
173		started running.
174
175What:		/sys/class/timecard/ocpN/genX/signal
176Date:		March 2022
177Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
178Description:	(RW) Used to start the signal generator, and summarize
179		the current status.
180
181		The signal generator may be started by writing the signal
182		period, followed by the optional signal values.  If the
183		optional values are not provided, they default to the current
184		settings, which may be obtained from the other sysfs nodes.
185
186		    period [duty [phase [polarity]]]
187
188		::
189
190		  echo 500000000 > signal       # 1/2 second period
191		  echo 1000000 40 100 > signal
192		  echo 0 > signal               # turn off generator
193
194		Period and phase are specified in nanoseconds.  Duty cycle is
195		a percentage from 1-99.  Polarity is 1 or 0.
196
197		Reading this node will return:
198
199		    period duty phase polarity start_time
200
201What:		/sys/class/timecard/ocpN/gnss_sync
202Date:		September 2021
203Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
204Description:	(RO) Indicates whether a valid GNSS signal is received,
205		or when the signal was lost.
206
207What:		/sys/class/timecard/ocpN/i2c
208Date:		September 2021
209Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
210Description:	This optional attribute links to the associated i2c device.
211
212What:		/sys/class/timecard/ocpN/irig_b_mode
213Date:		September 2021
214Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
215Description:	(RW) An integer from 0-7 indicating the timecode format
216		of the IRIG-B output signal: B00<n>
217
218What:		/sys/class/timecard/ocpN/pps
219Date:		September 2021
220Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
221Description:	This optional attribute links to the associated PPS device.
222
223What:		/sys/class/timecard/ocpN/ptp
224Date:		September 2021
225Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
226Description:	This attribute links to the associated PTP device.
227
228What:		/sys/class/timecard/ocpN/serialnum
229Date:		September 2021
230Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
231Description:	(RO) Provides the serial number of the timecard.
232
233What:		/sys/class/timecard/ocpN/sma1
234What:		/sys/class/timecard/ocpN/sma2
235What:		/sys/class/timecard/ocpN/sma3
236What:		/sys/class/timecard/ocpN/sma4
237Date:		September 2021
238Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
239Description:	(RW) These attributes specify the direction of the signal
240		on the associated SMA connectors, and also the signal sink
241		or source.
242
243		The display format of the attribute is a space separated
244		list of signals, prefixed by the input/output direction.
245
246		The signal direction may be changed (if supported) by
247		prefixing the signal list with either "in:" or "out:".
248		If neither prefix is present, then the direction is unchanged.
249
250		The output signal may be changed by writing one of the listed
251		values from the available_sma_outputs attribute set.
252
253		The input destinations may be changed by writing multiple
254		values from the available_sma_inputs attribute set,
255		separated by spaces.  If there are duplicated input
256		destinations between connectors, the lowest numbered SMA
257		connector is given priority.
258
259		Note that not all input combinations may make sense.
260
261		The 10Mhz reference clock input is currently only valid
262		on SMA1 and may not be combined with other destination sinks.
263
264What:		/sys/class/timecard/ocpN/tod_correction
265Date:		March 2022
266Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
267Description:	(RW) The incoming GNSS signal is in UTC time, and the NMEA
268		format messages do not provide a TAI offset.  This sets the
269		correction value for the incoming time.
270
271		If UBX_LS is enabled, this should be 0, and the offset is
272		taken from the UBX-NAV-TIMELS message.
273
274What:		/sys/class/timecard/ocpN/ts_window_adjust
275Date:		September 2021
276Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
277Description:	(RW) When retrieving the PHC with the PTP SYS_OFFSET_EXTENDED
278		ioctl, a system timestamp is made before and after the PHC
279		time is retrieved.  The midpoint between the two system
280		timestamps is usually taken to be the SYS time associated
281		with the PHC time.  This estimate may be wrong, as it depends
282		on PCI latencies, and when the PHC time was latched
283
284		The attribute value reduces the end timestamp by the given
285		number of nanoseconds, so the computed midpoint matches the
286		retrieved PHC time.
287
288		The initial value is set based on measured PCI latency and
289		the estimated point where the FPGA latches the PHC time.  This
290		value may be changed by writing an unsigned integer.
291
292What:		/sys/class/timecard/ocpN/tty
293Date:		August 2024
294Contact:	Vadim Fedorenko <vadim.fedorenko@linux.dev>
295Description:	(RO) Directory containing the sysfs nodes for TTY attributes
296
297What:		/sys/class/timecard/ocpN/tty/ttyGNSS
298What:		/sys/class/timecard/ocpN/tty/ttyGNSS2
299Date:		August 2024
300Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
301Description:	(RO) These optional attributes contain names of the TTY serial
302		ports associated with the GNSS devices.
303
304What:		/sys/class/timecard/ocpN/tty/ttyMAC
305Date:		August 2024
306Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
307Description:	(RO) This optional attribute contains name of the TTY serial
308		port associated with the Miniature Atomic Clock.
309
310What:		/sys/class/timecard/ocpN/tty/ttyNMEA
311Date:		August 2024
312Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
313Description:	(RO) This optional attribute contains name of the TTY serial
314		port which outputs the PHC time in NMEA ZDA format.
315
316What:		/sys/class/timecard/ocpN/utc_tai_offset
317Date:		September 2021
318Contact:	Jonathan Lemon <jonathan.lemon@gmail.com>
319Description:	(RW) The DCF and IRIG output signals are in UTC, while the
320		TimeCard operates on TAI.  This attribute allows setting the
321		offset in seconds, which is added to the TAI timebase for
322		these formats.
323
324		The offset may be changed by writing an unsigned integer.
325