]> git.baikalelectronics.ru Git - kernel.git/commitdiff
fec: Fix timer capture timing in `fec_ptp_enable_pps()`
authorCsókás Bence <csokas.bence@prolan.hu>
Thu, 11 Aug 2022 10:13:49 +0000 (12:13 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 13 Aug 2022 00:23:41 +0000 (17:23 -0700)
Code reimplements functionality already in `fec_ptp_read()`,
but misses check for FEC_QUIRK_BUG_CAPTURE. Replace with function call.

Fixes: ded871d5e35f ("net: fec: ptp: fix convergence issue to support LinuxPTP stack")
Signed-off-by: Csókás Bence <csokas.bence@prolan.hu>
Link: https://lore.kernel.org/r/20220811101348.13755-1-csokas.bence@prolan.hu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/fec_ptp.c

index 7d49c28215f315de3b78f0355e7cdcf3c449cdbd..3dc3c0b626c21c23681782729ff3b0eb2bf09d6a 100644 (file)
@@ -135,11 +135,7 @@ static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable)
                 * NSEC_PER_SEC - ts.tv_nsec. Add the remaining nanoseconds
                 * to current timer would be next second.
                 */
-               tempval = readl(fep->hwp + FEC_ATIME_CTRL);
-               tempval |= FEC_T_CTRL_CAPTURE;
-               writel(tempval, fep->hwp + FEC_ATIME_CTRL);
-
-               tempval = readl(fep->hwp + FEC_ATIME);
+               tempval = fep->cc.read(&fep->cc);
                /* Convert the ptp local counter to 1588 timestamp */
                ns = timecounter_cyc2time(&fep->tc, tempval);
                ts = ns_to_timespec64(ns);