[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1287618253-13258-3-git-send-email-johnstul@us.ibm.com>
Date: Wed, 20 Oct 2010 16:44:08 -0700
From: John Stultz <johnstul@...ibm.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: John Stultz <johnstul@...ibm.com>,
Magnus Damm <magnus.damm@...il.com>,
Paul Mundt <lethal@...ux-sh.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: [PATCH 2/7] sh: convert to clocksource_register_hz
Convert sh_tmu/sh_cmt clocksources to clocksource_register_hz
I was unable to test these, so any help from maintainers would
be appreciated!
Signed-off-by: John Stultz <johnstul@...ibm.com>
CC: Magnus Damm <magnus.damm@...il.com>
CC: Paul Mundt <lethal@...ux-sh.org>
CC: Thomas Gleixner <tglx@...utronix.de>
---
drivers/clocksource/sh_cmt.c | 14 +++++++-------
drivers/clocksource/sh_tmu.c | 12 ++++++------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 717305d..aeee6ac 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -411,11 +411,16 @@ static cycle_t sh_cmt_clocksource_read(struct clocksource *cs)
static int sh_cmt_clocksource_enable(struct clocksource *cs)
{
+ int ret;
struct sh_cmt_priv *p = cs_to_sh_cmt(cs);
p->total_cycles = 0;
- return sh_cmt_start(p, FLAG_CLOCKSOURCE);
+ ret = sh_cmt_start(p, FLAG_CLOCKSOURCE);
+ p->rate = clk_get_rate(p->clk) / (p->width == 16) ? 512 : 8;
+
+ __clocksource_updatefreq_hz(cs, p->rate);
+ return ret;
}
static void sh_cmt_clocksource_disable(struct clocksource *cs)
@@ -448,14 +453,9 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
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 = 0;
- cs->mult = clocksource_hz2mult(p->rate, cs->shift);
-
dev_info(&p->pdev->dev, "used as clock source\n");
- clocksource_register(cs);
-
+ clocksource_register_hz(cs, p->rate);
return 0;
}
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index de71590..09831d9 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -199,8 +199,11 @@ 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);
-
- return sh_tmu_enable(p);
+ int ret = sh_tmu_enable(p);
+ p->rate = clk_get_rate(p->clk) / (p->width == 16) ? 512 : 8;
+
+ __clocksource_updatefreq_hz(cs, p->rate);
+ return ret;
}
static void sh_tmu_clocksource_disable(struct clocksource *cs)
@@ -226,12 +229,9 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p,
/* 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);
+ clocksource_register_hz(cs, p->rate);
return 0;
}
--
1.6.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists