@@ -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",
@@ -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);
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(+)