From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.174 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796179388; b=GIL/YbuzAwWnOsF4fnoYOirNCr5nFQLp7NN2ABl+Po29cYmbcCV2hzECOi8jIXvyJ999 AmOaPChPKoeT9noluWBL3CS/OYR8MupxtU+CLMDnQKZ5BFdnkJMSXv9D7PootbjaNyn2w KSn5pt9UxKmJcDcgbBqMLbRezu30aUR7WjgLiLJIQabcLLgjZrTsMbHn/qAV/KVvMgGht ZVT3brGfgfKTe+IsAXQhVks+kESNnUBBqGrSJPKQ/J/DRZHQ3wKF8v2/PjM6G8Ou50X1q TAnRNXTttJ4dVx/2frrVQ7BttET/gz/RPML6QouLzGaD95xm7wkJYZHancansXrCVBQ== 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=jfdBq0sJThiphZDq1RWhm2jMqFHDn0bIXcKEMkdrgxHQOxycsbL2JBxU0IRw4jHmQVX5 8YynrKqVoRIPwXaRZZYrI1fz7+fZnQZwzcAm0+JAkV8LP7Q2IEWF71q/He24Wocz/Ze0o wA6sA5Ceu1VIBgWfGaVMqjHMk43LUrEobwXGZQ+avhS2VAKjkNC7X+kq3wMG3eYUMX28W +AI8NIJXd3yjxs4x9FDQpvrz/t68/wMZKkI7uDDg/ZBXgobUciCsDQJAe5/wlPRCYjb9t SYwV3Gi5++1IVsYRncN+UBrHiyTgfAoHi7WO2FfxQ7bgCKppZY/ZKSuTlsZKt+IRAkg== 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.174 Received: from mail-dy1-f174.google.com (mail-dy1-f174.google.com [74.125.82.174]) (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 8CCC2606A322 for ; Wed, 2 Dec 2026 02:43:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8CCC2606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jclark.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=jclark.com 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 Received: by mail-dy1-f174.google.com with SMTP id 5a478bee46e88-38190551625so23376300eec.1 for ; Tue, 01 Dec 2026 18:43:07 -0800 (PST) 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=GaVqPolbaZyvdlIheiqvOHukC6IJlo+EmzjP6+0fS7RNe+qFCTGQng9U4uaQRDz2Bk re9lWsnIuSQx86aWAkp9lTneDhrWkEv3OFuQJLYWsCNxfoSkR1KQ93mI5u7kMF/xl+RD ZYspCl7h9AghfIBXt1VebREN/buzihXjAC+hI+P0NgazeK5nVRtUYBImRCjhrfo/c+qd 1UZwp8S8+r9gAoKnnepSTGZK7cvXwryOPIcEl8ratFmUhAl18ue4/1L6pFISD/hsSpkP rHM0pejbqth3KSSCo05j2DUwhov9YdbsLhPVPGzBA96lWcBy4zSrdODghexn7uPfPNul 6ljQ== X-Forwarded-Encrypted: i=1; AL+hErElZavn3sSQyevEHFyt/e4YU5ubcwD0T+k5b4NWHIHs4xZOp2GxsAERQe9xFAohL5hPg012xpp4SI0Q@vger.kernel.org X-Gm-Message-State: APuU4Z9dY/NuTQTbAimI+zC/1dlAqwFG5KGPRZx/V0pIY9lM96c7yMdX y51fX36baSBuCqdRblrPz/8em+MrGqaUQWInTU8NO/jNAH+bqyUgRiwohBI0SnGnfw== X-Gm-Gg: AZFdTZcHLFG632PY2h7tnIEy0dFM4ul4BfyuPVkpRC8YCCzfZeVVbfB/g+3bMmpQEhf a+s+HkGhzYI0+w8kMtnKm6OvJgcRxnjWn9fPyBVtBG/m9S/mOapSgZGHiQ5gnQHtbp0vDbqTEqz Mqi8SFX3HB3aUHKFWDdBqdJC0BSfi9HQeiJpErs8Oc0+3R6bUXC+dvPq3YVa6gH+7WzPlQW3sve rDBM/14tvceYEMnMxSylV3IXg45NnYjNo3uQlsyI+K+6JdERad3I3kwTKkYFeH1DQfihevnLzqZ VRgTyLxoh35/cuh9yoNj1gToner6In9xWvQncutt5NmwirZqcu4mTLkglZGs5meqZXNsDE6Peuq +iGP8sr6SmJxA2ue+cSyVZWckf/e3gfZxbst3s+267q5jHMbFSzN26KkqUKifastQ2jbI9hcU/o 2HG99iiyypIMAUu6S1lFf6l91aVXzczLiOHT6Rh0+MSd2XkPMyxdxeoHv8f9HnZ2G+DudoXL6DV SNrd47E5B9ZjJX5oSV1Lz9STrkUfM/hdjx7NDyaHg8Lpq7fkYszymvT9rXQ4ZhmxHYOT+ej+yue bnbITtyf5ew0wB2mLNawT224FoSK/20bukjf4T9lUXpX18LJ4hwSBvKQiEd8GWgX5jtcHtSiRuz 0oVTGd+zsza3bsklCwA== 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) 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) From: James Clark To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Siddharth Vadapalli , Roger Quadros , Sebastian Andrzej Siewior , Martin Kaistra , Vadim Fedorenko , Rahul Sharma , Robert Nelson , Simon Horman , Nishanth Menon , Vignesh Raghavendra , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 Message-ID: X-Mailer: git-send-email 2.56.1 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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