sh: rework clocksource and sched_clock
PATCH 1/5 sh: rework clocksource and sched_clock
From: Magnus Damm <[email protected]>
Rework and simplify the sched_clock and clocksource code. Instead of registering the clocksource in a shared file we move it into the tmu driver. Also, add code to handle sched_clock in the case of no clocksource.
Signed-off-by Magnus Damm <[email protected]>
---
arch/sh/include/asm/timer.h | 4 +- arch/sh/kernel/time_32.c | 59 +++++-------------------------------- arch/sh/kernel/timers/timer-tmu.c | 10 +++++- 3 files changed, 19 insertions(+), 54 deletions(-)
arch/sh/include/asm/timer.h +2 -2
@@ -9,7 +9,6 @@ struct sys_timer_ops {int (*init)(void );int (*start)(void );int (*stop)(void ); -cycle_t (*read)(void);#ifndef CONFIG_GENERIC_TIME unsigned long (*get_offset)(void );#endif
@@ -39,6 +38,7 @@ struct sys_timer *get_sys_timer(void);/* arch/sh/kernel/time.c */ void handle_timer_tick (void ); -extern unsigned long sh_hpt_frequency; + +extern struct clocksource clocksource_sh;#endif /* __ASM_SH_TIMER_H */
arch/sh/kernel/time_32.c +9 -49
80 lines not on this page · raw message
arch/sh/kernel/timers/timer-tmu.c +8 -2
@@ -254,7 +254,14 @@ static int tmu_timer_init(void)_tmu_start (TMU1 ); - sh_hpt_frequency =clk_get_rate (&tmu1_clk); + clocksource_sh.rating =200 ; + clocksource_sh.mask =CLOCKSOURCE_MASK (32 ); + clocksource_sh.read = tmu_timer_read; + clocksource_sh.shift =10 ; + clocksource_sh.mult =clocksource_hz2mult (clk_get_rate (&tmu1_clk), + clocksource_sh.shift); + clocksource_sh.flags =CLOCK_SOURCE_IS_CONTINUOUS ; +clocksource_register (&clocksource_sh); tmu0_clockevent.mult =div_sc (frequency,NSEC_PER_SEC , tmu0_clockevent.shift);
@@ -274,7 +281,6 @@ static struct sys_timer_ops tmu_timer_op .init = tmu_timer_init, .start = tmu_timer_start, .stop = tmu_timer_stop, - .read = tmu_timer_read, };struct sys_timer tmu_timer = {