[PATCH 03/27] microblaze: Use timecounter_initialize interface

From: Sagar Arun Kamble
Date: Fri Dec 15 2017 - 02:35:37 EST


With new interface timecounter_initialize we can initialize timecounter
fields and underlying cyclecounter together. Update xilinx_tc init with
this new function.

Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@xxxxxxxxx>
Cc: Richard Cochran <richardcochran@xxxxxxxxx>
Cc: Michal Simek <monstr@xxxxxxxxx>
Cc: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
Cc: Neil Armstrong <narmstrong@xxxxxxxxxxxx>
Cc: Nicolai Stange <nicstange@xxxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Rob Herring <robh@xxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
arch/microblaze/kernel/timer.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
index b7f89e9..b32a896 100644
--- a/arch/microblaze/kernel/timer.c
+++ b/arch/microblaze/kernel/timer.c
@@ -204,20 +204,21 @@ static u64 xilinx_cc_read(const struct cyclecounter *cc)
return xilinx_read(NULL);
}

-static struct timecounter xilinx_tc = {
- .cc.read = xilinx_cc_read,
- .cc.mask = CLOCKSOURCE_MASK(32),
- .cc.mult = 0,
- .cc.shift = 8,
-};
+static struct timecounter xilinx_tc;

static int __init init_xilinx_timecounter(void)
{
- struct cyclecounter *cc = &xilinx_tc.cc;
+ u32 mult = 0;
+ u32 shift = 8;

- cc->mult = div_sc(timer_clock_freq, NSEC_PER_SEC, cc->shift);
+ mult = div_sc(timer_clock_freq, NSEC_PER_SEC, shift);

- timecounter_init(&xilinx_tc, sched_clock());
+ timecounter_initialize(&xilinx_tc,
+ xilinx_cc_read,
+ CLOCKSOURCE_MASK(32),
+ mult,
+ shift,
+ sched_clock());

return 0;
}
--
1.9.1