aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/time-ts.c
diff options
context:
space:
mode:
authorVitja Makarov <vitja.makarov@gmail.com>2008-05-06 23:41:26 -0400
committerBryan Wu <cooloney@kernel.org>2008-05-06 23:41:26 -0400
commit1bfb4b21c7c39295f5535c139f796df1d51ec009 (patch)
tree5c5a58a83c5f1d5d1ff984e8f073a16416fa8abb /arch/blackfin/kernel/time-ts.c
parent14b03204c8060d036b04cbb18bbd6f6f311f4fed (diff)
[Blackfin] arch: Support for CPU_FREQ and NOHZ
Singed-off-by: Vitja Makarov <vitja.makarov@gmail.com>
Diffstat (limited to 'arch/blackfin/kernel/time-ts.c')
-rw-r--r--arch/blackfin/kernel/time-ts.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/blackfin/kernel/time-ts.c b/arch/blackfin/kernel/time-ts.c
index 4482c47c09e5..e887efc86c29 100644
--- a/arch/blackfin/kernel/time-ts.c
+++ b/arch/blackfin/kernel/time-ts.c
@@ -60,7 +60,7 @@ static inline unsigned long long cycles_2_ns(cycle_t cyc)
60 60
61static cycle_t read_cycles(void) 61static cycle_t read_cycles(void)
62{ 62{
63 return get_cycles(); 63 return __bfin_cycles_off + (get_cycles() << __bfin_cycles_mod);
64} 64}
65 65
66unsigned long long sched_clock(void) 66unsigned long long sched_clock(void)
@@ -117,7 +117,7 @@ static void bfin_timer_set_mode(enum clock_event_mode mode,
117 break; 117 break;
118 } 118 }
119 case CLOCK_EVT_MODE_ONESHOT: 119 case CLOCK_EVT_MODE_ONESHOT:
120 bfin_write_TSCALE(0); 120 bfin_write_TSCALE(TIME_SCALE - 1);
121 bfin_write_TCOUNT(0); 121 bfin_write_TCOUNT(0);
122 bfin_write_TCNTL(TMPWR | TMREN); 122 bfin_write_TCNTL(TMPWR | TMREN);
123 CSYNC(); 123 CSYNC();
@@ -183,10 +183,14 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
183 183
184static int __init bfin_clockevent_init(void) 184static int __init bfin_clockevent_init(void)
185{ 185{
186 unsigned long timer_clk;
187
188 timer_clk = get_cclk() / TIME_SCALE;
189
186 setup_irq(IRQ_CORETMR, &bfin_timer_irq); 190 setup_irq(IRQ_CORETMR, &bfin_timer_irq);
187 bfin_timer_init(); 191 bfin_timer_init();
188 192
189 clockevent_bfin.mult = div_sc(get_cclk(), NSEC_PER_SEC, clockevent_bfin.shift); 193 clockevent_bfin.mult = div_sc(timer_clk, NSEC_PER_SEC, clockevent_bfin.shift);
190 clockevent_bfin.max_delta_ns = clockevent_delta2ns(-1, &clockevent_bfin); 194 clockevent_bfin.max_delta_ns = clockevent_delta2ns(-1, &clockevent_bfin);
191 clockevent_bfin.min_delta_ns = clockevent_delta2ns(100, &clockevent_bfin); 195 clockevent_bfin.min_delta_ns = clockevent_delta2ns(100, &clockevent_bfin);
192 clockevents_register_device(&clockevent_bfin); 196 clockevents_register_device(&clockevent_bfin);