From nobody Wed May 8 04:27:47 2024 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VZ2FK3vj1z5KClP for ; Wed, 08 May 2024 04:28:05 +0000 (UTC) (envelope-from john@sanren.ac.za) Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VZ2FH3QVyz4V9G for ; Wed, 8 May 2024 04:28:02 +0000 (UTC) (envelope-from john@sanren.ac.za) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=sanren-ac-za.20230601.gappssmtp.com header.s=20230601 header.b=iyptFdRH; dmarc=none; spf=pass (mx1.freebsd.org: domain of john@sanren.ac.za designates 2607:f8b0:4864:20::1032 as permitted sender) smtp.mailfrom=john@sanren.ac.za Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2b6208c88dcso284049a91.3 for ; Tue, 07 May 2024 21:28:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sanren-ac-za.20230601.gappssmtp.com; s=20230601; t=1715142479; x=1715747279; darn=freebsd.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=eztPO1vMP1efv3aXBLsUkENn1KhcbFLYJJGaQxocifg=; b=iyptFdRHy0RJp5eFxCK8I/gZ87UJjR+eakcsOPh9KcJbCSahkhbTqmfbzIMlwhCUp8 rO4LgHyAmU1ULcMsrpQVKtk4mZjVae6IBGJCzMNlVOgziqJXnG1NRNq49Jbm2gFhZrZC FKDPLTBJsWISdOXwDwKh5SWHD+5uyWxod19vVEeHwX8vrwt/QyhZKJhp5ZHAwgKRwDSm TYf2XffLJhvGxDf7rutsafimMK1RE/qCUpxIyzI0rRjG7DJ3sMf514/qu6aLisMX5uev UnoiIQO9ldVm97ogBYhqisJEnANiJ3isAfWcG3ZlxknUo9PRIePwzsvlKGGbOPip1Z1D b3Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715142479; x=1715747279; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=eztPO1vMP1efv3aXBLsUkENn1KhcbFLYJJGaQxocifg=; b=WH6Akh6ncsOke2dy0xLyc4uAQkdyedsD2w98GQF+ETnaW2RCpU7tIEVcIm2cQC8VFl 4jR5Pt0DA1C5OF3JdN8fK7CiJu16DeTcal8CD7NfNyeHe5wl1/ux5CIsSjbs/iw1Sxq+ brdYuaojNK6VbK0hRbblTaip/JVs2OL8pcc2Op69hjbmX9+jtCpINC1wAYbZFrVyqE73 SJxxRFTtD56vliVN4jJQ185q7vzluRoVZMikz8GwfCjTNZC5zv4yKU/fq1CVD/K6Bzts aKn/Or6M0Au9MhXdH+FaMSWB+5zwUnU/fzAUwJml5AR1z2on+9qnB0WupwUvU+Sl9CvO 84oQ== X-Gm-Message-State: AOJu0Yxhl6EJUE+uDPwC9PfgPft8ambmAH+Z4+wSDBzOWSUl72poZb1g Jxqib89PF8Qdje9OoOJGveNnIkxSfyPRAExaw8YTFIH0Lyn/lq7L45bmArBCRUSKJkq0xxHrnA7 HBWEITo4x2jisioS/+Km6j4PhbFqTwRWcZQyUAGDESFnfTrOw X-Google-Smtp-Source: AGHT+IExVo1ZtJCUdP7+z1ljjZO2kyBeAREHizOVF9lHhwEkxEIVsqtYxfSGZpn3Ar4W6/kSr+bTYVu0mBAhZaWiXR4= X-Received: by 2002:a17:90b:1207:b0:2a4:833f:2c1b with SMTP id 98e67ed59e1d1-2b61639cb22mr1703548a91.9.1715142479606; Tue, 07 May 2024 21:27:59 -0700 (PDT) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 From: John Hay Date: Wed, 8 May 2024 06:27:47 +0200 Message-ID: Subject: FreeBSD driver for the OCP TAP Time Card To: freebsd-hackers@freebsd.org Content-Type: multipart/alternative; boundary="0000000000003c906e0617e9ba58" X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.50 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; R_DKIM_ALLOW(-0.20)[sanren-ac-za.20230601.gappssmtp.com:s=20230601]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCPT_COUNT_ONE(0.00)[1]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_ONE(0.00)[1]; MISSING_XM_UA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; DMARC_NA(0.00)[sanren.ac.za]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; TO_DN_NONE(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::1032:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_LAST(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DKIM_TRACE(0.00)[sanren-ac-za.20230601.gappssmtp.com:+] X-Rspamd-Queue-Id: 4VZ2FH3QVyz4V9G --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
Hi,

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.

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

The driver / softw= are consists of two main parts:

The kernel module timecard(4):
- = Provides access to the card=E2=80=99s functionality,
- Implements a time= counter, =E2=80=9CTimeCard=E2=80=9D, using the timecounters(4) API,
- Ma= ke the PPS signal and timestamp available with the RFC 2783 Pulse Per Secon= d (PPS) API,
- Provides a timecard bus to which uart(4), iicbus(4) and s= pibus(4) drivers can attach.

A daemon timecard(8):
- Provides a s= hm(28) driver for ntpd(8),
- Optionally synchronize the kernel time to t= he timecard(4) time,
- Discipline or train the clock on board of the Tim= eCard through the iic(4) Clock interface.

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).

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

The driver is ava= ilable at:

Regards

John

--0000000000003c906e0617e9ba58--