|
|
@@ -173,10 +173,14 @@ static int e1000e_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
|
|
|
struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter,
|
|
|
ptp_clock_info);
|
|
|
unsigned long flags;
|
|
|
- u64 ns;
|
|
|
+ u64 cycles, ns;
|
|
|
|
|
|
spin_lock_irqsave(&adapter->systim_lock, flags);
|
|
|
- ns = timecounter_read(&adapter->tc);
|
|
|
+
|
|
|
+ /* Use timecounter_cyc2time() to allow non-monotonic SYSTIM readings */
|
|
|
+ cycles = adapter->cc.read(&adapter->cc);
|
|
|
+ ns = timecounter_cyc2time(&adapter->tc, cycles);
|
|
|
+
|
|
|
spin_unlock_irqrestore(&adapter->systim_lock, flags);
|
|
|
|
|
|
*ts = ns_to_timespec64(ns);
|
|
|
@@ -232,9 +236,12 @@ static void e1000e_systim_overflow_work(struct work_struct *work)
|
|
|
systim_overflow_work.work);
|
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
|
struct timespec64 ts;
|
|
|
+ u64 ns;
|
|
|
|
|
|
- adapter->ptp_clock_info.gettime64(&adapter->ptp_clock_info, &ts);
|
|
|
+ /* Update the timecounter */
|
|
|
+ ns = timecounter_read(&adapter->tc);
|
|
|
|
|
|
+ ts = ns_to_timespec64(ns);
|
|
|
e_dbg("SYSTIM overflow check at %lld.%09lu\n",
|
|
|
(long long) ts.tv_sec, ts.tv_nsec);
|
|
|
|