diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-28 17:03:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-28 17:03:14 -0400 |
commit | 0fe41b8982001cd14ee2c77cd776735a5024e98b (patch) | |
tree | 83e65d595c413d55259ea14fb97748ce5efe5707 /arch/arm/plat-mxc/time.c | |
parent | eedf2c5296a8dfaaf9aec1a938c1d3bd73159a30 (diff) | |
parent | 9759d22c8348343b0da4e25d6150c41712686c14 (diff) |
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (422 commits)
[ARM] 5435/1: fix compile warning in sanity_check_meminfo()
[ARM] 5434/1: ARM: OMAP: Fix mailbox compile for 24xx
[ARM] pxa: fix the bad assumption that PCMCIA sockets always start with 0
[ARM] pxa: fix Colibri PXA300 and PXA320 LCD backlight pins
imxfb: Fix TFT mode
i.MX21/27: remove ifdef CONFIG_FB_IMX
imxfb: add clock support
mxc: add arch_reset() function
clkdev: add possibility to get a clock based on the device name
i.MX1: remove fb support from mach-imx
[ARM] pxa: build arch/arm/plat-pxa/mfp.c only when PXA3xx or ARCH_MMP defined
Gemini: Add support for Teltonika RUT100
Gemini: gpiolib based GPIO support v2
MAINTAINERS: add myself as Gemini architecture maintainer
ARM: Add Gemini architecture v3
[ARM] OMAP: Fix compile for omap2_init_common_hw()
MAINTAINERS: Add myself as Faraday ARM core variant maintainer
ARM: Add support for FA526 v2
[ARM] acorn,ebsa110,footbridge,integrator,sa1100: Convert asm/io.h to linux/io.h
[ARM] collie: fix two minor formatting nits
...
Diffstat (limited to 'arch/arm/plat-mxc/time.c')
-rw-r--r-- | arch/arm/plat-mxc/time.c | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c index 758a1293bcfa..ef1b3cd85bd3 100644 --- a/arch/arm/plat-mxc/time.c +++ b/arch/arm/plat-mxc/time.c | |||
@@ -34,9 +34,6 @@ | |||
34 | static struct clock_event_device clockevent_mxc; | 34 | static struct clock_event_device clockevent_mxc; |
35 | static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED; | 35 | static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED; |
36 | 36 | ||
37 | /* clock source for the timer */ | ||
38 | static struct clk *timer_clk; | ||
39 | |||
40 | /* clock source */ | 37 | /* clock source */ |
41 | 38 | ||
42 | static cycle_t mxc_get_cycles(void) | 39 | static cycle_t mxc_get_cycles(void) |
@@ -53,13 +50,11 @@ static struct clocksource clocksource_mxc = { | |||
53 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 50 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
54 | }; | 51 | }; |
55 | 52 | ||
56 | static int __init mxc_clocksource_init(void) | 53 | static int __init mxc_clocksource_init(struct clk *timer_clk) |
57 | { | 54 | { |
58 | unsigned int clock; | 55 | unsigned int c = clk_get_rate(timer_clk); |
59 | |||
60 | clock = clk_get_rate(timer_clk); | ||
61 | 56 | ||
62 | clocksource_mxc.mult = clocksource_hz2mult(clock, | 57 | clocksource_mxc.mult = clocksource_hz2mult(c, |
63 | clocksource_mxc.shift); | 58 | clocksource_mxc.shift); |
64 | clocksource_register(&clocksource_mxc); | 59 | clocksource_register(&clocksource_mxc); |
65 | 60 | ||
@@ -177,13 +172,11 @@ static struct clock_event_device clockevent_mxc = { | |||
177 | .rating = 200, | 172 | .rating = 200, |
178 | }; | 173 | }; |
179 | 174 | ||
180 | static int __init mxc_clockevent_init(void) | 175 | static int __init mxc_clockevent_init(struct clk *timer_clk) |
181 | { | 176 | { |
182 | unsigned int clock; | 177 | unsigned int c = clk_get_rate(timer_clk); |
183 | |||
184 | clock = clk_get_rate(timer_clk); | ||
185 | 178 | ||
186 | clockevent_mxc.mult = div_sc(clock, NSEC_PER_SEC, | 179 | clockevent_mxc.mult = div_sc(c, NSEC_PER_SEC, |
187 | clockevent_mxc.shift); | 180 | clockevent_mxc.shift); |
188 | clockevent_mxc.max_delta_ns = | 181 | clockevent_mxc.max_delta_ns = |
189 | clockevent_delta2ns(0xfffffffe, &clockevent_mxc); | 182 | clockevent_delta2ns(0xfffffffe, &clockevent_mxc); |
@@ -197,14 +190,8 @@ static int __init mxc_clockevent_init(void) | |||
197 | return 0; | 190 | return 0; |
198 | } | 191 | } |
199 | 192 | ||
200 | void __init mxc_timer_init(const char *clk_timer) | 193 | void __init mxc_timer_init(struct clk *timer_clk) |
201 | { | 194 | { |
202 | timer_clk = clk_get(NULL, clk_timer); | ||
203 | if (!timer_clk) { | ||
204 | printk(KERN_ERR"Cannot determine timer clock. Giving up.\n"); | ||
205 | return; | ||
206 | } | ||
207 | |||
208 | clk_enable(timer_clk); | 195 | clk_enable(timer_clk); |
209 | 196 | ||
210 | /* | 197 | /* |
@@ -219,10 +206,9 @@ void __init mxc_timer_init(const char *clk_timer) | |||
219 | TIMER_BASE + MXC_TCTL); | 206 | TIMER_BASE + MXC_TCTL); |
220 | 207 | ||
221 | /* init and register the timer to the framework */ | 208 | /* init and register the timer to the framework */ |
222 | mxc_clocksource_init(); | 209 | mxc_clocksource_init(timer_clk); |
223 | mxc_clockevent_init(); | 210 | mxc_clockevent_init(timer_clk); |
224 | 211 | ||
225 | /* Make irqs happen */ | 212 | /* Make irqs happen */ |
226 | setup_irq(TIMER_INTERRUPT, &mxc_timer_irq); | 213 | setup_irq(TIMER_INTERRUPT, &mxc_timer_irq); |
227 | } | 214 | } |
228 | |||