Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176107
b: refs/heads/master
c: 519e9f4
h: refs/heads/master
i:
  176105: 58ca5dc
  176103: c434edb
v: v3
  • Loading branch information
Michal Simek committed Dec 14, 2009
1 parent a766f52 commit d8e753b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 24b45a12c21132e78e14f3aedf74bb1297228072
refs/heads/master: 519e9f417388ba055b7604db5f4f492f7c84f427
28 changes: 28 additions & 0 deletions trunk/arch/microblaze/kernel/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,31 @@ static cycle_t microblaze_read(struct clocksource *cs)
return (cycle_t) (in_be32(TIMER_BASE + TCR1));
}

static struct timecounter microblaze_tc = {
.cc = NULL,
};

static cycle_t microblaze_cc_read(const struct cyclecounter *cc)
{
return microblaze_read(NULL);
}

static struct cyclecounter microblaze_cc = {
.read = microblaze_cc_read,
.mask = CLOCKSOURCE_MASK(32),
.shift = 24,
};

int __init init_microblaze_timecounter(void)
{
microblaze_cc.mult = div_sc(cpuinfo.cpu_clock_freq, NSEC_PER_SEC,
microblaze_cc.shift);

timecounter_init(&microblaze_tc, &microblaze_cc, sched_clock());

return 0;
}

static struct clocksource clocksource_microblaze = {
.name = "microblaze_clocksource",
.rating = 300,
Expand All @@ -204,6 +229,9 @@ static int __init microblaze_clocksource_init(void)
out_be32(TIMER_BASE + TCSR1, in_be32(TIMER_BASE + TCSR1) & ~TCSR_ENT);
/* start timer1 - up counting without interrupt */
out_be32(TIMER_BASE + TCSR1, TCSR_TINT|TCSR_ENT|TCSR_ARHT);

/* register timecounter - for ftrace support */
init_microblaze_timecounter();
return 0;
}

Expand Down

0 comments on commit d8e753b

Please sign in to comment.