Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 200108
b: refs/heads/master
c: f4d7c35
h: refs/heads/master
v: v3
  • Loading branch information
Paul Mundt committed Jun 2, 2010
1 parent 18a031f commit 1da458f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 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: 66f49121ffa41a19c59965b31b046d8368fec3c7
refs/heads/master: f4d7c3565c1692c54d9152b52090fe73f0029e37
22 changes: 13 additions & 9 deletions trunk/drivers/clocksource/sh_cmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,18 +412,10 @@ static cycle_t sh_cmt_clocksource_read(struct clocksource *cs)
static int sh_cmt_clocksource_enable(struct clocksource *cs)
{
struct sh_cmt_priv *p = cs_to_sh_cmt(cs);
int ret;

p->total_cycles = 0;

ret = sh_cmt_start(p, FLAG_CLOCKSOURCE);
if (ret)
return ret;

/* TODO: calculate good shift from rate and counter bit width */
cs->shift = 0;
cs->mult = clocksource_hz2mult(p->rate, cs->shift);
return 0;
return sh_cmt_start(p, FLAG_CLOCKSOURCE);
}

static void sh_cmt_clocksource_disable(struct clocksource *cs)
Expand All @@ -450,8 +442,20 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
cs->resume = sh_cmt_clocksource_resume;
cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8);
cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;

/* clk_get_rate() needs an enabled clock */
clk_enable(p->clk);
p->rate = clk_get_rate(p->clk) / (p->width == 16) ? 512 : 8;
clk_disable(p->clk);

/* TODO: calculate good shift from rate and counter bit width */
cs->shift = 10;
cs->mult = clocksource_hz2mult(p->rate, cs->shift);

dev_info(&p->pdev->dev, "used as clock source\n");

clocksource_register(cs);

return 0;
}

Expand Down

0 comments on commit 1da458f

Please sign in to comment.