diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2015-05-14 23:41:39 -0400 |
---|---|---|
committer | Shawn Guo <shawn.guo@linaro.org> | 2015-06-03 02:52:26 -0400 |
commit | 0931aff7226abb7e1dab018488e363294385fa66 (patch) | |
tree | 608a40c038ae0d8934b7f931e0af221247cda44e | |
parent | 6dd747825b206e9863c80c8b311fd2ed0964140a (diff) |
ARM: imx: define an enum for gpt timer device type
Define an enum for gpt timer device type in include/soc/imx/timer.h to
tell the gpt block differences among SoCs. Update non-DT users (clock
drivers) to pass the device type.
As we now have include/soc/imx/timer.h, the declaration of
mxc_timer_init() is moved into there as the best fit.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
-rw-r--r-- | arch/arm/mach-imx/time.c | 6 | ||||
-rw-r--r-- | drivers/clk/imx/clk-imx1.c | 3 | ||||
-rw-r--r-- | drivers/clk/imx/clk-imx21.c | 3 | ||||
-rw-r--r-- | drivers/clk/imx/clk-imx27.c | 3 | ||||
-rw-r--r-- | drivers/clk/imx/clk-imx31.c | 3 | ||||
-rw-r--r-- | drivers/clk/imx/clk-imx35.c | 3 | ||||
-rw-r--r-- | drivers/clk/imx/clk.h | 7 | ||||
-rw-r--r-- | include/soc/imx/timer.h | 26 |
8 files changed, 41 insertions, 13 deletions
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c index 7c131e1b2637..307cbc7abc8e 100644 --- a/arch/arm/mach-imx/time.c +++ b/arch/arm/mach-imx/time.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/of.h> | 32 | #include <linux/of.h> |
33 | #include <linux/of_address.h> | 33 | #include <linux/of_address.h> |
34 | #include <linux/of_irq.h> | 34 | #include <linux/of_irq.h> |
35 | #include <soc/imx/timer.h> | ||
35 | 36 | ||
36 | #include <asm/mach/time.h> | 37 | #include <asm/mach/time.h> |
37 | 38 | ||
@@ -86,6 +87,7 @@ static struct clock_event_device clockevent_mxc; | |||
86 | static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED; | 87 | static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED; |
87 | 88 | ||
88 | struct imx_timer { | 89 | struct imx_timer { |
90 | enum imx_gpt_type type; | ||
89 | void __iomem *base; | 91 | void __iomem *base; |
90 | int irq; | 92 | int irq; |
91 | struct clk *clk_per; | 93 | struct clk *clk_per; |
@@ -356,7 +358,7 @@ static void __init _mxc_timer_init(struct imx_timer *imxtm) | |||
356 | setup_irq(imxtm->irq, &mxc_timer_irq); | 358 | setup_irq(imxtm->irq, &mxc_timer_irq); |
357 | } | 359 | } |
358 | 360 | ||
359 | void __init mxc_timer_init(unsigned long pbase, int irq) | 361 | void __init mxc_timer_init(unsigned long pbase, int irq, enum imx_gpt_type type) |
360 | { | 362 | { |
361 | struct imx_timer *imxtm; | 363 | struct imx_timer *imxtm; |
362 | 364 | ||
@@ -369,6 +371,8 @@ void __init mxc_timer_init(unsigned long pbase, int irq) | |||
369 | imxtm->base = ioremap(pbase, SZ_4K); | 371 | imxtm->base = ioremap(pbase, SZ_4K); |
370 | BUG_ON(!imxtm->base); | 372 | BUG_ON(!imxtm->base); |
371 | 373 | ||
374 | imxtm->type = type; | ||
375 | |||
372 | _mxc_timer_init(imxtm); | 376 | _mxc_timer_init(imxtm); |
373 | } | 377 | } |
374 | 378 | ||
diff --git a/drivers/clk/imx/clk-imx1.c b/drivers/clk/imx/clk-imx1.c index c9812dbacac2..c2647fa19f28 100644 --- a/drivers/clk/imx/clk-imx1.c +++ b/drivers/clk/imx/clk-imx1.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/of.h> | 23 | #include <linux/of.h> |
24 | #include <linux/of_address.h> | 24 | #include <linux/of_address.h> |
25 | #include <dt-bindings/clock/imx1-clock.h> | 25 | #include <dt-bindings/clock/imx1-clock.h> |
26 | #include <soc/imx/timer.h> | ||
26 | #include <asm/irq.h> | 27 | #include <asm/irq.h> |
27 | 28 | ||
28 | #include "clk.h" | 29 | #include "clk.h" |
@@ -102,7 +103,7 @@ int __init mx1_clocks_init(unsigned long fref) | |||
102 | clk_register_clkdev(clk[IMX1_CLK_DUMMY], "ipg", "imx1-fb.0"); | 103 | clk_register_clkdev(clk[IMX1_CLK_DUMMY], "ipg", "imx1-fb.0"); |
103 | clk_register_clkdev(clk[IMX1_CLK_DUMMY], "ahb", "imx1-fb.0"); | 104 | clk_register_clkdev(clk[IMX1_CLK_DUMMY], "ahb", "imx1-fb.0"); |
104 | 105 | ||
105 | mxc_timer_init(MX1_TIM1_BASE_ADDR, MX1_TIM1_INT); | 106 | mxc_timer_init(MX1_TIM1_BASE_ADDR, MX1_TIM1_INT, GPT_TYPE_IMX1); |
106 | 107 | ||
107 | return 0; | 108 | return 0; |
108 | } | 109 | } |
diff --git a/drivers/clk/imx/clk-imx21.c b/drivers/clk/imx/clk-imx21.c index 0ca842cf4ca7..dba987e3b89f 100644 --- a/drivers/clk/imx/clk-imx21.c +++ b/drivers/clk/imx/clk-imx21.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
16 | #include <linux/of_address.h> | 16 | #include <linux/of_address.h> |
17 | #include <dt-bindings/clock/imx21-clock.h> | 17 | #include <dt-bindings/clock/imx21-clock.h> |
18 | #include <soc/imx/timer.h> | ||
18 | #include <asm/irq.h> | 19 | #include <asm/irq.h> |
19 | 20 | ||
20 | #include "clk.h" | 21 | #include "clk.h" |
@@ -156,7 +157,7 @@ int __init mx21_clocks_init(unsigned long lref, unsigned long href) | |||
156 | clk_register_clkdev(clk[IMX21_CLK_I2C_GATE], NULL, "imx21-i2c.0"); | 157 | clk_register_clkdev(clk[IMX21_CLK_I2C_GATE], NULL, "imx21-i2c.0"); |
157 | clk_register_clkdev(clk[IMX21_CLK_OWIRE_GATE], NULL, "mxc_w1.0"); | 158 | clk_register_clkdev(clk[IMX21_CLK_OWIRE_GATE], NULL, "mxc_w1.0"); |
158 | 159 | ||
159 | mxc_timer_init(MX21_GPT1_BASE_ADDR, MX21_INT_GPT1); | 160 | mxc_timer_init(MX21_GPT1_BASE_ADDR, MX21_INT_GPT1, GPT_TYPE_IMX21); |
160 | 161 | ||
161 | return 0; | 162 | return 0; |
162 | } | 163 | } |
diff --git a/drivers/clk/imx/clk-imx27.c b/drivers/clk/imx/clk-imx27.c index df2dfc081c71..d9d50d54ef2a 100644 --- a/drivers/clk/imx/clk-imx27.c +++ b/drivers/clk/imx/clk-imx27.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/of_address.h> | 6 | #include <linux/of_address.h> |
7 | #include <dt-bindings/clock/imx27-clock.h> | 7 | #include <dt-bindings/clock/imx27-clock.h> |
8 | #include <soc/imx/revision.h> | 8 | #include <soc/imx/revision.h> |
9 | #include <soc/imx/timer.h> | ||
9 | #include <asm/irq.h> | 10 | #include <asm/irq.h> |
10 | 11 | ||
11 | #include "clk.h" | 12 | #include "clk.h" |
@@ -233,7 +234,7 @@ int __init mx27_clocks_init(unsigned long fref) | |||
233 | clk_register_clkdev(clk[IMX27_CLK_EMMA_AHB_GATE], "ahb", "m2m-emmaprp.0"); | 234 | clk_register_clkdev(clk[IMX27_CLK_EMMA_AHB_GATE], "ahb", "m2m-emmaprp.0"); |
234 | clk_register_clkdev(clk[IMX27_CLK_EMMA_IPG_GATE], "ipg", "m2m-emmaprp.0"); | 235 | clk_register_clkdev(clk[IMX27_CLK_EMMA_IPG_GATE], "ipg", "m2m-emmaprp.0"); |
235 | 236 | ||
236 | mxc_timer_init(MX27_GPT1_BASE_ADDR, MX27_INT_GPT1); | 237 | mxc_timer_init(MX27_GPT1_BASE_ADDR, MX27_INT_GPT1, GPT_TYPE_IMX21); |
237 | 238 | ||
238 | return 0; | 239 | return 0; |
239 | } | 240 | } |
diff --git a/drivers/clk/imx/clk-imx31.c b/drivers/clk/imx/clk-imx31.c index a55290c1c264..fe66c40b7be2 100644 --- a/drivers/clk/imx/clk-imx31.c +++ b/drivers/clk/imx/clk-imx31.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/err.h> | 22 | #include <linux/err.h> |
23 | #include <linux/of.h> | 23 | #include <linux/of.h> |
24 | #include <soc/imx/revision.h> | 24 | #include <soc/imx/revision.h> |
25 | #include <soc/imx/timer.h> | ||
25 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
26 | 27 | ||
27 | #include "clk.h" | 28 | #include "clk.h" |
@@ -198,7 +199,7 @@ int __init mx31_clocks_init(unsigned long fref) | |||
198 | mx31_revision(); | 199 | mx31_revision(); |
199 | clk_disable_unprepare(clk[iim_gate]); | 200 | clk_disable_unprepare(clk[iim_gate]); |
200 | 201 | ||
201 | mxc_timer_init(MX31_GPT1_BASE_ADDR, MX31_INT_GPT); | 202 | mxc_timer_init(MX31_GPT1_BASE_ADDR, MX31_INT_GPT, GPT_TYPE_IMX31); |
202 | 203 | ||
203 | return 0; | 204 | return 0; |
204 | } | 205 | } |
diff --git a/drivers/clk/imx/clk-imx35.c b/drivers/clk/imx/clk-imx35.c index f2f3b8164f7b..69138ba3dec7 100644 --- a/drivers/clk/imx/clk-imx35.c +++ b/drivers/clk/imx/clk-imx35.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/of.h> | 14 | #include <linux/of.h> |
15 | #include <linux/err.h> | 15 | #include <linux/err.h> |
16 | #include <soc/imx/revision.h> | 16 | #include <soc/imx/revision.h> |
17 | #include <soc/imx/timer.h> | ||
17 | #include <asm/irq.h> | 18 | #include <asm/irq.h> |
18 | 19 | ||
19 | #include "clk.h" | 20 | #include "clk.h" |
@@ -293,7 +294,7 @@ int __init mx35_clocks_init(void) | |||
293 | 294 | ||
294 | imx_print_silicon_rev("i.MX35", mx35_revision()); | 295 | imx_print_silicon_rev("i.MX35", mx35_revision()); |
295 | 296 | ||
296 | mxc_timer_init(MX35_GPT1_BASE_ADDR, MX35_INT_GPT); | 297 | mxc_timer_init(MX35_GPT1_BASE_ADDR, MX35_INT_GPT, GPT_TYPE_IMX31); |
297 | 298 | ||
298 | return 0; | 299 | return 0; |
299 | } | 300 | } |
diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index 8b112182a83b..1049b0c7d818 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h | |||
@@ -6,13 +6,6 @@ | |||
6 | 6 | ||
7 | extern spinlock_t imx_ccm_lock; | 7 | extern spinlock_t imx_ccm_lock; |
8 | 8 | ||
9 | /* | ||
10 | * This is a stop-gap solution for clock drivers like imx1/imx21 which call | ||
11 | * mxc_timer_init() to initialize timer for non-DT boot. It can be removed | ||
12 | * when these legacy non-DT support is converted or dropped. | ||
13 | */ | ||
14 | void mxc_timer_init(unsigned long pbase, int irq); | ||
15 | |||
16 | void imx_check_clocks(struct clk *clks[], unsigned int count); | 9 | void imx_check_clocks(struct clk *clks[], unsigned int count); |
17 | 10 | ||
18 | extern void imx_cscmr1_fixup(u32 *val); | 11 | extern void imx_cscmr1_fixup(u32 *val); |
diff --git a/include/soc/imx/timer.h b/include/soc/imx/timer.h new file mode 100644 index 000000000000..bbbafd65f464 --- /dev/null +++ b/include/soc/imx/timer.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * Copyright 2015 Linaro Ltd. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef __SOC_IMX_TIMER_H__ | ||
10 | #define __SOC_IMX_TIMER_H__ | ||
11 | |||
12 | enum imx_gpt_type { | ||
13 | GPT_TYPE_IMX1, /* i.MX1 */ | ||
14 | GPT_TYPE_IMX21, /* i.MX21/27 */ | ||
15 | GPT_TYPE_IMX31, /* i.MX31/35/25/37/51/6Q */ | ||
16 | GPT_TYPE_IMX6DL, /* i.MX6DL/SX/SL */ | ||
17 | }; | ||
18 | |||
19 | /* | ||
20 | * This is a stop-gap solution for clock drivers like imx1/imx21 which call | ||
21 | * mxc_timer_init() to initialize timer for non-DT boot. It can be removed | ||
22 | * when these legacy non-DT support is converted or dropped. | ||
23 | */ | ||
24 | void mxc_timer_init(unsigned long pbase, int irq, enum imx_gpt_type type); | ||
25 | |||
26 | #endif /* __SOC_IMX_TIMER_H__ */ | ||