28
28
* i40e_ptp_read - Read the PHC time from the device
29
29
* @pf: Board private structure
30
30
* @ts: timespec structure to hold the current time value
31
+ * @sts: structure to hold the system time before and after reading the PHC
31
32
*
32
33
* This function reads the PRTTSYN_TIME registers and stores them in a
33
34
* timespec. However, since the registers are 64 bits of nanoseconds, we must
34
35
* convert the result to a timespec before we can return.
35
36
**/
36
- static void i40e_ptp_read (struct i40e_pf * pf , struct timespec64 * ts )
37
+ static void i40e_ptp_read (struct i40e_pf * pf , struct timespec64 * ts ,
38
+ struct ptp_system_timestamp * sts )
37
39
{
38
40
struct i40e_hw * hw = & pf -> hw ;
39
41
u32 hi , lo ;
40
42
u64 ns ;
41
43
42
44
/* The timer latches on the lowest register read. */
45
+ ptp_read_system_prets (sts );
43
46
lo = rd32 (hw , I40E_PRTTSYN_TIME_L );
47
+ ptp_read_system_postts (sts );
44
48
hi = rd32 (hw , I40E_PRTTSYN_TIME_H );
45
49
46
50
ns = (((u64 )hi ) << 32 ) | lo ;
@@ -146,7 +150,7 @@ static int i40e_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
146
150
147
151
mutex_lock (& pf -> tmreg_lock );
148
152
149
- i40e_ptp_read (pf , & now );
153
+ i40e_ptp_read (pf , & now , NULL );
150
154
timespec64_add_ns (& now , delta );
151
155
i40e_ptp_write (pf , (const struct timespec64 * )& now );
152
156
@@ -156,19 +160,21 @@ static int i40e_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
156
160
}
157
161
158
162
/**
159
- * i40e_ptp_gettime - Get the time of the PHC
163
+ * i40e_ptp_gettimex - Get the time of the PHC
160
164
* @ptp: The PTP clock structure
161
165
* @ts: timespec structure to hold the current time value
166
+ * @sts: structure to hold the system time before and after reading the PHC
162
167
*
163
168
* Read the device clock and return the correct value on ns, after converting it
164
169
* into a timespec struct.
165
170
**/
166
- static int i40e_ptp_gettime (struct ptp_clock_info * ptp , struct timespec64 * ts )
171
+ static int i40e_ptp_gettimex (struct ptp_clock_info * ptp , struct timespec64 * ts ,
172
+ struct ptp_system_timestamp * sts )
167
173
{
168
174
struct i40e_pf * pf = container_of (ptp , struct i40e_pf , ptp_caps );
169
175
170
176
mutex_lock (& pf -> tmreg_lock );
171
- i40e_ptp_read (pf , ts );
177
+ i40e_ptp_read (pf , ts , sts );
172
178
mutex_unlock (& pf -> tmreg_lock );
173
179
174
180
return 0 ;
@@ -702,7 +708,7 @@ static long i40e_ptp_create_clock(struct i40e_pf *pf)
702
708
pf -> ptp_caps .pps = 0 ;
703
709
pf -> ptp_caps .adjfreq = i40e_ptp_adjfreq ;
704
710
pf -> ptp_caps .adjtime = i40e_ptp_adjtime ;
705
- pf -> ptp_caps .gettime64 = i40e_ptp_gettime ;
711
+ pf -> ptp_caps .gettimex64 = i40e_ptp_gettimex ;
706
712
pf -> ptp_caps .settime64 = i40e_ptp_settime ;
707
713
pf -> ptp_caps .enable = i40e_ptp_feature_enable ;
708
714
0 commit comments