All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yangbo Lu <yangbo.lu@nxp.com>
To: netdev@vger.kernel.org
Cc: Yangbo Lu <yangbo.lu@nxp.com>,
	"David S . Miller" <davem@davemloft.net>,
	Richard Cochran <richardcochran@gmail.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	Jakub Kicinski <kuba@kernel.org>
Subject: [net-next 3/6] ptp_qoriq: export ptp clock reading function for cyclecounter
Date: Fri,  7 May 2021 16:57:53 +0800	[thread overview]
Message-ID: <20210507085756.20427-4-yangbo.lu@nxp.com> (raw)
In-Reply-To: <20210507085756.20427-1-yangbo.lu@nxp.com>

Export ptp clock reading function for cyclecounter to read cycles.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/ptp/ptp_qoriq.c       | 15 +++++++++++++++
 include/linux/fsl/ptp_qoriq.h |  1 +
 2 files changed, 16 insertions(+)

diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
index 08f4cf0ad9e3..4617055a3307 100644
--- a/drivers/ptp/ptp_qoriq.c
+++ b/drivers/ptp/ptp_qoriq.c
@@ -311,6 +311,21 @@ int ptp_qoriq_enable(struct ptp_clock_info *ptp,
 }
 EXPORT_SYMBOL_GPL(ptp_qoriq_enable);
 
+u64 ptp_qoriq_clock_read(const struct cyclecounter *cc)
+{
+	struct ptp_clock_info *ptp = ptp_get_pclock_info(cc);
+	struct ptp_qoriq *ptp_qoriq = container_of(ptp, struct ptp_qoriq, caps);
+	unsigned long flags;
+	u64 ns;
+
+	spin_lock_irqsave(&ptp_qoriq->lock, flags);
+	ns = tmr_cnt_read(ptp_qoriq);
+	spin_unlock_irqrestore(&ptp_qoriq->lock, flags);
+
+	return ns;
+}
+EXPORT_SYMBOL_GPL(ptp_qoriq_clock_read);
+
 static const struct ptp_clock_info ptp_qoriq_caps = {
 	.owner		= THIS_MODULE,
 	.name		= "qoriq ptp clock",
diff --git a/include/linux/fsl/ptp_qoriq.h b/include/linux/fsl/ptp_qoriq.h
index 01acebe37fab..9a2ecd696c7e 100644
--- a/include/linux/fsl/ptp_qoriq.h
+++ b/include/linux/fsl/ptp_qoriq.h
@@ -193,6 +193,7 @@ int ptp_qoriq_settime(struct ptp_clock_info *ptp,
 		      const struct timespec64 *ts);
 int ptp_qoriq_enable(struct ptp_clock_info *ptp,
 		     struct ptp_clock_request *rq, int on);
+u64 ptp_qoriq_clock_read(const struct cyclecounter *cc);
 int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index, bool update_event);
 #ifdef CONFIG_DEBUG_FS
 void ptp_qoriq_create_debugfs(struct ptp_qoriq *ptp_qoriq);
-- 
2.25.1


  parent reply	other threads:[~2021-05-07  8:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-07  8:57 [net-next 0/6] ptp: support virtual clocks for multiple domains Yangbo Lu
2021-05-07  8:57 ` [net-next 1/6] ptp: add ptp virtual clock driver framework Yangbo Lu
2021-05-07 10:42   ` kernel test robot
2021-05-07 10:42     ` kernel test robot
2021-05-07 11:26   ` kernel test robot
2021-05-07 11:26     ` kernel test robot
2021-05-07  8:57 ` [net-next 2/6] ptp: support virtual clock and domain via sysfs Yangbo Lu
2021-05-07  8:57 ` Yangbo Lu [this message]
2021-05-07  8:57 ` [net-next 4/6] enetc_ptp: support ptp virtual clock Yangbo Lu
2021-05-07 19:58   ` Claudiu Manoil
2021-05-07 20:50   ` kernel test robot
2021-05-07 20:50     ` kernel test robot
2021-05-07  8:57 ` [net-next 5/6] enetc: store ptp device pointer Yangbo Lu
2021-05-07  8:57 ` [net-next 6/6] enetc: support PTP domain timestamp conversion Yangbo Lu
2021-05-08 19:17 ` [net-next 0/6] ptp: support virtual clocks for multiple domains Richard Cochran
2021-05-10  3:04   ` Y.b. Lu
2021-05-10 23:18     ` Richard Cochran
2021-05-11 10:40       ` Y.b. Lu
2021-05-11 15:49         ` Richard Cochran
2021-05-14  6:41           ` Y.b. Lu
2021-05-14 17:44             ` Richard Cochran
2021-05-17  2:46               ` Y.b. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210507085756.20427-4-yangbo.lu@nxp.com \
    --to=yangbo.lu@nxp.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.