hc
2023-02-14 b625cdcd68479b3d540a915785b6d9809b52a2f8
kernel/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
....@@ -159,20 +159,15 @@
159159
160160 static void get_systime(void __iomem *ioaddr, u64 *systime)
161161 {
162
- u64 ns, sec0, sec1;
162
+ u64 ns;
163163
164
- /* Get the TSS value */
165
- sec1 = readl_relaxed(ioaddr + PTP_STSR);
166
- do {
167
- sec0 = sec1;
168
- /* Get the TSSS value */
169
- ns = readl_relaxed(ioaddr + PTP_STNSR);
170
- /* Get the TSS value */
171
- sec1 = readl_relaxed(ioaddr + PTP_STSR);
172
- } while (sec0 != sec1);
164
+ /* Get the TSSS value */
165
+ ns = readl(ioaddr + PTP_STNSR);
166
+ /* Get the TSS and convert sec time value to nanosecond */
167
+ ns += readl(ioaddr + PTP_STSR) * 1000000000ULL;
173168
174169 if (systime)
175
- *systime = ns + (sec1 * 1000000000ULL);
170
+ *systime = ns;
176171 }
177172
178173 const struct stmmac_hwtimestamp stmmac_ptp = {