summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-09-22 16:42:26 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-10-04 15:19:56 +0200
commitd510df23a0295429d9e0f366de23146af93c2b0c (patch)
tree8d31f8e15d6e9e3a958cb588e5cee3484335ab3d
parent2155161eca0181ecca9862633fbecb853a3f5b99 (diff)
downloadbarebox-d510df23a0295429d9e0f366de23146af93c2b0c.tar.gz
barebox-d510df23a0295429d9e0f366de23146af93c2b0c.tar.xz
ARM i.MX: Switch clocksource to clk_get
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/mach-imx/clocksource.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/arch/arm/mach-imx/clocksource.c b/arch/arm/mach-imx/clocksource.c
index 2c6f6a08e6..df018e68c6 100644
--- a/arch/arm/mach-imx/clocksource.c
+++ b/arch/arm/mach-imx/clocksource.c
@@ -29,6 +29,8 @@
#include <init.h>
#include <clock.h>
#include <errno.h>
+#include <linux/clk.h>
+#include <linux/err.h>
#include <notifier.h>
#include <mach/imx-regs.h>
#include <mach/clock.h>
@@ -46,6 +48,8 @@
#define IMX31_TCTL_CLKSOURCE_IPG (1 << 6) /* Clock source bit position */
#define TCTL_TEN (1 << 0) /* Timer enable */
+static struct clk *clk_gpt;
+
struct imx_gpt_regs {
unsigned int tcn;
uint32_t tctl_val;
@@ -77,7 +81,7 @@ static struct clocksource cs = {
static int imx_clocksource_clock_change(struct notifier_block *nb, unsigned long event, void *data)
{
- cs.mult = clocksource_hz2mult(imx_get_gptclk(), cs.shift);
+ cs.mult = clocksource_hz2mult(clk_get_rate(clk_gpt), cs.shift);
return 0;
}
@@ -89,6 +93,7 @@ static int imx_gpt_probe(struct device_d *dev)
{
int i;
int ret;
+ unsigned long rate;
/* one timer is enough */
if (timer_base)
@@ -118,10 +123,18 @@ static int imx_gpt_probe(struct device_d *dev)
for (i = 0; i < 100; i++)
writel(0, timer_base + GPT_TCTL); /* We have no udelay by now */
+ clk_gpt = clk_get(dev, NULL);
+ if (IS_ERR(clk_gpt)) {
+ rate = 20000000;
+ dev_err(dev, "failed to get clock\n");
+ } else {
+ rate = clk_get_rate(clk_gpt);
+ }
+
writel(0, timer_base + GPT_TPRER);
writel(regs->tctl_val, timer_base + GPT_TCTL);
- cs.mult = clocksource_hz2mult(imx_get_gptclk(), cs.shift);
+ cs.mult = clocksource_hz2mult(rate, cs.shift);
init_clock(&cs);