diff options
author | Michal Simek <monstr@monstr.eu> | 2009-11-06 06:31:00 -0500 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2009-12-14 02:40:09 -0500 |
commit | 519e9f417388ba055b7604db5f4f492f7c84f427 (patch) | |
tree | 0dc1f78f1911d342d2b10fd085a01cbaa45217b6 /arch | |
parent | 24b45a12c21132e78e14f3aedf74bb1297228072 (diff) |
microblaze: Register timecounter/cyclecounter
It is the same counter as we use as free running one.
I would like to use it for ftrace.
Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/microblaze/kernel/timer.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c index 5499deae7fa6..ed61b2f17719 100644 --- a/arch/microblaze/kernel/timer.c +++ b/arch/microblaze/kernel/timer.c | |||
@@ -183,6 +183,31 @@ static cycle_t microblaze_read(struct clocksource *cs) | |||
183 | return (cycle_t) (in_be32(TIMER_BASE + TCR1)); | 183 | return (cycle_t) (in_be32(TIMER_BASE + TCR1)); |
184 | } | 184 | } |
185 | 185 | ||
186 | static struct timecounter microblaze_tc = { | ||
187 | .cc = NULL, | ||
188 | }; | ||
189 | |||
190 | static cycle_t microblaze_cc_read(const struct cyclecounter *cc) | ||
191 | { | ||
192 | return microblaze_read(NULL); | ||
193 | } | ||
194 | |||
195 | static struct cyclecounter microblaze_cc = { | ||
196 | .read = microblaze_cc_read, | ||
197 | .mask = CLOCKSOURCE_MASK(32), | ||
198 | .shift = 24, | ||
199 | }; | ||
200 | |||
201 | int __init init_microblaze_timecounter(void) | ||
202 | { | ||
203 | microblaze_cc.mult = div_sc(cpuinfo.cpu_clock_freq, NSEC_PER_SEC, | ||
204 | microblaze_cc.shift); | ||
205 | |||
206 | timecounter_init(µblaze_tc, µblaze_cc, sched_clock()); | ||
207 | |||
208 | return 0; | ||
209 | } | ||
210 | |||
186 | static struct clocksource clocksource_microblaze = { | 211 | static struct clocksource clocksource_microblaze = { |
187 | .name = "microblaze_clocksource", | 212 | .name = "microblaze_clocksource", |
188 | .rating = 300, | 213 | .rating = 300, |
@@ -204,6 +229,9 @@ static int __init microblaze_clocksource_init(void) | |||
204 | out_be32(TIMER_BASE + TCSR1, in_be32(TIMER_BASE + TCSR1) & ~TCSR_ENT); | 229 | out_be32(TIMER_BASE + TCSR1, in_be32(TIMER_BASE + TCSR1) & ~TCSR_ENT); |
205 | /* start timer1 - up counting without interrupt */ | 230 | /* start timer1 - up counting without interrupt */ |
206 | out_be32(TIMER_BASE + TCSR1, TCSR_TINT|TCSR_ENT|TCSR_ARHT); | 231 | out_be32(TIMER_BASE + TCSR1, TCSR_TINT|TCSR_ENT|TCSR_ARHT); |
232 | |||
233 | /* register timecounter - for ftrace support */ | ||
234 | init_microblaze_timecounter(); | ||
207 | return 0; | 235 | return 0; |
208 | } | 236 | } |
209 | 237 | ||