aboutsummaryrefslogtreecommitdiffstats
path: root/arch
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
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')
-rw-r--r--arch/arm/mach-mx1/clock.c5
-rw-r--r--arch/arm/mach-mx1/mx1ads.c3
-rw-r--r--arch/arm/mach-mx2/clock_imx27.c5
-rw-r--r--arch/arm/mach-mx2/mx27ads.c3
-rw-r--r--arch/arm/mach-mx2/pcm038.c3
-rw-r--r--arch/arm/mach-mx3/clock.c5
-rw-r--r--arch/arm/mach-mx3/mx31ads.c3
-rw-r--r--arch/arm/mach-mx3/mx31lite.c3
-rw-r--r--arch/arm/mach-mx3/mx31moboard.c3
-rw-r--r--arch/arm/mach-mx3/mx31pdk.c3
-rw-r--r--arch/arm/mach-mx3/pcm037.c3
-rw-r--r--arch/arm/plat-mxc/include/mach/common.h7
-rw-r--r--arch/arm/plat-mxc/time.c20
13 files changed, 30 insertions, 36 deletions
diff --git a/arch/arm/mach-mx1/clock.c b/arch/arm/mach-mx1/clock.c
index 3c464331b87..40a2274380a 100644
--- a/arch/arm/mach-mx1/clock.c
+++ b/arch/arm/mach-mx1/clock.c
@@ -25,6 +25,7 @@
25 25
26#include <mach/clock.h> 26#include <mach/clock.h>
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <mach/common.h>
28#include "crm_regs.h" 29#include "crm_regs.h"
29 30
30static int _clk_enable(struct clk *clk) 31static int _clk_enable(struct clk *clk)
@@ -594,7 +595,7 @@ static struct clk *mxc_clks[] = {
594 &rtc_clk, 595 &rtc_clk,
595}; 596};
596 597
597int __init mxc_clocks_init(unsigned long fref) 598int __init mx1_clocks_init(unsigned long fref)
598{ 599{
599 struct clk **clkp; 600 struct clk **clkp;
600 unsigned int reg; 601 unsigned int reg;
@@ -625,5 +626,7 @@ int __init mxc_clocks_init(unsigned long fref)
625 clk_enable(&hclk); 626 clk_enable(&hclk);
626 clk_enable(&fclk); 627 clk_enable(&fclk);
627 628
629 mxc_timer_init(&gpt_clk);
630
628 return 0; 631 return 0;
629} 632}
diff --git a/arch/arm/mach-mx1/mx1ads.c b/arch/arm/mach-mx1/mx1ads.c
index be7dd75ebbe..09dc77bb481 100644
--- a/arch/arm/mach-mx1/mx1ads.c
+++ b/arch/arm/mach-mx1/mx1ads.c
@@ -118,8 +118,7 @@ static void __init mx1ads_init(void)
118 118
119static void __init mx1ads_timer_init(void) 119static void __init mx1ads_timer_init(void)
120{ 120{
121 mxc_clocks_init(32000); 121 mx1_clocks_init(32000);
122 mxc_timer_init("gpt_clk");
123} 122}
124 123
125struct sys_timer mx1ads_timer = { 124struct sys_timer mx1ads_timer = {
diff --git a/arch/arm/mach-mx2/clock_imx27.c b/arch/arm/mach-mx2/clock_imx27.c
index 047e71e6ea9..7b2c1122d9a 100644
--- a/arch/arm/mach-mx2/clock_imx27.c
+++ b/arch/arm/mach-mx2/clock_imx27.c
@@ -1551,7 +1551,7 @@ static void __init probe_mxc_clocks(void)
1551 * must be called very early to get information about the 1551 * must be called very early to get information about the
1552 * available clock rate when the timer framework starts 1552 * available clock rate when the timer framework starts
1553 */ 1553 */
1554int __init mxc_clocks_init(unsigned long fref) 1554int __init mx27_clocks_init(unsigned long fref)
1555{ 1555{
1556 u32 cscr; 1556 u32 cscr;
1557 struct clk **clkp; 1557 struct clk **clkp;
@@ -1593,5 +1593,8 @@ int __init mxc_clocks_init(unsigned long fref)
1593#ifdef CONFIG_DEBUG_LL_CONSOLE 1593#ifdef CONFIG_DEBUG_LL_CONSOLE
1594 clk_enable(&uart1_clk[0]); 1594 clk_enable(&uart1_clk[0]);
1595#endif 1595#endif
1596
1597 mxc_timer_init(&gpt1_clk[0]);
1598
1596 return 0; 1599 return 0;
1597} 1600}
diff --git a/arch/arm/mach-mx2/mx27ads.c b/arch/arm/mach-mx2/mx27ads.c
index 7721c470d5a..536bf64bc7c 100644
--- a/arch/arm/mach-mx2/mx27ads.c
+++ b/arch/arm/mach-mx2/mx27ads.c
@@ -263,8 +263,7 @@ static void __init mx27ads_timer_init(void)
263 if ((__raw_readw(PBC_VERSION_REG) & CKIH_27MHZ_BIT_SET) == 0) 263 if ((__raw_readw(PBC_VERSION_REG) & CKIH_27MHZ_BIT_SET) == 0)
264 fref = 27000000; 264 fref = 27000000;
265 265
266 mxc_clocks_init(fref); 266 mx27_clocks_init(fref);
267 mxc_timer_init("gpt_clk.0");
268} 267}
269 268
270struct sys_timer mx27ads_timer = { 269struct sys_timer mx27ads_timer = {
diff --git a/arch/arm/mach-mx2/pcm038.c b/arch/arm/mach-mx2/pcm038.c
index 534fd9a4ff9..63cdef8565d 100644
--- a/arch/arm/mach-mx2/pcm038.c
+++ b/arch/arm/mach-mx2/pcm038.c
@@ -230,8 +230,7 @@ static void __init pcm038_init(void)
230 230
231static void __init pcm038_timer_init(void) 231static void __init pcm038_timer_init(void)
232{ 232{
233 mxc_clocks_init(26000000); 233 mx27_clocks_init(26000000);
234 mxc_timer_init("gpt_clk.0");
235} 234}
236 235
237struct sys_timer pcm038_timer = { 236struct sys_timer pcm038_timer = {
diff --git a/arch/arm/mach-mx3/clock.c b/arch/arm/mach-mx3/clock.c
index 8486ea46d6c..8b41facb391 100644
--- a/arch/arm/mach-mx3/clock.c
+++ b/arch/arm/mach-mx3/clock.c
@@ -25,6 +25,7 @@
25#include <linux/io.h> 25#include <linux/io.h>
26#include <mach/clock.h> 26#include <mach/clock.h>
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <mach/common.h>
28#include <asm/div64.h> 29#include <asm/div64.h>
29 30
30#include "crm_regs.h" 31#include "crm_regs.h"
@@ -1071,7 +1072,7 @@ static struct clk *mxc_clks[] = {
1071 &iim_clk, 1072 &iim_clk,
1072}; 1073};
1073 1074
1074int __init mxc_clocks_init(unsigned long fref) 1075int __init mx31_clocks_init(unsigned long fref)
1075{ 1076{
1076 u32 reg; 1077 u32 reg;
1077 struct clk **clkp; 1078 struct clk **clkp;
@@ -1121,6 +1122,8 @@ int __init mxc_clocks_init(unsigned long fref)
1121 __raw_writel(reg, MXC_CCM_PMCR1); 1122 __raw_writel(reg, MXC_CCM_PMCR1);
1122 } 1123 }
1123 1124
1125 mxc_timer_init(&ipg_clk);
1126
1124 return 0; 1127 return 0;
1125} 1128}
1126 1129
diff --git a/arch/arm/mach-mx3/mx31ads.c b/arch/arm/mach-mx3/mx31ads.c
index f902a7c37c3..f913999eedf 100644
--- a/arch/arm/mach-mx3/mx31ads.c
+++ b/arch/arm/mach-mx3/mx31ads.c
@@ -244,8 +244,7 @@ static void __init mxc_board_init(void)
244 244
245static void __init mx31ads_timer_init(void) 245static void __init mx31ads_timer_init(void)
246{ 246{
247 mxc_clocks_init(26000000); 247 mx31_clocks_init(26000000);
248 mxc_timer_init("ipg_clk.0");
249} 248}
250 249
251struct sys_timer mx31ads_timer = { 250struct sys_timer mx31ads_timer = {
diff --git a/arch/arm/mach-mx3/mx31lite.c b/arch/arm/mach-mx3/mx31lite.c
index c4344007014..e61fad2f60f 100644
--- a/arch/arm/mach-mx3/mx31lite.c
+++ b/arch/arm/mach-mx3/mx31lite.c
@@ -82,8 +82,7 @@ static void __init mxc_board_init(void)
82 82
83static void __init mx31lite_timer_init(void) 83static void __init mx31lite_timer_init(void)
84{ 84{
85 mxc_clocks_init(26000000); 85 mx31_clocks_init(26000000);
86 mxc_timer_init("ipg_clk.0");
87} 86}
88 87
89struct sys_timer mx31lite_timer = { 88struct sys_timer mx31lite_timer = {
diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
index c29098af739..3d2773e4bc8 100644
--- a/arch/arm/mach-mx3/mx31moboard.c
+++ b/arch/arm/mach-mx3/mx31moboard.c
@@ -120,8 +120,7 @@ void __init mx31moboard_map_io(void)
120 120
121static void __init mx31moboard_timer_init(void) 121static void __init mx31moboard_timer_init(void)
122{ 122{
123 mxc_clocks_init(26000000); 123 mx31_clocks_init(26000000);
124 mxc_timer_init("ipg_clk.0");
125} 124}
126 125
127struct sys_timer mx31moboard_timer = { 126struct sys_timer mx31moboard_timer = {
diff --git a/arch/arm/mach-mx3/mx31pdk.c b/arch/arm/mach-mx3/mx31pdk.c
index d464d068a4a..ac427edb4db 100644
--- a/arch/arm/mach-mx3/mx31pdk.c
+++ b/arch/arm/mach-mx3/mx31pdk.c
@@ -91,8 +91,7 @@ static void __init mxc_board_init(void)
91 91
92static void __init mx31pdk_timer_init(void) 92static void __init mx31pdk_timer_init(void)
93{ 93{
94 mxc_clocks_init(26000000); 94 mx31_clocks_init(26000000);
95 mxc_timer_init("ipg_clk.0");
96} 95}
97 96
98static struct sys_timer mx31pdk_timer = { 97static struct sys_timer mx31pdk_timer = {
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index 8cea8258722..3b5ba551cb1 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -181,8 +181,7 @@ void __init pcm037_map_io(void)
181 181
182static void __init pcm037_timer_init(void) 182static void __init pcm037_timer_init(void)
183{ 183{
184 mxc_clocks_init(26000000); 184 mx31_clocks_init(26000000);
185 mxc_timer_init("ipg_clk.0");
186} 185}
187 186
188struct sys_timer pcm037_timer = { 187struct sys_timer pcm037_timer = {
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
index 6350287a59b..2c08b8e14e3 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 758a1293bcf..eb93fd1789d 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