[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 21 May 2021 12:36:17 +0800
From: Yangbo Lu <yangbo.lu@....com>
To: netdev@...r.kernel.org
Cc: Yangbo Lu <yangbo.lu@....com>,
"David S . Miller" <davem@...emloft.net>,
Richard Cochran <richardcochran@...il.com>,
Claudiu Manoil <claudiu.manoil@....com>,
Jakub Kicinski <kuba@...nel.org>
Subject: [net-next, v2, 5/7] enetc_ptp: support ptp virtual clock
Add support for ptp virtual clock.
Signed-off-by: Yangbo Lu <yangbo.lu@....com>
---
Changes for v2:
- Made ptp_qoriq_vclock_cc static.
- Updated copyright.
---
drivers/net/ethernet/freescale/enetc/enetc_ptp.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
index bc594892507a..dabcdaf972a9 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
-/* Copyright 2019 NXP */
+/* Copyright 2019-2021 NXP */
#include <linux/module.h>
#include <linux/of.h>
@@ -10,6 +10,16 @@
int enetc_phc_index = -1;
EXPORT_SYMBOL(enetc_phc_index);
+static struct ptp_vclock_cc ptp_qoriq_vclock_cc = {
+ .cc.read = ptp_qoriq_clock_read,
+ .cc.mask = CYCLECOUNTER_MASK(64),
+ .cc.shift = 28,
+ .cc.mult = (1 << 28),
+ .refresh_interval = (HZ * 60),
+ .mult_factor = (1 << 6),
+ .div_factor = 15625,
+};
+
static struct ptp_clock_info enetc_ptp_caps = {
.owner = THIS_MODULE,
.name = "ENETC PTP clock",
@@ -24,6 +34,7 @@ static struct ptp_clock_info enetc_ptp_caps = {
.gettime64 = ptp_qoriq_gettime,
.settime64 = ptp_qoriq_settime,
.enable = ptp_qoriq_enable,
+ .vclock_cc = &ptp_qoriq_vclock_cc,
};
static int enetc_ptp_probe(struct pci_dev *pdev,
--
2.25.1
Powered by blists - more mailing lists