return READ_ONCE(cpts->cur_timestamp);
}
-static void cpts_update_cur_time(struct cpts *cpts, int match)
+static void cpts_update_cur_time(struct cpts *cpts, int match,
+ struct ptp_system_timestamp *sts)
{
+ ptp_read_system_prets(sts);
cpts_write32(cpts, TS_PUSH, ts_push);
+ cpts_read32(cpts, ts_push);
+ ptp_read_system_postts(sts);
if (cpts_fifo_read(cpts, match) && match != -1)
dev_err(cpts->dev, "cpts: unable to obtain a time stamp\n");
cpts->mult_new = neg_adj ? mult - diff : mult + diff;
- cpts_update_cur_time(cpts, CPTS_EV_PUSH);
+ cpts_update_cur_time(cpts, CPTS_EV_PUSH, NULL);
spin_unlock_irqrestore(&cpts->lock, flags);
return 0;
}
-static int cpts_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
+static int cpts_ptp_gettimeex(struct ptp_clock_info *ptp,
+ struct timespec64 *ts,
+ struct ptp_system_timestamp *sts)
{
- u64 ns;
- unsigned long flags;
struct cpts *cpts = container_of(ptp, struct cpts, info);
+ unsigned long flags;
+ u64 ns;
spin_lock_irqsave(&cpts->lock, flags);
- cpts_update_cur_time(cpts, CPTS_EV_PUSH);
+ cpts_update_cur_time(cpts, CPTS_EV_PUSH, sts);
ns = timecounter_read(&cpts->tc);
spin_unlock_irqrestore(&cpts->lock, flags);
spin_lock_irqsave(&cpts->lock, flags);
- cpts_update_cur_time(cpts, -1);
+ cpts_update_cur_time(cpts, -1, NULL);
ns = timecounter_read(&cpts->tc);
.pps = 0,
.adjfreq = cpts_ptp_adjfreq,
.adjtime = cpts_ptp_adjtime,
- .gettime64 = cpts_ptp_gettime,
+ .gettimex64 = cpts_ptp_gettimeex,
.settime64 = cpts_ptp_settime,
.enable = cpts_ptp_enable,
.do_aux_work = cpts_overflow_check,