Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 250383
b: refs/heads/master
c: 0aeac45
h: refs/heads/master
i:
  250381: 492f195
  250379: b375b8e
  250375: e76b530
  250367: e7aa425
v: v3
  • Loading branch information
Magnus Damm authored and Paul Mundt committed May 23, 2011
1 parent 65838bc commit 25d8266
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 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: 01fa68b58492a5d6708a91c1f474b6a099a9509e
refs/heads/master: 0aeac458d9ebea5f0dc483e2d3f2c06bfa520c02
19 changes: 8 additions & 11 deletions trunk/drivers/clocksource/sh_tmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,12 @@ static cycle_t sh_tmu_clocksource_read(struct clocksource *cs)
static int sh_tmu_clocksource_enable(struct clocksource *cs)
{
struct sh_tmu_priv *p = cs_to_sh_tmu(cs);
int ret;

return sh_tmu_enable(p);
ret = sh_tmu_enable(p);
if (!ret)
__clocksource_updatefreq_hz(cs, p->rate);
return ret;
}

static void sh_tmu_clocksource_disable(struct clocksource *cs)
Expand All @@ -221,17 +225,10 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p,
cs->mask = CLOCKSOURCE_MASK(32);
cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;

/* clk_get_rate() needs an enabled clock */
clk_enable(p->clk);
/* channel will be configured at parent clock / 4 */
p->rate = clk_get_rate(p->clk) / 4;
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);

/* Register with dummy 1 Hz value, gets updated in ->enable() */
clocksource_register_hz(cs, 1);
return 0;
}

Expand Down

0 comments on commit 25d8266

Please sign in to comment.