[PATCH 07/27] fec: Use timecounter_initialize interface

From: Sagar Arun Kamble
Date: Fri Dec 15 2017 - 02:43:23 EST


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@xxxxxxxxx>
Cc: Richard Cochran <richardcochran@xxxxxxxxx>
Cc: Fugang Duan <fugang.duan@xxxxxxx>
Cc: netdev@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
drivers/net/ethernet/freescale/fec_ptp.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
index b1261d1..1ba7216 100644
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ b/drivers/net/ethernet/freescale/fec_ptp.c
@@ -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);
}
--
1.9.1