aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/time.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-07-10 11:41:50 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-07-10 11:41:50 -0400
commitf0006314d37639714da9658cf4ff3f1f9f420764 (patch)
treeb8a18e014a40f2f8fd5148aab09c869dfaabd7a9 /arch/arm/mach-imx/time.c
parenta177ba3b7a08beef3f0fe74efa0f90701891945a (diff)
parent1bd55a436f1f90de0e7f476e514e01bd67497b88 (diff)
Merge branch 'imx' into devel
Conflicts: arch/arm/mm/Kconfig
Diffstat (limited to 'arch/arm/mach-imx/time.c')
-rw-r--r--arch/arm/mach-imx/time.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index d86d124aea22..5a41e96e8586 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -17,6 +17,7 @@
17#include <linux/time.h> 17#include <linux/time.h>
18#include <linux/clocksource.h> 18#include <linux/clocksource.h>
19#include <linux/clockchips.h> 19#include <linux/clockchips.h>
20#include <linux/clk.h>
20 21
21#include <asm/hardware.h> 22#include <asm/hardware.h>
22#include <asm/io.h> 23#include <asm/io.h>
@@ -86,10 +87,10 @@ static struct clocksource clocksource_imx = {
86 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 87 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
87}; 88};
88 89
89static int __init imx_clocksource_init(void) 90static int __init imx_clocksource_init(unsigned long rate)
90{ 91{
91 clocksource_imx.mult = 92 clocksource_imx.mult =
92 clocksource_hz2mult(imx_get_perclk1(), clocksource_imx.shift); 93 clocksource_hz2mult(rate, clocksource_imx.shift);
93 clocksource_register(&clocksource_imx); 94 clocksource_register(&clocksource_imx);
94 95
95 return 0; 96 return 0;
@@ -174,9 +175,9 @@ static struct clock_event_device clockevent_imx = {
174 .rating = 200, 175 .rating = 200,
175}; 176};
176 177
177static int __init imx_clockevent_init(void) 178static int __init imx_clockevent_init(unsigned long rate)
178{ 179{
179 clockevent_imx.mult = div_sc(imx_get_perclk1(), NSEC_PER_SEC, 180 clockevent_imx.mult = div_sc(rate, NSEC_PER_SEC,
180 clockevent_imx.shift); 181 clockevent_imx.shift);
181 clockevent_imx.max_delta_ns = 182 clockevent_imx.max_delta_ns =
182 clockevent_delta2ns(0xfffffffe, &clockevent_imx); 183 clockevent_delta2ns(0xfffffffe, &clockevent_imx);
@@ -190,13 +191,23 @@ static int __init imx_clockevent_init(void)
190 return 0; 191 return 0;
191} 192}
192 193
194extern int imx_clocks_init(void);
193 195
194static void __init imx_timer_init(void) 196static void __init imx_timer_init(void)
195{ 197{
198 struct clk *clk;
199 unsigned long rate;
200
201 imx_clocks_init();
202
203 clk = clk_get(NULL, "perclk1");
204 clk_enable(clk);
205 rate = clk_get_rate(clk);
206
196 imx_timer_hardware_init(); 207 imx_timer_hardware_init();
197 imx_clocksource_init(); 208 imx_clocksource_init(rate);
198 209
199 imx_clockevent_init(); 210 imx_clockevent_init(rate);
200 211
201 /* 212 /*
202 * Make irqs happen for the system timer 213 * Make irqs happen for the system timer