aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-mxc
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-02-16 08:36:49 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2009-03-13 05:33:47 -0400
commit30c730f8f90b08d77a73998d2ee34cf1f56e95cc (patch)
tree4b73291db523a77d2ca36a65ba7e0d1a8ff6e56e /arch/arm/plat-mxc
parenta2865197a5dad23c619c84f44b7fdf7fdbef3f9c (diff)
[ARM] MXC: rework timer/clock initialisation
- rename mxc_clocks_init to architecture specific versions. This allows us to have more than one architecture compiled in. - call mxc_timer_init from clock initialisation instead from board code Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/plat-mxc')
-rw-r--r--arch/arm/plat-mxc/include/mach/common.h7
-rw-r--r--arch/arm/plat-mxc/time.c20
2 files changed, 10 insertions, 17 deletions
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
index 6350287a59b9..2c08b8e14e39 100644
--- a/arch/arm/plat-mxc/include/mach/common.h
+++ b/arch/arm/plat-mxc/include/mach/common.h
@@ -12,11 +12,14 @@
12#define __ASM_ARCH_MXC_COMMON_H__ 12#define __ASM_ARCH_MXC_COMMON_H__
13 13
14struct platform_device; 14struct platform_device;
15struct clk;
15 16
16extern void mxc_map_io(void); 17extern void mxc_map_io(void);
17extern void mxc_init_irq(void); 18extern void mxc_init_irq(void);
18extern void mxc_timer_init(const char *clk_timer); 19extern void mxc_timer_init(struct clk *timer_clk);
19extern int mxc_clocks_init(unsigned long fref); 20extern int mx1_clocks_init(unsigned long fref);
21extern int mx27_clocks_init(unsigned long fref);
22extern int mx31_clocks_init(unsigned long fref);
20extern int mxc_register_gpios(void); 23extern int mxc_register_gpios(void);
21extern int mxc_register_device(struct platform_device *pdev, void *data); 24extern int mxc_register_device(struct platform_device *pdev, void *data);
22 25
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index 758a1293bcfa..eb93fd1789db 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -34,9 +34,6 @@
34static struct clock_event_device clockevent_mxc; 34static struct clock_event_device clockevent_mxc;
35static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED; 35static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;
36 36
37/* clock source for the timer */
38static struct clk *timer_clk;
39
40/* clock source */ 37/* clock source */
41 38
42static cycle_t mxc_get_cycles(void) 39static cycle_t mxc_get_cycles(void)
@@ -53,7 +50,7 @@ static struct clocksource clocksource_mxc = {
53 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 50 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
54}; 51};
55 52
56static int __init mxc_clocksource_init(void) 53static int __init mxc_clocksource_init(struct clk *timer_clk)
57{ 54{
58 unsigned int clock; 55 unsigned int clock;
59 56
@@ -177,7 +174,7 @@ static struct clock_event_device clockevent_mxc = {
177 .rating = 200, 174 .rating = 200,
178}; 175};
179 176
180static int __init mxc_clockevent_init(void) 177static int __init mxc_clockevent_init(struct clk *timer_clk)
181{ 178{
182 unsigned int clock; 179 unsigned int clock;
183 180
@@ -197,14 +194,8 @@ static int __init mxc_clockevent_init(void)
197 return 0; 194 return 0;
198} 195}
199 196
200void __init mxc_timer_init(const char *clk_timer) 197void __init mxc_timer_init(struct clk *timer_clk)
201{ 198{
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); 199 clk_enable(timer_clk);
209 200
210 /* 201 /*
@@ -219,10 +210,9 @@ void __init mxc_timer_init(const char *clk_timer)
219 TIMER_BASE + MXC_TCTL); 210 TIMER_BASE + MXC_TCTL);
220 211
221 /* init and register the timer to the framework */ 212 /* init and register the timer to the framework */
222 mxc_clocksource_init(); 213 mxc_clocksource_init(timer_clk);
223 mxc_clockevent_init(); 214 mxc_clockevent_init(timer_clk);
224 215
225 /* Make irqs happen */ 216 /* Make irqs happen */
226 setup_irq(TIMER_INTERRUPT, &mxc_timer_irq); 217 setup_irq(TIMER_INTERRUPT, &mxc_timer_irq);
227} 218}
228