Commit 1ddfecaf authored by Min Li's avatar Min Li Committed by David S. Miller
Browse files

ptp: add FemtoClock3 Wireless as ptp hardware clock



The RENESAS FemtoClock3 Wireless is a high-performance jitter attenuator,
frequency translator, and clock synthesizer. The device is comprised of 3
digital PLLs (DPLL) to track CLKIN inputs and three independent low phase
noise fractional output dividers (FOD) that output low phase noise clocks.

FemtoClock3 supports one Time Synchronization (Time Sync) channel to enable
an external processor to control the phase and frequency of the Time Sync
channel and to take phase measurements using the TDC. Intended applications
are synchronization using the precision time protocol (PTP) and
synchronization with 0.5 Hz and 1 Hz signals from GNSS.

Signed-off-by: default avatarMin Li <min.li.xe@renesas.com>
Acked-by: default avatarLee Jones <lee@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ea1cc3ee
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -155,6 +155,18 @@ config PTP_1588_CLOCK_IDTCM
	  To compile this driver as a module, choose M here: the module
	  will be called ptp_clockmatrix.

config PTP_1588_CLOCK_FC3W
	tristate "RENESAS FemtoClock3 Wireless as PTP clock"
	depends on PTP_1588_CLOCK && I2C
	default n
	help
	  This driver adds support for using Renesas FemtoClock3 Wireless
	  as a PTP clock. This clock is only useful if your time stamping
	  MAC is connected to the RENESAS chip.

	  To compile this driver as a module, choose M here: the module
	  will be called ptp_fc3.

config PTP_1588_CLOCK_MOCK
	tristate "Mock-up PTP clock"
	depends on PTP_1588_CLOCK
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ obj-$(CONFIG_PTP_1588_CLOCK_QORIQ) += ptp-qoriq.o
ptp-qoriq-y				+= ptp_qoriq.o
ptp-qoriq-$(CONFIG_DEBUG_FS)		+= ptp_qoriq_debugfs.o
obj-$(CONFIG_PTP_1588_CLOCK_IDTCM)	+= ptp_clockmatrix.o
obj-$(CONFIG_PTP_1588_CLOCK_FC3W)	+= ptp_fc3.o
obj-$(CONFIG_PTP_1588_CLOCK_IDT82P33)	+= ptp_idt82p33.o
obj-$(CONFIG_PTP_1588_CLOCK_MOCK)	+= ptp_mock.o
obj-$(CONFIG_PTP_1588_CLOCK_VMW)	+= ptp_vmw.o

drivers/ptp/ptp_fc3.c

0 → 100644
+1016 −0

File added.

Preview size limit exceeded, changes collapsed.

drivers/ptp/ptp_fc3.h

0 → 100644
+45 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * PTP hardware clock driver for the FemtoClock3 family of timing and
 * synchronization devices.
 *
 * Copyright (C) 2023 Integrated Device Technology, Inc., a Renesas Company.
 */
#ifndef PTP_IDTFC3_H
#define PTP_IDTFC3_H

#include <linux/ktime.h>
#include <linux/ptp_clock.h>
#include <linux/regmap.h>

#define FW_FILENAME	"idtfc3.bin"

#define MAX_FFO_PPB	(244000)
#define TDC_GET_PERIOD	(10)

struct idtfc3 {
	struct ptp_clock_info	caps;
	struct ptp_clock	*ptp_clock;
	struct device		*dev;
	/* Mutex to protect operations from being interrupted */
	struct mutex		*lock;
	struct device		*mfd;
	struct regmap		*regmap;
	struct idtfc3_hw_param	hw_param;
	u32			sub_sync_count;
	u32			ns_per_sync;
	int			tdc_offset_sign;
	u64			tdc_apll_freq;
	u32			time_ref_freq;
	u16			fod_n;
	u8			lpf_mode;
	/* Time counter */
	u32			last_counter;
	s64			ns;
	u32			ns_per_counter;
	u32			tc_update_period;
	u32			tc_write_timeout;
	s64			tod_write_overhead;
};

#endif /* PTP_IDTFC3_H */
+273 −0

File added.

Preview size limit exceeded, changes collapsed.