@@ -278,14 +278,13 @@ void fec_ptp_start_cyclecounter(struct net_device *ndev)
writel(FEC_T_CTRL_ENABLE | FEC_T_CTRL_PERIOD_RST,
fep->hwp + FEC_ATIME_CTRL);
- memset(&fep->tc.cc, 0, sizeof(fep->tc.cc));
- fep->tc.cc.read = fec_ptp_read;
- fep->tc.cc.mask = CLOCKSOURCE_MASK(31);
- fep->tc.cc.shift = 31;
- fep->tc.cc.mult = FEC_CC_MULT;
-
- /* reset the ns time counter */
- timecounter_init(&fep->tc, ktime_to_ns(ktime_get_real()));
+ /* Initialize the ns time counter */
+ timecounter_initialize(&fep->tc,
+ fec_ptp_read,
+ CLOCKSOURCE_MASK(31),
+ FEC_CC_MULT,
+ 31,
+ ktime_to_ns(ktime_get_real()));
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
}
With new interface timecounter_initialize we can initialize timecounter fields and underlying cyclecounter together. Update fec ethernet timecounter init with this new function. Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com> Cc: Richard Cochran <richardcochran@gmail.com> Cc: Fugang Duan <fugang.duan@nxp.com> Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/net/ethernet/freescale/fec_ptp.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)