Article View: linux.kernel.netdev
Article #25577[PATCH net-next v3 0/3] net: ethernet: ti: am65-cpts: add PTP_SYS_OFFSET_PRECISE support
From: James Clark
Date: Wed, 02 Dec 2026 02:42
Date: Wed, 02 Dec 2026 02:42
136 lines
16739 bytes
16739 bytes
This series adds PTP_SYS_OFFSET_PRECISE to the CPTS driver for TI K3
SoCs. This brings a similar hardware-supported level of precision to the
transfer of time from the PHC to the system clock as already exists for
the transfer of time into the PHC, whether over the network using
hardware timestamping of packets, or from a GNSS receiver using hardware
timestamping of its PPS signal.
The system counter of these SoCs, the Global Timebase Counter (GTC), can
export one of its bits on a push event output. The Time Sync Router can
route that output to a CPTS hardware timestamp input. The CPTS then
timestamps edges that fall at known counter values, so each timestamp
gives an exact pair of PHC time and system counter value. This is
similar to the PCIe PTM integration on these SoCs, where a selected bit
of the PTM timer drives a push input of the PCIe CPTS.
Patch 1 adds a ti,gtc-push property to the CPTS binding, which names
the syscon for the GTC register frame that selects the bit [2] and the
CPTS input. Patch 2 makes the driver wait after each pop from the CPTS
event FIFO, as the TRM requires; patch 3 relies on this. Patch 3
implements getcrosststamp.
The series does not set up the Time Sync Router. Mainline has no binding
for it on the J722S, so for now a board overlay sets the route, as it
does for ti,pps. With Rahul Sharma's proposed binding for the router
[1], the CPTS node could select the route itself. ti,gtc-push would stay
the same.
Tested on a BeagleY-AI (AM67A / J722S), a BeagleBone AI-64 (TDA4VM /
J721E) and a BeaglePlay (AM625).
With this series, phc2sys steering the system clock from a free-running
PHC sees an offset that never varies by more than 1ns, whether idle or
under memory load. Since the PHC and the system counter run from the
same oscillator, this is the noise of PTP_SYS_OFFSET_PRECISE itself.
Without this series, phc2sys falls back to PTP_SYS_OFFSET_EXTENDED and
the offset has a standard deviation of 2.5 to 10ns when idle and 22 to
31ns under load, with excursions of up to 200ns.
When the PHC is disciplined (by ptp4l or ts2phc, to within 4 to 7ns rms
of its reference), the offset seen by phc2sys with this series has a
standard deviation of 2 to 5ns, whether idle or under memory load.
Without this series, it has a standard deviation of 5 to 12ns when idle
and 22 to 29ns under load, again with excursions of up to 200ns.
PTP_SYS_OFFSET_PRECISE has a fixed bias, the capture delay of the push
event through the Time Sync Router and the CPTS input (about 11ns, plus
an undocumented delay in the GTC), which did not measurably change under
any load or CPU clock. This series does not correct for this bias. The
driver similarly does not correct for timestamping delay on extts
inputs, nor for ingress/egress latency in hardware timestamping of
packets. It turns out that the bias in PTP_SYS_OFFSET_PRECISE and the
delay in extts timestamping largely cancel each other out. The offset of
PTP_SYS_OFFSET_EXTENDED relative to PTP_SYS_OFFSET_PRECISE is about
-50ns when idle, and moves by up to 40ns with memory load and by up to
60ns with CPU clock frequency.
The implementation was also stress tested by using ntpperf to load the
CPTS (-D 0 -M at 15,000/s and -N 0 at 5,000/s). No errors or wrong pairs
were seen.
To try it on a BeagleY-AI, apply this overlay:
// SPDX-License-Identifier: GPL-2.0-only OR MIT
/dts-v1/;
/plugin/;
&{/} {
#address-cells = <2>;
#size-cells = <2>;
wkup_gtc: syscon@a80000 {
compatible = "ti,am654-gtc", "syscon";
reg = <0x0 0xa80000 0x0 0x400>;
};
};
&cbass_main {
#address-cells = <2>;
#size-cells = <2>;
timesync_router: pinctrl@a40000 {
compatible = "pinctrl-single";
reg = <0x0 0xa40000 0x0 0x400>;
#pinctrl-cells = <1>;
pinctrl-single,register-width = <32>;
pinctrl-single,function-mask = <0x000107ff>;
pinctrl-names = "default";
pinctrl-0 = <>c_push_route>;
gtc_push_route: gtc-push-route {
/* input 11 (GTC push event) -> output 14 (CPTS HW5_TS_PUSH) */
pinctrl-single,pins = <0x3c 0x1000b>;
};
};
};
&{/bus@f0000/ethernet@8000000/cpts@3d000} {
ti,gtc-push = <&wkup_gtc 4>;
};
I used an LLM coding assistant to help prepare this series.
Changes in v3:
- Patch 1: added Rob Herring's Reviewed-by
- New patch 2: wait after each event FIFO pop, as the TRM requires
(Sashiko, Simon Horman)
- Patch 3: dropped the arm path's own wait, now done by patch 2;
corrected the comment on draining the FIFO (Sashiko)
- Rebased on net-next
- Link to v2: https://lore.kernel.org/all/cover.1795143925.git.jjc@jclark.com/
Changes in v2:
- Rebased on net-next
- Dropped the syscon compatible patch, applied to mfd by Lee Jones
- Made a failed ti,gtc-push lookup a warning; the probe continues
without PTP_SYS_OFFSET_PRECISE (Rob Herring)
- Three smaller fixes to the driver, listed in patch 2
- Link to v1: https://lore.kernel.org/all/cover.1794284248.git.jjc@jclark.com/
[1] https://lore.kernel.org/all/20260828100615.1700223-1-r-sharma3@ti.com/
[2] https://lore.kernel.org/all/179511436097.97786.7515300839199702588.b4-ty@b4/
James Clark (3):
dt-bindings: net: ti,k3-am654-cpts: add ti,gtc-push
net: ethernet: ti: am65-cpts: wait after each event FIFO pop
net: ethernet: ti: am65-cpts: implement PTP_SYS_OFFSET_PRECISE
.../bindings/net/ti,k3-am654-cpts.yaml | 17 +
drivers/net/ethernet/ti/am65-cpts.c | 313 ++++++++++++++++++
2 files changed, 330 insertions(+)
base-commit: d7f7fac1c3220a430559c6d43904e27917ae1eb0
--
2.56.1
Technical Details
Message-ID:
<cover.1796179313.git.jjc@jclark.com>Path:
mbox-mo1.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375504-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375504-linux-kernel-netdev=dewy.ru
From: jjc@jclark.com (James Clark)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v3 0/3] net: ethernet: ti: am65-cpts: add PTP_SYS_OFFSET_PRECISE support
Date: Wed, 2 Dec 2026 09:42:55 +0700
Organization: Usenet Network
Message-ID: <cover.1796179313.git.jjc@jclark.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1871245"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ednjLwJYN9In0GbYrbTZgkPJmxU= sha256:2yFoHAkPIZ/l2TAOfj82RfgkjlprYm++Qsvg32rUd50=
sha1:T90zqvLz3Ly0DnUlsTk700zS7Us= sha256:YYNnFJGqyNQNTTDu3lHSn6akTiZeRipxDL73a9HfX+A=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id DC56C117534; Wed, 2 Dec 2026 05:43:22 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=jclark-com.20260707.gappssmtp.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id GqDr-kGT0n82;
Wed, 2 Dec 2026 05:43:19 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-375504-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=jclark.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 09FF7117523; Wed, 2 Dec 2026 05:43:11 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id EE24927450; Wed, 2 Dec 2026 02:43:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796179389;
b=wLH+j24u/8T3GiG9pMfwPbdX3M5aZYxsV4+vewN9i057UkJ5stBZi45TYCQ7I3OerdCf
Z5/we3xIJ5mNcKJ9mnILYdWRoAbf6a47+rNKatTbbuBdWER9cJoaRi/I6/SQI0x9iBUyc
dY+547QthTClm9qdy6HRyN/lCpcfNPeor+0lhtlI1sFCETD0ED74mOIL22OBwMl5fV92D
DCoxvW+Dw9ORI2ul49T30fPBwDymGlKeKst4UN00SFEUk79aPaACyQziwkDpP+padE4RD
HfUMV2mJp5t6WChKfuCbWbQXeFjICGc+0A9dLEONryXCfcFtpbfOzUxpxbUptcMDseg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796179389;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID:
X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=s5D2Fhcp1cwGVqmjs3lLFJp99hBIRKSK3B+6M2Wc1To=;
b=CDUmlp+o7e1v2F7hvDljOtaoVwcqtoqRGUKX+98SGqloHwwHL9mA95uIMbix8CXvQWfd
DR2D3Hju0cigZ0/ytEMKA5YCeToc454WjTqWitu4ThlOVs66NqQbigCQc8TfDKX03ZpBH
IZqEMaQTijshnOEDL5hh8xdf7bYpbcbCvVNNkRq7FIW2/Z3TGmIVaJUdAYUfaoGXAlFeD
P1YPYL7IZFnR9s7t/KtsJN1Wu5hVkvPSUvnSGGZgkT2T8rcLJnUL4M1CfRnc301zTH/JF
gHc9z28egY3iK7eOA6PlOYmyihtZIzQbdwYh8tkdUhMRqR0WbUO53Qd3iriNoAu09oQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=jclark-com.20260707.gappssmtp.com header.i=@jclark-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=T95gCYKu;
dmarc=none header.from=jclark.com;
spf=pass smtp.mailfrom=jclark.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id EA343606A336;
Wed, 2 Dec 2026 02:43:08 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=jclark-com.20260707.gappssmtp.com header.i=@jclark-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=T95gCYKu
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.170
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796179388;
b=pEjnAoSGMYQiBxlcj5gVLRacJ65owlI0BYaZmJvyl7rBqN0OIhr3jt5GXTO3DWXKtjxP
mvsBUdo3WnEb0GaJ4VFoNcD/qqMXMUJmwOM4hZMw5aYlpCNDb0EnXqS8U6iIWFxLQVRWH
amaZJV5JtjQ0ZHr+eBp5pMDIHSKU5EvR2czI0Y4S6FwZWIUibDPsKPMWHqPPXN71jUYBX
EfBf9ueS/1tWBaIoOQ3vo0DL/1wjKH6m+zNOlD/IvhHp8WkeghHrDozpoMiiP7DZsq2Ao
JBoMpzxwiyptJhOwQnezAQXC22kI4HuRlFIe1DQo5MjRcT+TDvTMnFcsM9Pz0TrbFeQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796179388;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version:
Content-Transfer-Encoding;
bh=s5D2Fhcp1cwGVqmjs3lLFJp99hBIRKSK3B+6M2Wc1To=;
b=GydjLiW8l2nhCfIgcM3VJYJGbq99JATeRmzh4YnFgV1W3vWwZof/YZuSKZBkaMzhyTUc
LxB/yA31VAAj/4e2w8qZU8yPbdSgeqm7Tx4ltKrOx79Cu1FvpBokThRT3ykxTcEHputsv
XI3rkgrbFN5ayuFiigVl9PlAepfVFeypstX4Trv+w+KWB35PzbcA3S24I97/mSaEq4nbS
92NbUaoUTfIQFq+MfP/5zNK8j4AG864N5kaHdUTnD4C0Moy+SldMjV+Wf1G3RWQUsJ2bS
HvwS6smTvJnIeT0RtxghfFIAytCqDzFmcNgSugpb2K2XNiT/W1tLptGZRC2Fcjbs71A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=none header.from=jclark.com;
spf=pass smtp.mailfrom=jclark.com;
dkim=pass header.d=jclark-com.20260707.gappssmtp.com header.i=@jclark-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=T95gCYKu;
arc=none smtp.remote-ip=74.125.82.170
X-Received: from mail-dy1-f170.google.com (mail-dy1-f170.google.com [74.125.82.170])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 950F3606A325
for <netdev@vger.kernel.org>; Wed, 2 Dec 2026 02:43:07 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 950F3606A325
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jclark.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=jclark.com
X-Received: by mail-dy1-f170.google.com with SMTP id 5a478bee46e88-386c4d2e2ccso12897696eec.0
for <netdev@vger.kernel.org>; Tue, 01 Dec 2026 18:43:07 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=jclark-com.20260707.gappssmtp.com; s=20260707; t=1796179386; x=1796784186; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
bh=s5D2Fhcp1cwGVqmjs3lLFJp99hBIRKSK3B+6M2Wc1To=;
b=T95gCYKuIkj3NJsF2jddwVD9VvZqZZAR/aBy2XRKHnY/QrjKGjJegbTyiaUCatpTXC
iI+29rzc+fE9pWI+lEzh1uD9UeHMfrNjI5whd+TpcY2JKpsyB7fDSQn/mtyTy1ho24Hi
rZpv5pHhNniw0yaMr35wUdDPIWSeHUvXR02dyUnG2W4GHeFyezX24kfZPfkzLfPBX4w9
mafpkysStnYXUTtFF6kehwZqJauzYWOMsDvQLhNuX4zIzWgVf4OKJ9Fv6VNTkz2C+Sud
VoA812GlsQvPRkO2NlcDbAXCQvN4rNqzJEOqpGohJGhBfh7/23amNpxWoYCqfr3E5RCI
aoOw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796179386; x=1796784186;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=s5D2Fhcp1cwGVqmjs3lLFJp99hBIRKSK3B+6M2Wc1To=;
b=HBFVKqyN+vTreD28MJPCvRiLgoR9NNqQIkI5vR37fKiLpHKl4iNC5XtyY5U05cqGCU
Dhxzt7JiRYr8dTPzzs/vUNDPCSqI0sjXQpSFNSUuHYXpjaLreORJU/cMySRq+grEuEv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XIIXuc7m
cFrdFOhy+g4L1do18G0ICc0U4s0uL/2tTB98sFmPo0YNqgPH8dd/sHllWPk0WlcOS4ooQ7O83ds
ir3tk7ljAt9CU6H2KEw==
X-Received: by 2002:a05:693c:69c7:b0:386:b745:ac60 with SMTP id 5a478bee46e88-386b745b019mr25562495eec.18.1796179386419;
Tue, 01 Dec 2026 18:43:06 -0800 (PST)
X-Received: from cantal.lan ([58.136.75.118])
by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385666e7fc3sm100925531eec.8.2026.12.01.18.43.00
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 01 Dec 2026 18:43:05 -0800 (PST)
X-Cc: Siddharth Vadapalli <s-vadapalli@ti.com>,
Roger Quadros <rogerq@kernel.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Martin Kaistra <martin.kaistra@linutronix.de>,
Vadim Fedorenko <vadim.fedorenko@linux.dev>,
Rahul Sharma <r-sharma3@ti.com>,
Robert Nelson <robertcnelson@gmail.com>,
Simon Horman <horms@kernel.org>,
Nishanth Menon <nm@ti.com>,
Vignesh Raghavendra <vigneshr@ti.com>,
netdev@vger.kernel.org,
devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
X-Mailer: git-send-email 2.56.1
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list