Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177247
b: refs/heads/master
c: 2985712
h: refs/heads/master
i:
  177245: c8f4960
  177243: 86fe9f0
  177239: d2f3b5f
  177231: 9877e49
  177215: 6758d50
v: v3
  • Loading branch information
Yi Li authored and Mike Frysinger committed Dec 15, 2009
1 parent 03c57ea commit aa66777
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ceb33be95afcfbc4079af334835a345288f9f6ca
refs/heads/master: 298571249a1990cd3c6c6ab40250a4a9c18ab5d1
26 changes: 4 additions & 22 deletions trunk/arch/blackfin/kernel/time-ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,8 @@

#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */

static inline unsigned long cyc2ns_scale(unsigned long cpu_khz)
{
return (1000000 << CYC2NS_SCALE_FACTOR) / cpu_khz;
}

static inline unsigned long long cycles_2_ns(cycle_t cyc, unsigned long cyc2ns_scale)
{
return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR;
}

#if defined(CONFIG_CYCLES_CLOCKSOURCE)

static unsigned long cycles_cyc2ns_scale;

static notrace cycle_t bfin_read_cycles(struct clocksource *cs)
{
return __bfin_cycles_off + (get_cycles() << __bfin_cycles_mod);
Expand All @@ -70,19 +58,17 @@ static struct clocksource bfin_cs_cycles = {
.rating = 400,
.read = bfin_read_cycles,
.mask = CLOCKSOURCE_MASK(64),
.shift = 22,
.shift = CYC2NS_SCALE_FACTOR,
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};

static inline unsigned long long bfin_cs_cycles_sched_clock(void)
{
return cycles_2_ns(bfin_read_cycles(&bfin_cs_cycles), cycles_cyc2ns_scale);
return cyc2ns(&bfin_cs_cycles, bfin_read_cycles(&bfin_cs_cycles));
}

static int __init bfin_cs_cycles_init(void)
{
cycles_cyc2ns_scale = cyc2ns_scale(get_cclk() / 1000);

bfin_cs_cycles.mult = \
clocksource_hz2mult(get_cclk(), bfin_cs_cycles.shift);

Expand All @@ -97,8 +83,6 @@ static int __init bfin_cs_cycles_init(void)

#ifdef CONFIG_GPTMR0_CLOCKSOURCE

unsigned long gptimer0_cyc2ns_scale;

void __init setup_gptimer0(void)
{
disable_gptimers(TIMER0bit);
Expand All @@ -121,19 +105,17 @@ static struct clocksource bfin_cs_gptimer0 = {
.rating = 350,
.read = bfin_read_gptimer0,
.mask = CLOCKSOURCE_MASK(32),
.shift = 22,
.shift = CYC2NS_SCALE_FACTOR,
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};

static inline unsigned long long bfin_cs_gptimer0_sched_clock(void)
{
return cycles_2_ns(bfin_read_TIMER0_COUNTER(), gptimer0_cyc2ns_scale);
return cyc2ns(&bfin_cs_gptimer0, bfin_read_TIMER0_COUNTER());
}

static int __init bfin_cs_gptimer0_init(void)
{
gptimer0_cyc2ns_scale = cyc2ns_scale(get_sclk() / 1000);

setup_gptimer0();

bfin_cs_gptimer0.mult = \
Expand Down

0 comments on commit aa66777

Please sign in to comment.