From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011062.outbound.protection.outlook.com [52.101.70.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4ED5B25CC7A for ; Wed, 20 Aug 2025 01:44:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.62 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755654245; cv=fail; b=fnNldy3YYzP6pgGDR2FJ4wh3MqOepEm4+F6OgOM9zfxPN6xoX1XX6HsEl1gPXjUCn0/kGz5vaTAOYrwFM7mfc9WLBWDd8FrGCs8LjQvkvMko0yXqmkouuLXkj0xdNRxRuq+JuCe1vXDG5tEESRAkYpyGA128FArht5L8u0lwPzE= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755654245; c=relaxed/simple; bh=8F+XqpKJdJZs37T0gQgI7wIY6BCZoZdGpsC9kKI8XEI=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=XRennWiOLHlWa16YjL3E78xeNyUUdJYzxteQnFpA+Ol1fHTWsOHJWhj1UBTOAgU4rjseV5elTOt8upoFBRvVSqKv4HUavxQpeC9G4rsWFheyl7F6lgyNmlPt99Lck+WS4kSHM189gEvQNZTyZsPmN+6YersR2wBIfy5+b9qOsj0= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=Xtu9Raw1; arc=fail smtp.client-ip=52.101.70.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Xtu9Raw1" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bjlYbzpidY/qoG4HjqSZfWafWogWUShS92wsGnnQpVaMHg65KIevzhQ3rUT/w1HQIZF+YVZNngcL66TFOJgkHpakIwVudtLJ5CVD9ZMOEPd4Ht5E6/xGzptdB2P4dAnrWjG494ArmlNbECJVmbs23rcKnorhPB6PWAUyjfoUjQGH5Oq4vExs1khgN/puZo/SAOmKSfedW6KLzcixtMUGOp+ai6aH3diup9abRGPJTww3eYZMQYolLCmCHYOusBTheB4OrD82s53szN0dnAGOvwFKUUtogZAl0PCrr3vtqmNJv/GGX1RF7YylT35dbV9wmFBzIJcdj+SQKY8wR0MxPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rCluMsrxU+zN0Fq3gXmi5nXiKqRmp89calBfjD45Yr0=; b=ZrIp59gZ0ALkAfx1ByPNMkEi3hw/dW/+MyninM6x0nqm5r1THEHzxceKqAAo53PAPdMog9zg5Hh9NQcuVUGgNa86OgVFrqPNtFOi6qcQmfQ+rrpM0kfwnQVAugBgHd+a7YUNFFyrS7XDm6qqtpBiuzxUIDJikYw5PBetp9EkGLYGt8PMbm9wYuUhxnUroj2lGyawydwEMvlX2I8D+co2v/kvkujrg+lhAxRvQ6ROZP0+vIj6xezaUOPGxdEYzAjcq0NZU9VnPGTOSaUYkmkzdl3B36cT8jCWPK1BClT2IUcUpi6wsJCIJrY2tFKzmMESKBl7sLX0m6kV/K0v9mHmKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rCluMsrxU+zN0Fq3gXmi5nXiKqRmp89calBfjD45Yr0=; b=Xtu9Raw12af0BBRVk/Vu5YooXZ8S6b2p+Ccio9xWPAQ8Ci3Fl3AudX73coRAouGS7bnmAAP+BIF0m7SRefyL6GbtsFiD66dpMxyrH9H2YOXaZGFuM+wRtAObwvsI/3sTj9+kZ11MIUsXn4koynqO8d3nihvzzQNLFnGz/ofhSABPJZmFo4dH5ZjBoOCzEmpLT/0wuUEwbyl2tblxcB3kcB+GdTqeMNz1jNBy7hK6+svp9QU8DJElYF+RBXi/Hsb1Kzk48Nh1hIsNRqMJvCLDm9R3+LLKBFSVDh+FtgjfjbnmrxgPMKiZ7wwVloo+SqPKtg78/wBuSc64o5IRf8lM8w== Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by AM9PR04MB8620.eurprd04.prod.outlook.com (2603:10a6:20b:43b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9052.12; Wed, 20 Aug 2025 01:44:00 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%5]) with mapi id 15.20.9031.012; Wed, 20 Aug 2025 01:44:00 +0000 From: Wei Fang To: Vadim Fedorenko CC: "F.S. Peng" , "devicetree@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "imx@lists.linux.dev" , "kernel@pengutronix.de" , "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "richardcochran@gmail.com" , Claudiu Manoil , Vladimir Oltean , Clark Wang , "andrew+netdev@lunn.ch" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" , Frank Li , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "festevam@gmail.com" Subject: RE: [PATCH v4 net-next 04/15] ptp: netc: add NETC V4 Timer PTP driver support Thread-Topic: [PATCH v4 net-next 04/15] ptp: netc: add NETC V4 Timer PTP driver support Thread-Index: AQHcEQj5CQ+mJcoNQkmqvF9R3wJl/7RqH0yAgAClNrA= Date: Wed, 20 Aug 2025 01:44:00 +0000 Message-ID: References: <20250819123620.916637-1-wei.fang@nxp.com> <20250819123620.916637-5-wei.fang@nxp.com> <41651550-4e63-4699-b10f-ba2e8cfbc0a3@linux.dev> In-Reply-To: <41651550-4e63-4699-b10f-ba2e8cfbc0a3@linux.dev> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PAXPR04MB8510:EE_|AM9PR04MB8620:EE_ x-ms-office365-filtering-correlation-id: dd0e9615-0a02-43ad-8a7a-08dddf8b0924 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|1800799024|19092799006|376014|7416014|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?U8LXd6C2JSD3v83kUJlbz47Cw39hghbSs6G1cPOlKtex9AY5i6S8T/0pwr/z?= =?us-ascii?Q?cYXjiKy/P2Xt2Rt1zMAySrtt0Si29Dl/uA0u+fbz9soW2nsjbPskB3HiVc8U?= =?us-ascii?Q?m6fimmOZefP/F5GnjzTtC1CQ9SP3frUwm8KAosVyMTwyXo/IpDNuLppRkss7?= =?us-ascii?Q?89C2JGmJDvd+Xmjo7MjkLXA716I9FUVJowPW2oTDEZTDkL2UP2OHyaItOcoy?= =?us-ascii?Q?fyDiXEkwqPWyVywCyB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ascii?Q?PQ5wVrLKgHMu6S9iEGQfDJVNB7eD0609vEMRbvzAdSP/3dolKDWumRRsZDsi?= =?us-ascii?Q?shHW3VjFLW4kxipVwkMDxFzx4+CSAV218F2MfURWPuDOMsAsjcBM7eXCUUbq?= =?us-ascii?Q?OgAhIJMNEm4n/ylzoEScegkVWSYpDJ2GqTCgClyqk1imvcXB+s6KQoFyR1jj?= =?us-ascii?Q?tHFKlP1uJPzgcqHCfdVjZEkQvdxWdTKAcdizYkQ+LeslGMe8/y8WKats7Obt?= =?us-ascii?Q?vgRIm071ZZ5KqfwWLn8gnpjwR7uSjYGvEzw7AOuhpskmsTbY/RJ7G7exiQ8W?= =?us-ascii?Q?TjJexp8u9p5rJNN8Z3D9HtGgh5Sh+QS+G4aibRQNmHWd4/SLBRxUoTLUvj4G?= =?us-ascii?Q?E7g1+VG2LqWPzeo=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(19092799006)(376014)(7416014)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?gbvDb1xzwwbYqj3Fn2ipDMnRoCLPTuG12TwLhqOBearTP2wO075M0PDa7HQQ?= =?us-ascii?Q?J8d6DBb9c2hG2fug0g4ZzEifo5Ve5iB4yLx9aAE0LmS9xu/AQSqNf0rh3BvM?= =?us-ascii?Q?x4OHlKvRSW+Cls/gkpm3YfCk7VoRJIfFVlrKG2A8WucI+JhiPNN0t7FYY5Fb?= =?us-ascii?Q?X5T//7o+/xXHkMe/JWZTEuAqRY+5FTXkwo5nxx1xKdS6zsRwBR5F+dMHmnc9?= =?us-ascii?Q?+oycBaOR7cgDNTF3VHX7RWhzrOjU8J2h4FOpErSXXPOptmcrywD8GEZfy4Li?= =?us-ascii?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QhVfv?= =?us-ascii?Q?AViTc/Jnd4OLz7Tnp5gW5IL1+Ta6y/PEKVJiOzw1wc4GhHK39xW8JBxuz6Qw?= =?us-ascii?Q?tWrnbWDIwX5QKAov94EuU4yzcFDpFLt7DnQMhFj4JHl5e5DskyphOF3CoUhO?= =?us-ascii?Q?OQetcGgy58wzOSITSjp2We/twen/BRw/M6+bUmZMHppr/GBW45MyLO1gEW4L?= =?us-ascii?Q?sYI138+eT5xdpniz9kPXJFKN9o/uSEHBzX0VqmSN7EukE9rrgStDxWxGl9Hh?= =?us-ascii?Q?SouaUAY97YcrB0QmjAL1OS0YzIHZv0btm6swCMlOpJoOdKjFGCtjmgekBLuT?= =?us-ascii?Q?kkTWOU7jcb4xZfOtnVnQ5fAALGYIEM7rirANYFDqMlS0nSHR15PXgHgp4lqQ?= =?us-ascii?Q?A5vlJpBsgg0C25On2t4=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd0e9615-0a02-43ad-8a7a-08dddf8b0924 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Aug 2025 01:44:00.3247 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 5YJhRdz3IxPNaKdfFClyibSUDF3RpROAEp/XYUlpBfwbDSSVnOzaQOlxlUF4MamyV0KuY228Xdf29nPYVzHglg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8620 > On 19/08/2025 13:36, Wei Fang wrote: > > NETC V4 Timer provides current time with nanosecond resolution, precise > > periodic pulse, pulse on timeout (alarm), and time capture on external > > pulse support. And it supports time synchronization as required for > > IEEE 1588 and IEEE 802.1AS-2020. > > > > Inside NETC, ENETC can capture the timestamp of the sent/received packe= t > > through the PHC provided by the Timer and record it on the Tx/Rx BD. An= d > > through the relevant PHC interfaces provided by the driver, the enetc V= 4 > > driver can support PTP time synchronization. > > > > In addition, NETC V4 Timer is similar to the QorIQ 1588 timer, but it i= s > > not exactly the same. The current ptp-qoriq driver is not compatible wi= th > > NETC V4 Timer, most of the code cannot be reused, see below reasons. > > > > 1. The architecture of ptp-qoriq driver makes the register offset fixed= , > > however, the offsets of all the high registers and low registers of V4 > > are swapped, and V4 also adds some new registers. so extending ptp-qori= q > > to make it compatible with V4 Timer is tantamount to completely rewriti= ng > > ptp-qoriq driver. > > > > 2. The usage of some functions is somewhat different from QorIQ timer, > > such as the setting of TCLK_PERIOD and TMR_ADD, the logic of configurin= g > > PPS, etc., so making the driver compatible with V4 Timer will undoubted= ly > > increase the complexity of the code and reduce readability. > > > > 3. QorIQ is an expired brand. It is difficult for us to verify whether > > it works stably on the QorIQ platforms if we refactor the driver, and > > this will make maintenance difficult, so refactoring the driver obvious= ly > > does not bring any benefits. > > > > Therefore, add this new driver for NETC V4 Timer. Note that the missing > > features like PEROUT, PPS and EXTTS will be added in subsequent patches= . > > > > Signed-off-by: Wei Fang > > > [...] >=20 > > drivers/ptp/Kconfig | 11 + > > drivers/ptp/Makefile | 1 + > > drivers/ptp/ptp_netc.c | 416 > ++++++++++++++++++++++++++++++++ > > include/linux/fsl/netc_global.h | 3 +- > > 4 files changed, 430 insertions(+), 1 deletion(-) > > create mode 100644 drivers/ptp/ptp_netc.c >=20 > [...] >=20 > > diff --git a/include/linux/fsl/netc_global.h b/include/linux/fsl/netc_g= lobal.h > > index fdecca8c90f0..763b38e05d7d 100644 > > --- a/include/linux/fsl/netc_global.h > > +++ b/include/linux/fsl/netc_global.h > > @@ -1,10 +1,11 @@ > > /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ > > -/* Copyright 2024 NXP > > +/* Copyright 2024-2025 NXP > > */ > > #ifndef __NETC_GLOBAL_H > > #define __NETC_GLOBAL_H > > > > #include > > +#include >=20 > What is the reason to include it header file? You need PCI functions > only in ptp_netc.c, but this header is also included in a couple of > other files (netc_blk_ctrl.c, ntmp.c). >=20 oh, my bad, so sorry. I added netc_timer_get_phc_index() to the header file before, and I removed it since v4, but I forget to remove the pci.h. Thanks for catching this issue. > > > > static inline u32 netc_read(void __iomem *reg) > > { >=20 >=20