Message ID | 20230120095348.26715-1-alexandru.tachici@analog.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp108875wrn; Fri, 20 Jan 2023 01:56:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXty1GcGNY99x+hJXVyGwcyc3iy302N0uJ7PC7JpQKqOfHIWBjYoXc3sSSWqZnRiaN8pCbOY X-Received: by 2002:a17:903:22ce:b0:194:d4d1:2928 with SMTP id y14-20020a17090322ce00b00194d4d12928mr6196965plg.50.1674208614228; Fri, 20 Jan 2023 01:56:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674208614; cv=none; d=google.com; s=arc-20160816; b=DzzzUzBhw4ian035Wmq7yG+OAr9pWjawodNsdbOTxLhzbDcO8zMNY73+CIuMS6H2lm pDs+Utmy5GSuTuBWVw/EXBO1mgaDYRYZGKr4O7lqoXe7IErV5IB66W7AfZGLckpg7fTY /MqmUQyYiLBWRX+nXJToCEEkvsJwC6jyp/5avFsLPy3/+Efl9dclVME7/937xTdlPjps pocr1JqaRLJPZ6QVh466YFAzfwOg4HP0rkcGzMFPBC7rkxaJPck3XaHktN5KepN5TOMc DzzU0J6FyTkHiBKipRO+CqjSfp88WaS+3noPh/bS9nDfJQ9QQ2JspvZBn0ZQb1ISO8Iz jivw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=9l4XZMtKFYABKuXixVxAl8Q8O7GucofcgScHKU04vrA=; b=uJ/83tQinpyaWdiJNUkDSg3u0OEnAUQuQ4NQozwcfLBu5UmyDGvImnPa2a8czb7Ypo o9/7Zzq6X0XNJAXjSYT7Yuii4LF6m2AipMlJoRTUeSvct+FGuzMBdN6hke9S3x58btaI Gl3nhJjbJNQBV3GxsPyof4tzSbvGXmFuzWK/8yC7NLlNKZjA/wlHItNUrgLqP8Q0dPtn /QrghS/PfOCnPXyraz8mxm2gGyUeS2fQMs0MWISsbLA6Y2V11RmQgXcX+9b/oX0UkHU/ yL8fXNRv4DV/NbVUhckKEnSrjw41kj2yRQECCa/btUTEG7PNmRNaF+Wc9x66qKQvJYwF eU7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=analog.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 13-20020a170902e9cd00b0019305638dd4si25091978plk.75.2023.01.20.01.56.42; Fri, 20 Jan 2023 01:56:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=analog.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230037AbjATJyc (ORCPT <rfc822;changwoo.m@gmail.com> + 99 others); Fri, 20 Jan 2023 04:54:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbjATJya (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 20 Jan 2023 04:54:30 -0500 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B43C73EE3; Fri, 20 Jan 2023 01:54:22 -0800 (PST) Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30K8g3ci023460; Fri, 20 Jan 2023 04:54:10 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3n7qnw09hk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Jan 2023 04:54:10 -0500 Received: from m0167089.ppops.net (m0167089.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 30K9oVqq026484; Fri, 20 Jan 2023 04:54:09 -0500 Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3n7qnw09hf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Jan 2023 04:54:09 -0500 Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 30K9s8We036473 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 20 Jan 2023 04:54:08 -0500 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Fri, 20 Jan 2023 04:54:07 -0500 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Fri, 20 Jan 2023 04:54:07 -0500 Received: from tachici-Precision-5530.ad.analog.com ([10.48.65.139]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 30K9rqTv021132; Fri, 20 Jan 2023 04:53:54 -0500 From: Alexandru Tachici <alexandru.tachici@analog.com> To: <linux-kernel@vger.kernel.org> CC: <netdev@vger.kernel.org>, <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>, <richardcochran@gmail.com>, <yangyingliang@huawei.com>, <weiyongjun1@huawei.com>, <robh+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <devicetree@vger.kernel.org>, <lennart@lfdomain.com> Subject: [net-next 0/3] net: ethernet: adi: adin1110: add PTP support Date: Fri, 20 Jan 2023 11:53:45 +0200 Message-ID: <20230120095348.26715-1-alexandru.tachici@analog.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-GUID: owdE7b4BtcC6l1n-GXg-_AUVyRcv3JEX X-Proofpoint-ORIG-GUID: 1I1KDlhbmhCwgZ576S4G8biYI3O2dqwG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-20_06,2023-01-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 adultscore=0 mlxscore=0 bulkscore=0 phishscore=0 spamscore=0 priorityscore=1501 clxscore=1011 suspectscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301200093 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755534971876991664?= X-GMAIL-MSGID: =?utf-8?q?1755534971876991664?= |
Series |
net: ethernet: adi: adin1110: add PTP support
|
|
Message
Alexandru Tachici
Jan. 20, 2023, 9:53 a.m. UTC
Add control for the PHC inside the ADIN1110/2111. Device contains a syntonized counter driven by a 120 MHz clock with 8 ns resolution. Time is stored in two registers: a 32bit seconds register and a 32bit nanoseconds register. For adjusting the clock timing, device uses an addend register. Can generate an output signal on the TS_TIMER pin. For reading the timestamp the current tiem is saved by setting the TS_CAPT pin via gpio in order to snapshot both seconds and nanoseconds in different registers that the live ones. Allow use of hardware RX/TX timestamping. RX frames are automatically timestamped by the device at hardware level when the feature is enabled. Time of day is the one used by the MAC device. When sending a TX frame to the MAC device, driver needs to send a custom header ahead of the ethernet one where it specifies where the MAC device should store the timestamp after the frame has successfully been sent on the MII line. It has 3 timestamp slots that can be read afterwards. Host will be notified by the TX_RDY IRQ. root@analog:~# ethtool -T eth1 Time stamping parameters for eth1: Capabilities: hardware-transmit software-transmit hardware-receive software-receive software-system-clock hardware-raw-clock PTP Hardware Clock: 0 Hardware Transmit Timestamp Modes: off on Hardware Receive Filter Modes: none all root@analog:~# sudo phc2sys -s eth1 -c CLOCK_REALTIME -O 0 -m phc2sys[4897.317]: CLOCK_REALTIME phc offset -511696 s0 freq -19464 delay 0 phc2sys[4898.317]: CLOCK_REALTIME phc offset -1023142 s1 freq -530689 delay 0 phc2sys[4899.318]: CLOCK_REALTIME phc offset -663 s2 freq -531352 delay 0 phc2sys[4900.318]: CLOCK_REALTIME phc offset -327 s2 freq -531215 delay 0 phc2sys[4901.318]: CLOCK_REALTIME phc offset -603 s2 freq -531589 delay 0 phc2sys[4902.318]: CLOCK_REALTIME phc offset 288 s2 freq -530879 delay 0 root@analog:~# ptp4l -m -f /etc/ptp_slave.conf ptp4l[1188.692]: port 1: new foreign master 00800f.fffe.950400-1 ptp4l[1192.329]: selected best master clock 00800f.fffe.950400 ptp4l[1192.329]: foreign master not using PTP timescale ptp4l[1192.329]: port 1: LISTENING to UNCALIBRATED on RS_SLAVE ptp4l[1194.129]: master offset 29379149 s0 freq -297035 path delay -810558 ptp4l[1195.929]: master offset 32040450 s1 freq +512000 path delay -810558 ptp4l[1198.058]: master offset 1608389 s2 freq +512000 path delay -810558 ptp4l[1198.058]: port 1: UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED ptp4l[1199.529]: clockcheck: clock jumped forward or running faster than expected! ptp4l[1199.529]: master offset 2419241 s0 freq +512000 path delay -810558 ptp4l[1199.529]: port 1: SLAVE to UNCALIBRATED on SYNCHRONIZATION_FAULT ptp4l[1201.329]: master offset 2004645 s0 freq +512000 path delay -810558 ptp4l[1203.130]: master offset 1618970 s1 freq +319234 path delay -810558 ptp4l[1204.930]: master offset -1098742 s2 freq -230137 path delay -810558 ptp4l[1204.930]: port 1: UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED ptp4l[1206.730]: master offset -1689657 s2 freq -512000 path delay -810558 ptp4l[1208.530]: master offset -1692389 s2 freq -512000 path delay -345770 ptp4l[1210.330]: master offset -404021 s2 freq -47588 path delay -166813 ptp4l[1212.130]: master offset 1098174 s2 freq +512000 path delay -104916 ptp4l[1214.061]: master offset 1579741 s2 freq +512000 path delay -60321 ptp4l[1215.730]: master offset 1180121 s2 freq +512000 path delay -60321 ptp4l[1217.531]: master offset -345392 s2 freq -78876 path delay -43020 Above ptp4l run was not the best as I do not have access (to my knowledge) to an accurate PTP grandmaster. Foreign master here is just my laptop (with only SW timestamping capabilities) with the ptp4l service runnning and NTP disabled. Alexandru Tachici (3): net: ethernet: adi: adin1110: add PTP clock support net: ethernet: adi: adin1110: add timestamping support dt-bindings: net: adin1110: Document ts-capt pin .../devicetree/bindings/net/adi,adin1110.yaml | 7 + drivers/net/ethernet/adi/adin1110.c | 811 +++++++++++++++++- 2 files changed, 808 insertions(+), 10 deletions(-)
Comments
On Fri, 20 Jan 2023 11:53:45 +0200 Alexandru Tachici wrote: > Add control for the PHC inside the ADIN1110/2111. > Device contains a syntonized counter driven by a 120 MHz > clock with 8 ns resolution. allmodconfig build breaks: ERROR: modpost: "ktime_get_fast_timestamps" [drivers/net/ethernet/adi/adin1110.ko] undefined!