Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 200107
b: refs/heads/master
c: 66f4912
h: refs/heads/master
i:
  200105: e0d17f0
  200103: 35dd17c
v: v3
  • Loading branch information
Aurelien Jarno authored and Paul Mundt committed Jun 2, 2010
1 parent 8c4d910 commit 18a031f
Show file tree
Hide file tree
Showing 2 changed files with 12 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: 019e2574f965b800ba76f319d817eae9405ae064
refs/heads/master: 66f49121ffa41a19c59965b31b046d8368fec3c7
20 changes: 11 additions & 9 deletions trunk/drivers/clocksource/sh_tmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,8 @@ 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;

ret = sh_tmu_enable(p);
if (ret)
return ret;

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

static void sh_tmu_clocksource_disable(struct clocksource *cs)
Expand All @@ -228,6 +220,16 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p,
cs->disable = sh_tmu_clocksource_disable;
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);
return 0;
Expand Down

0 comments on commit 18a031f

Please sign in to comment.