Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 May 2024 06:27:47 +0200
From:      John Hay <john@sanren.ac.za>
To:        freebsd-hackers@freebsd.org
Subject:   FreeBSD driver for the OCP TAP Time Card
Message-ID:  <CAGv8uar=CmAXowLUS1H2hEHk3OPJPifgXSy3Ru9VodRcoy4yPA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
--0000000000003c906e0617e9ba58
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi,

I have been working on a FreeBSD driver for the Open Compute Project (OCP)
Time Appliance Project (TAP) Time Card. The card consists of three main
parts, a clock module, a GNSS module and a FPGA module. The firmware for
the FPGA implements a counter that is synchronized to TAI using the GNSS
module and the clock module. The counter is implemented as two 32-bit
registers, seconds and nanoseconds, like struct timespec, and make that
available on the pci-e bus.

More about the Time Card is available at:
https://github.com/opencomputeproject/Time-Appliance-Project/tree/master/Ti=
me-Card

The driver / software consists of two main parts:

The kernel module timecard(4):
- Provides access to the card=E2=80=99s functionality,
- Implements a timecounter, =E2=80=9CTimeCard=E2=80=9D, using the timecount=
ers(4) API,
- Make the PPS signal and timestamp available with the RFC 2783 Pulse Per
Second (PPS) API,
- Provides a timecard bus to which uart(4), iicbus(4) and spibus(4) drivers
can attach.

A daemon timecard(8):
- Provides a shm(28) driver for ntpd(8),
- Optionally synchronize the kernel time to the timecard(4) time,
- Discipline or train the clock on board of the TimeCard through the iic(4)
Clock interface.

With the above software and ntpd running and disciplining the kernel time,
the kernel time can stay within +-2ns according to ntpd. If neither ntpd
nor timecard(8) is set to discipline the kernel time, it will slowly drift
away because there is a small rounding error when converting from
timecounter nanoseconds read to bintime and then later to timespec. When
ntpd is set to discipline the kernel time and it has settled, ntpq=E2=80=99=
s
kerninfo command will report a pll frequency of 1.52588e-05 (ppm).

The card is Precision Time Protocol (PTP) capable, but the driver does not
support that.

The driver is available at:
https://github.com/JohnHay/TimeCard/

Regards

John

--0000000000003c906e0617e9ba58
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<br><br>I have been working on a FreeBSD driver for the=
 Open Compute Project (OCP) Time Appliance Project (TAP) Time Card. The car=
d consists of three main parts, a clock module, a GNSS module and a FPGA mo=
dule. The firmware for the FPGA implements a counter that is synchronized t=
o TAI using the GNSS module and the clock module. The counter is implemente=
d as two 32-bit registers, seconds and nanoseconds, like struct timespec, a=
nd make that available on the pci-e bus.<br><br>More about the Time Card is=
 available at:<br><a href=3D"https://github.com/opencomputeproject/Time-App=
liance-Project/tree/master/Time-Card">https://github.com/opencomputeproject=
/Time-Appliance-Project/tree/master/Time-Card</a><br><br>The driver / softw=
are consists of two main parts:<br><br>The kernel module timecard(4):<br>- =
Provides access to the card=E2=80=99s functionality,<br>- Implements a time=
counter, =E2=80=9CTimeCard=E2=80=9D, using the timecounters(4) API,<br>- Ma=
ke the PPS signal and timestamp available with the RFC 2783 Pulse Per Secon=
d (PPS) API,<br>- Provides a timecard bus to which uart(4), iicbus(4) and s=
pibus(4) drivers can attach.<br><br>A daemon timecard(8):<br>- Provides a s=
hm(28) driver for ntpd(8),<br>- Optionally synchronize the kernel time to t=
he timecard(4) time,<br>- Discipline or train the clock on board of the Tim=
eCard through the iic(4) Clock interface.<br><br>With the above software an=
d ntpd running and disciplining the kernel time, the kernel time can stay w=
ithin +-2ns according to ntpd. If neither ntpd nor timecard(8) is set to di=
scipline the kernel time, it will slowly drift away because there is a smal=
l rounding error when converting from timecounter nanoseconds read to binti=
me and then later to timespec. When ntpd is set to discipline the kernel ti=
me and it has settled, ntpq=E2=80=99s kerninfo command will report a pll fr=
equency of 1.52588e-05 (ppm).<br><br>The card is Precision Time Protocol (P=
TP) capable, but the driver does not support that.<br><br>The driver is ava=
ilable at:<br><div><a href=3D"https://github.com/JohnHay/TimeCard/">https:/=
/github.com/JohnHay/TimeCard/</a></div><div><br></div><div>Regards</div><di=
v><br></div><div>John</div><div><br></div></div>

--0000000000003c906e0617e9ba58--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGv8uar=CmAXowLUS1H2hEHk3OPJPifgXSy3Ru9VodRcoy4yPA>