RE: [PATCH v4 net-next 04/15] ptp: netc: add NETC V4 Timer PTP driver support

From: Wei Fang
Date: Tue Aug 19 2025 - 21:44:24 EST


> 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 packet
> > through the PHC provided by the Timer and record it on the Tx/Rx BD. And
> > through the relevant PHC interfaces provided by the driver, the enetc V4
> > driver can support PTP time synchronization.
> >
> > In addition, NETC V4 Timer is similar to the QorIQ 1588 timer, but it is
> > not exactly the same. The current ptp-qoriq driver is not compatible with
> > 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-qoriq
> > to make it compatible with V4 Timer is tantamount to completely rewriting
> > 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 configuring
> > PPS, etc., so making the driver compatible with V4 Timer will undoubtedly
> > 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 obviously
> > 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 <wei.fang@xxxxxxx>
> >
> [...]
>
> > 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
>
> [...]
>
> > diff --git a/include/linux/fsl/netc_global.h b/include/linux/fsl/netc_global.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 <linux/io.h>
> > +#include <linux/pci.h>
>
> 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).
>

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