diff options
author | Viresh Kumar <viresh.kumar@st.com> | 2012-04-21 03:45:37 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-05-12 15:03:26 -0400 |
commit | 30551c0108e0d2fed48778a6bbd52843088bcb7b (patch) | |
tree | b26eba9ad07964e76465bddb42474e25c4690597 /arch/arm | |
parent | fa599c333d3d66846545026b41bcf36d1350fe30 (diff) |
SPEAr: Add DT bindings for SPEAr's timer
All SPEAr SoC's use ST's Timer module. This patch adds device tree probing
capability for that.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/boot/dts/spear3xx.dtsi | 6 | ||||
-rw-r--r-- | arch/arm/boot/dts/spear600.dtsi | 6 | ||||
-rw-r--r-- | arch/arm/mach-spear3xx/include/mach/generic.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-spear3xx/include/mach/irqs.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-spear3xx/include/mach/spear.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-spear3xx/spear3xx.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-spear6xx/include/mach/generic.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-spear6xx/include/mach/irqs.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-spear6xx/include/mach/spear.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-spear6xx/spear6xx.c | 2 | ||||
-rw-r--r-- | arch/arm/plat-spear/time.c | 31 |
11 files changed, 38 insertions, 19 deletions
diff --git a/arch/arm/boot/dts/spear3xx.dtsi b/arch/arm/boot/dts/spear3xx.dtsi index 0ae7c8e86311..91072553963f 100644 --- a/arch/arm/boot/dts/spear3xx.dtsi +++ b/arch/arm/boot/dts/spear3xx.dtsi | |||
@@ -139,6 +139,12 @@ | |||
139 | interrupts = <12>; | 139 | interrupts = <12>; |
140 | status = "disabled"; | 140 | status = "disabled"; |
141 | }; | 141 | }; |
142 | |||
143 | timer@f0000000 { | ||
144 | compatible = "st,spear-timer"; | ||
145 | reg = <0xf0000000 0x400>; | ||
146 | interrupts = <2>; | ||
147 | }; | ||
142 | }; | 148 | }; |
143 | }; | 149 | }; |
144 | }; | 150 | }; |
diff --git a/arch/arm/boot/dts/spear600.dtsi b/arch/arm/boot/dts/spear600.dtsi index d777e3a6f178..089f0a42c50e 100644 --- a/arch/arm/boot/dts/spear600.dtsi +++ b/arch/arm/boot/dts/spear600.dtsi | |||
@@ -177,6 +177,12 @@ | |||
177 | interrupts = <28>; | 177 | interrupts = <28>; |
178 | status = "disabled"; | 178 | status = "disabled"; |
179 | }; | 179 | }; |
180 | |||
181 | timer@f0000000 { | ||
182 | compatible = "st,spear-timer"; | ||
183 | reg = <0xf0000000 0x400>; | ||
184 | interrupts = <16>; | ||
185 | }; | ||
180 | }; | 186 | }; |
181 | }; | 187 | }; |
182 | }; | 188 | }; |
diff --git a/arch/arm/mach-spear3xx/include/mach/generic.h b/arch/arm/mach-spear3xx/include/mach/generic.h index e4f4d721cda2..efb69357429a 100644 --- a/arch/arm/mach-spear3xx/include/mach/generic.h +++ b/arch/arm/mach-spear3xx/include/mach/generic.h | |||
@@ -28,7 +28,7 @@ extern struct pl022_ssp_controller pl022_plat_data; | |||
28 | extern struct pl08x_platform_data pl080_plat_data; | 28 | extern struct pl08x_platform_data pl080_plat_data; |
29 | 29 | ||
30 | /* Add spear3xx family function declarations here */ | 30 | /* Add spear3xx family function declarations here */ |
31 | void __init spear_setup_timer(resource_size_t base, int irq); | 31 | void __init spear_setup_of_timer(void); |
32 | void __init spear3xx_map_io(void); | 32 | void __init spear3xx_map_io(void); |
33 | void __init spear3xx_dt_init_irq(void); | 33 | void __init spear3xx_dt_init_irq(void); |
34 | 34 | ||
diff --git a/arch/arm/mach-spear3xx/include/mach/irqs.h b/arch/arm/mach-spear3xx/include/mach/irqs.h index 319620a1afb4..51bd62a0254c 100644 --- a/arch/arm/mach-spear3xx/include/mach/irqs.h +++ b/arch/arm/mach-spear3xx/include/mach/irqs.h | |||
@@ -16,7 +16,6 @@ | |||
16 | 16 | ||
17 | /* FIXME: probe all these from DT */ | 17 | /* FIXME: probe all these from DT */ |
18 | #define SPEAR3XX_IRQ_INTRCOMM_RAS_ARM 1 | 18 | #define SPEAR3XX_IRQ_INTRCOMM_RAS_ARM 1 |
19 | #define SPEAR3XX_IRQ_CPU_GPT1_1 2 | ||
20 | #define SPEAR3XX_IRQ_GEN_RAS_1 28 | 19 | #define SPEAR3XX_IRQ_GEN_RAS_1 28 |
21 | #define SPEAR3XX_IRQ_GEN_RAS_2 29 | 20 | #define SPEAR3XX_IRQ_GEN_RAS_2 29 |
22 | #define SPEAR3XX_IRQ_GEN_RAS_3 30 | 21 | #define SPEAR3XX_IRQ_GEN_RAS_3 30 |
diff --git a/arch/arm/mach-spear3xx/include/mach/spear.h b/arch/arm/mach-spear3xx/include/mach/spear.h index 6d4dadc67633..04da906b0d4c 100644 --- a/arch/arm/mach-spear3xx/include/mach/spear.h +++ b/arch/arm/mach-spear3xx/include/mach/spear.h | |||
@@ -26,7 +26,6 @@ | |||
26 | /* ML1 - Multi Layer CPU Subsystem */ | 26 | /* ML1 - Multi Layer CPU Subsystem */ |
27 | #define SPEAR3XX_ICM3_ML1_2_BASE UL(0xF0000000) | 27 | #define SPEAR3XX_ICM3_ML1_2_BASE UL(0xF0000000) |
28 | #define VA_SPEAR6XX_ML_CPU_BASE UL(0xF0000000) | 28 | #define VA_SPEAR6XX_ML_CPU_BASE UL(0xF0000000) |
29 | #define SPEAR3XX_CPU_TMR_BASE UL(0xF0000000) | ||
30 | 29 | ||
31 | /* ICM3 - Basic Subsystem */ | 30 | /* ICM3 - Basic Subsystem */ |
32 | #define SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000) | 31 | #define SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000) |
diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear3xx/spear3xx.c index bbb11efa6056..25c6c67d5b07 100644 --- a/arch/arm/mach-spear3xx/spear3xx.c +++ b/arch/arm/mach-spear3xx/spear3xx.c | |||
@@ -534,7 +534,7 @@ static void __init spear3xx_timer_init(void) | |||
534 | clk_put(gpt_clk); | 534 | clk_put(gpt_clk); |
535 | clk_put(pclk); | 535 | clk_put(pclk); |
536 | 536 | ||
537 | spear_setup_timer(SPEAR3XX_CPU_TMR_BASE, SPEAR3XX_IRQ_CPU_GPT1_1); | 537 | spear_setup_of_timer(); |
538 | } | 538 | } |
539 | 539 | ||
540 | struct sys_timer spear3xx_timer = { | 540 | struct sys_timer spear3xx_timer = { |
diff --git a/arch/arm/mach-spear6xx/include/mach/generic.h b/arch/arm/mach-spear6xx/include/mach/generic.h index 7167fd331d86..65514b159370 100644 --- a/arch/arm/mach-spear6xx/include/mach/generic.h +++ b/arch/arm/mach-spear6xx/include/mach/generic.h | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | 18 | ||
19 | void __init spear_setup_timer(resource_size_t base, int irq); | 19 | void __init spear_setup_of_timer(void); |
20 | void spear_restart(char, const char *); | 20 | void spear_restart(char, const char *); |
21 | void __init spear6xx_clk_init(void); | 21 | void __init spear6xx_clk_init(void); |
22 | 22 | ||
diff --git a/arch/arm/mach-spear6xx/include/mach/irqs.h b/arch/arm/mach-spear6xx/include/mach/irqs.h index 2b735389e74b..37a5c411a866 100644 --- a/arch/arm/mach-spear6xx/include/mach/irqs.h +++ b/arch/arm/mach-spear6xx/include/mach/irqs.h | |||
@@ -16,9 +16,6 @@ | |||
16 | 16 | ||
17 | /* IRQ definitions */ | 17 | /* IRQ definitions */ |
18 | /* VIC 1 */ | 18 | /* VIC 1 */ |
19 | /* FIXME: probe this from DT */ | ||
20 | #define IRQ_CPU_GPT1_1 16 | ||
21 | |||
22 | #define IRQ_VIC_END 64 | 19 | #define IRQ_VIC_END 64 |
23 | 20 | ||
24 | /* GPIO pins virtual irqs */ | 21 | /* GPIO pins virtual irqs */ |
diff --git a/arch/arm/mach-spear6xx/include/mach/spear.h b/arch/arm/mach-spear6xx/include/mach/spear.h index d278ed047a53..cb8ed2f4dc85 100644 --- a/arch/arm/mach-spear6xx/include/mach/spear.h +++ b/arch/arm/mach-spear6xx/include/mach/spear.h | |||
@@ -25,7 +25,6 @@ | |||
25 | /* ML-1, 2 - Multi Layer CPU Subsystem */ | 25 | /* ML-1, 2 - Multi Layer CPU Subsystem */ |
26 | #define SPEAR6XX_ML_CPU_BASE UL(0xF0000000) | 26 | #define SPEAR6XX_ML_CPU_BASE UL(0xF0000000) |
27 | #define VA_SPEAR6XX_ML_CPU_BASE UL(0xF0000000) | 27 | #define VA_SPEAR6XX_ML_CPU_BASE UL(0xF0000000) |
28 | #define SPEAR6XX_CPU_TMR_BASE UL(0xF0000000) | ||
29 | 28 | ||
30 | /* ICM3 - Basic Subsystem */ | 29 | /* ICM3 - Basic Subsystem */ |
31 | #define SPEAR6XX_ICM3_SMI_CTRL_BASE UL(0xFC000000) | 30 | #define SPEAR6XX_ICM3_SMI_CTRL_BASE UL(0xFC000000) |
diff --git a/arch/arm/mach-spear6xx/spear6xx.c b/arch/arm/mach-spear6xx/spear6xx.c index de194dbb8371..7ae4d5be6cb5 100644 --- a/arch/arm/mach-spear6xx/spear6xx.c +++ b/arch/arm/mach-spear6xx/spear6xx.c | |||
@@ -448,7 +448,7 @@ static void __init spear6xx_timer_init(void) | |||
448 | clk_put(gpt_clk); | 448 | clk_put(gpt_clk); |
449 | clk_put(pclk); | 449 | clk_put(pclk); |
450 | 450 | ||
451 | spear_setup_timer(SPEAR6XX_CPU_TMR_BASE, IRQ_CPU_GPT1_1); | 451 | spear_setup_of_timer(); |
452 | } | 452 | } |
453 | 453 | ||
454 | struct sys_timer spear6xx_timer = { | 454 | struct sys_timer spear6xx_timer = { |
diff --git a/arch/arm/plat-spear/time.c b/arch/arm/plat-spear/time.c index a3164d1647fd..9a378987bbb1 100644 --- a/arch/arm/plat-spear/time.c +++ b/arch/arm/plat-spear/time.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/ioport.h> | 18 | #include <linux/ioport.h> |
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/of_irq.h> | ||
22 | #include <linux/of_address.h> | ||
21 | #include <linux/time.h> | 23 | #include <linux/time.h> |
22 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
23 | #include <asm/mach/time.h> | 25 | #include <asm/mach/time.h> |
@@ -197,19 +199,32 @@ static void __init spear_clockevent_init(int irq) | |||
197 | setup_irq(irq, &spear_timer_irq); | 199 | setup_irq(irq, &spear_timer_irq); |
198 | } | 200 | } |
199 | 201 | ||
200 | void __init spear_setup_timer(resource_size_t base, int irq) | 202 | const static struct of_device_id timer_of_match[] __initconst = { |
203 | { .compatible = "st,spear-timer", }, | ||
204 | { }, | ||
205 | }; | ||
206 | |||
207 | void __init spear_setup_of_timer(void) | ||
201 | { | 208 | { |
202 | int ret; | 209 | struct device_node *np; |
210 | int irq, ret; | ||
211 | |||
212 | np = of_find_matching_node(NULL, timer_of_match); | ||
213 | if (!np) { | ||
214 | pr_err("%s: No timer passed via DT\n", __func__); | ||
215 | return; | ||
216 | } | ||
203 | 217 | ||
204 | if (!request_mem_region(base, SZ_1K, "gpt0")) { | 218 | irq = irq_of_parse_and_map(np, 0); |
205 | pr_err("%s:cannot get IO addr\n", __func__); | 219 | if (!irq) { |
220 | pr_err("%s: No irq passed for timer via DT\n", __func__); | ||
206 | return; | 221 | return; |
207 | } | 222 | } |
208 | 223 | ||
209 | gpt_base = ioremap(base, SZ_1K); | 224 | gpt_base = of_iomap(np, 0); |
210 | if (!gpt_base) { | 225 | if (!gpt_base) { |
211 | pr_err("%s:ioremap failed for gpt\n", __func__); | 226 | pr_err("%s: of iomap failed\n", __func__); |
212 | goto err_mem; | 227 | return; |
213 | } | 228 | } |
214 | 229 | ||
215 | gpt_clk = clk_get_sys("gpt0", NULL); | 230 | gpt_clk = clk_get_sys("gpt0", NULL); |
@@ -233,6 +248,4 @@ err_clk: | |||
233 | clk_put(gpt_clk); | 248 | clk_put(gpt_clk); |
234 | err_iomap: | 249 | err_iomap: |
235 | iounmap(gpt_base); | 250 | iounmap(gpt_base); |
236 | err_mem: | ||
237 | release_mem_region(base, SZ_1K); | ||
238 | } | 251 | } |