aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2013-04-10 19:27:51 -0400
committerRob Herring <rob.herring@calxeda.com>2013-04-11 16:11:15 -0400
commit0583fe478a7d93be2c814b7e50d6e81c287edfe8 (patch)
tree1fedae32e915a0caf60fa20be32824a67262cf99 /arch
parentf414f13f2fd0d8bb12a87268a55827cda771d42b (diff)
ARM: convert arm/arm64 arch timer to use CLKSRC_OF init
This converts arm and arm64 to use CLKSRC_OF DT based initialization for the arch timer. A new function arch_timer_arch_init is added to allow for arch specific setup. This has a side effect of enabling sched_clock on omap5 and exynos5. There should not be any reason not to use the arch timers for sched_clock. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Kukjin Kim <kgene.kim@samsung.com> Cc: Tony Lindgren <tony@atomide.com> Cc: Simon Horman <horms@verge.net.au> Cc: Magnus Damm <magnus.damm@gmail.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: John Stultz <john.stultz@linaro.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-samsung-soc@vger.kernel.org Cc: linux-omap@vger.kernel.org Cc: linux-sh@vger.kernel.org Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/arch_timer.h13
-rw-r--r--arch/arm/kernel/arch_timer.c17
-rw-r--r--arch/arm/mach-exynos/mach-exynos5-dt.c1
-rw-r--r--arch/arm/mach-exynos/mct.c6
-rw-r--r--arch/arm/mach-highbank/highbank.c5
-rw-r--r--arch/arm/mach-omap2/timer.c5
-rw-r--r--arch/arm/mach-shmobile/board-kzm9d.c1
-rw-r--r--arch/arm/mach-shmobile/setup-emev2.c1
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c1
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c1
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c1
-rw-r--r--arch/arm/mach-shmobile/timer.c7
-rw-r--r--arch/arm/mach-vexpress/v2m.c7
-rw-r--r--arch/arm/mach-virt/virt.c9
-rw-r--r--arch/arm64/include/asm/arch_timer.h5
-rw-r--r--arch/arm64/kernel/time.c6
16 files changed, 19 insertions, 67 deletions
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h
index 7ade91d8cc6f..7c1bfc0aea0c 100644
--- a/arch/arm/include/asm/arch_timer.h
+++ b/arch/arm/include/asm/arch_timer.h
@@ -10,8 +10,7 @@
10#include <clocksource/arm_arch_timer.h> 10#include <clocksource/arm_arch_timer.h>
11 11
12#ifdef CONFIG_ARM_ARCH_TIMER 12#ifdef CONFIG_ARM_ARCH_TIMER
13int arch_timer_of_register(void); 13int arch_timer_arch_init(void);
14int arch_timer_sched_clock_init(void);
15 14
16/* 15/*
17 * These register accessors are marked inline so the compiler can 16 * These register accessors are marked inline so the compiler can
@@ -110,16 +109,6 @@ static inline void __cpuinit arch_counter_set_user_access(void)
110 109
111 asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl)); 110 asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl));
112} 111}
113#else
114static inline int arch_timer_of_register(void)
115{
116 return -ENXIO;
117}
118
119static inline int arch_timer_sched_clock_init(void)
120{
121 return -ENXIO;
122}
123#endif 112#endif
124 113
125#endif 114#endif
diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index 80c458fc4a30..59dcdced6e30 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -39,26 +39,15 @@ static void __init arch_timer_delay_timer_register(void)
39 register_current_timer_delay(&arch_delay_timer); 39 register_current_timer_delay(&arch_delay_timer);
40} 40}
41 41
42int __init arch_timer_of_register(void) 42int __init arch_timer_arch_init(void)
43{
44 int ret;
45
46 ret = arch_timer_init();
47 if (ret)
48 return ret;
49
50 arch_timer_delay_timer_register();
51
52 return 0;
53}
54
55int __init arch_timer_sched_clock_init(void)
56{ 43{
57 u32 arch_timer_rate = arch_timer_get_rate(); 44 u32 arch_timer_rate = arch_timer_get_rate();
58 45
59 if (arch_timer_rate == 0) 46 if (arch_timer_rate == 0)
60 return -ENXIO; 47 return -ENXIO;
61 48
49 arch_timer_delay_timer_register();
50
62 /* Cache the sched_clock multiplier to save a divide in the hot path. */ 51 /* Cache the sched_clock multiplier to save a divide in the hot path. */
63 sched_clock_mult = NSEC_PER_SEC / arch_timer_rate; 52 sched_clock_mult = NSEC_PER_SEC / arch_timer_rate;
64 sched_clock_func = arch_timer_sched_clock; 53 sched_clock_func = arch_timer_sched_clock;
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
index acaeb14db54b..4d97b4311084 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -216,7 +216,6 @@ DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
216 .map_io = exynos5_dt_map_io, 216 .map_io = exynos5_dt_map_io,
217 .init_machine = exynos5_dt_machine_init, 217 .init_machine = exynos5_dt_machine_init,
218 .init_late = exynos_init_late, 218 .init_late = exynos_init_late,
219 .init_time = exynos4_timer_init,
220 .dt_compat = exynos5_dt_compat, 219 .dt_compat = exynos5_dt_compat,
221 .restart = exynos5_restart, 220 .restart = exynos5_restart,
222 .reserve = exynos5_reserve, 221 .reserve = exynos5_reserve,
diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c
index c9d6650f9b5d..04aff6a61e8d 100644
--- a/arch/arm/mach-exynos/mct.c
+++ b/arch/arm/mach-exynos/mct.c
@@ -21,7 +21,6 @@
21#include <linux/percpu.h> 21#include <linux/percpu.h>
22#include <linux/of.h> 22#include <linux/of.h>
23 23
24#include <asm/arch_timer.h>
25#include <asm/localtimer.h> 24#include <asm/localtimer.h>
26 25
27#include <plat/cpu.h> 26#include <plat/cpu.h>
@@ -469,11 +468,6 @@ static void __init exynos4_timer_resources(void)
469 468
470void __init exynos4_timer_init(void) 469void __init exynos4_timer_init(void)
471{ 470{
472 if (soc_is_exynos5440()) {
473 arch_timer_of_register();
474 return;
475 }
476
477 if ((soc_is_exynos4210()) || (soc_is_exynos5250())) 471 if ((soc_is_exynos4210()) || (soc_is_exynos5250()))
478 mct_int_type = MCT_INT_SPI; 472 mct_int_type = MCT_INT_SPI;
479 else 473 else
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 76c1170b3528..758150eb9975 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -15,6 +15,7 @@
15 */ 15 */
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/clkdev.h> 17#include <linux/clkdev.h>
18#include <linux/clocksource.h>
18#include <linux/dma-mapping.h> 19#include <linux/dma-mapping.h>
19#include <linux/io.h> 20#include <linux/io.h>
20#include <linux/irq.h> 21#include <linux/irq.h>
@@ -28,7 +29,6 @@
28#include <linux/amba/bus.h> 29#include <linux/amba/bus.h>
29#include <linux/clk-provider.h> 30#include <linux/clk-provider.h>
30 31
31#include <asm/arch_timer.h>
32#include <asm/cacheflush.h> 32#include <asm/cacheflush.h>
33#include <asm/cputype.h> 33#include <asm/cputype.h>
34#include <asm/smp_plat.h> 34#include <asm/smp_plat.h>
@@ -118,9 +118,6 @@ static void __init highbank_timer_init(void)
118 sp804_clocksource_and_sched_clock_init(timer_base + 0x20, "timer1"); 118 sp804_clocksource_and_sched_clock_init(timer_base + 0x20, "timer1");
119 sp804_clockevents_init(timer_base, irq, "timer0"); 119 sp804_clockevents_init(timer_base, irq, "timer0");
120 120
121 arch_timer_of_register();
122 arch_timer_sched_clock_init();
123
124 clocksource_of_init(); 121 clocksource_of_init();
125} 122}
126 123
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 4fd80257c73e..7dd6453a213e 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -46,7 +46,6 @@
46#include <asm/smp_twd.h> 46#include <asm/smp_twd.h>
47#include <asm/sched_clock.h> 47#include <asm/sched_clock.h>
48 48
49#include <asm/arch_timer.h>
50#include "omap_hwmod.h" 49#include "omap_hwmod.h"
51#include "omap_device.h" 50#include "omap_device.h"
52#include <plat/counter-32k.h> 51#include <plat/counter-32k.h>
@@ -624,9 +623,7 @@ void __init omap5_realtime_timer_init(void)
624 omap5_sync32k_timer_init(); 623 omap5_sync32k_timer_init();
625 realtime_counter_init(); 624 realtime_counter_init();
626 625
627 err = arch_timer_of_register(); 626 clocksource_of_init();
628 if (err)
629 pr_err("%s: arch_timer_register failed %d\n", __func__, err);
630} 627}
631#endif /* CONFIG_SOC_OMAP5 */ 628#endif /* CONFIG_SOC_OMAP5 */
632 629
diff --git a/arch/arm/mach-shmobile/board-kzm9d.c b/arch/arm/mach-shmobile/board-kzm9d.c
index c254782aa727..c016ccd92433 100644
--- a/arch/arm/mach-shmobile/board-kzm9d.c
+++ b/arch/arm/mach-shmobile/board-kzm9d.c
@@ -90,6 +90,5 @@ DT_MACHINE_START(KZM9D_DT, "kzm9d")
90 .init_irq = emev2_init_irq, 90 .init_irq = emev2_init_irq,
91 .init_machine = kzm9d_add_standard_devices, 91 .init_machine = kzm9d_add_standard_devices,
92 .init_late = shmobile_init_late, 92 .init_late = shmobile_init_late,
93 .init_time = shmobile_timer_init,
94 .dt_compat = kzm9d_boards_compat_dt, 93 .dt_compat = kzm9d_boards_compat_dt,
95MACHINE_END 94MACHINE_END
diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
index 47662a581c0a..4e38a66508a4 100644
--- a/arch/arm/mach-shmobile/setup-emev2.c
+++ b/arch/arm/mach-shmobile/setup-emev2.c
@@ -456,7 +456,6 @@ DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
456 .nr_irqs = NR_IRQS_LEGACY, 456 .nr_irqs = NR_IRQS_LEGACY,
457 .init_irq = irqchip_init, 457 .init_irq = irqchip_init,
458 .init_machine = emev2_add_standard_devices_dt, 458 .init_machine = emev2_add_standard_devices_dt,
459 .init_time = shmobile_timer_init,
460 .dt_compat = emev2_boards_compat_dt, 459 .dt_compat = emev2_boards_compat_dt,
461MACHINE_END 460MACHINE_END
462 461
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 8b85d4d8fab6..104b474a2ccf 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -906,7 +906,6 @@ DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")
906 .init_irq = r8a7740_init_irq, 906 .init_irq = r8a7740_init_irq,
907 .handle_irq = shmobile_handle_irq_intc, 907 .handle_irq = shmobile_handle_irq_intc,
908 .init_machine = r8a7740_add_standard_devices_dt, 908 .init_machine = r8a7740_add_standard_devices_dt,
909 .init_time = shmobile_timer_init,
910 .dt_compat = r8a7740_boards_compat_dt, 909 .dt_compat = r8a7740_boards_compat_dt,
911MACHINE_END 910MACHINE_END
912 911
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 59c7146bf66f..5502d624aca6 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -1175,7 +1175,6 @@ DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)")
1175 .init_irq = sh7372_init_irq, 1175 .init_irq = sh7372_init_irq,
1176 .handle_irq = shmobile_handle_irq_intc, 1176 .handle_irq = shmobile_handle_irq_intc,
1177 .init_machine = sh7372_add_standard_devices_dt, 1177 .init_machine = sh7372_add_standard_devices_dt,
1178 .init_time = shmobile_timer_init,
1179 .dt_compat = sh7372_boards_compat_dt, 1178 .dt_compat = sh7372_boards_compat_dt,
1180MACHINE_END 1179MACHINE_END
1181 1180
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index bdab575f88bc..ea66316f0ac9 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -923,7 +923,6 @@ DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)")
923 .nr_irqs = NR_IRQS_LEGACY, 923 .nr_irqs = NR_IRQS_LEGACY,
924 .init_irq = sh73a0_init_irq_dt, 924 .init_irq = sh73a0_init_irq_dt,
925 .init_machine = sh73a0_add_standard_devices_dt, 925 .init_machine = sh73a0_add_standard_devices_dt,
926 .init_time = shmobile_timer_init,
927 .dt_compat = sh73a0_boards_compat_dt, 926 .dt_compat = sh73a0_boards_compat_dt,
928MACHINE_END 927MACHINE_END
929#endif /* CONFIG_USE_OF */ 928#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index 3d16d4dff01b..f321dbeb2379 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -19,10 +19,8 @@
19 * 19 *
20 */ 20 */
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/clocksource.h>
22#include <linux/delay.h> 23#include <linux/delay.h>
23#include <asm/arch_timer.h>
24#include <asm/mach/time.h>
25#include <asm/smp_twd.h>
26 24
27void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz, 25void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
28 unsigned int mult, unsigned int div) 26 unsigned int mult, unsigned int div)
@@ -63,6 +61,5 @@ void __init shmobile_earlytimer_init(void)
63 61
64void __init shmobile_timer_init(void) 62void __init shmobile_timer_init(void)
65{ 63{
66 arch_timer_of_register(); 64 clocksource_of_init();
67 arch_timer_sched_clock_init();
68} 65}
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index d0ad78998cb6..621571781b20 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -1,6 +1,7 @@
1/* 1/*
2 * Versatile Express V2M Motherboard Support 2 * Versatile Express V2M Motherboard Support
3 */ 3 */
4#include <linux/clocksource.h>
4#include <linux/device.h> 5#include <linux/device.h>
5#include <linux/amba/bus.h> 6#include <linux/amba/bus.h>
6#include <linux/amba/mmci.h> 7#include <linux/amba/mmci.h>
@@ -23,7 +24,6 @@
23#include <linux/regulator/machine.h> 24#include <linux/regulator/machine.h>
24#include <linux/vexpress.h> 25#include <linux/vexpress.h>
25 26
26#include <asm/arch_timer.h>
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/sizes.h> 28#include <asm/sizes.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
@@ -446,10 +446,7 @@ static void __init v2m_dt_timer_init(void)
446 irq_of_parse_and_map(node, 0)); 446 irq_of_parse_and_map(node, 0));
447 } 447 }
448 448
449 arch_timer_of_register(); 449 versatile_sched_clock_init(vexpress_get_24mhz_clock_base(),
450
451 if (arch_timer_sched_clock_init() != 0)
452 versatile_sched_clock_init(vexpress_get_24mhz_clock_base(),
453 24000000); 450 24000000);
454} 451}
455 452
diff --git a/arch/arm/mach-virt/virt.c b/arch/arm/mach-virt/virt.c
index 31666f6b4373..adc0945255ae 100644
--- a/arch/arm/mach-virt/virt.c
+++ b/arch/arm/mach-virt/virt.c
@@ -23,21 +23,13 @@
23#include <linux/of_platform.h> 23#include <linux/of_platform.h>
24#include <linux/smp.h> 24#include <linux/smp.h>
25 25
26#include <asm/arch_timer.h>
27#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
28#include <asm/mach/time.h>
29 27
30static void __init virt_init(void) 28static void __init virt_init(void)
31{ 29{
32 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 30 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
33} 31}
34 32
35static void __init virt_timer_init(void)
36{
37 WARN_ON(arch_timer_of_register() != 0);
38 WARN_ON(arch_timer_sched_clock_init() != 0);
39}
40
41static const char *virt_dt_match[] = { 33static const char *virt_dt_match[] = {
42 "linux,dummy-virt", 34 "linux,dummy-virt",
43 NULL 35 NULL
@@ -47,7 +39,6 @@ extern struct smp_operations virt_smp_ops;
47 39
48DT_MACHINE_START(VIRT, "Dummy Virtual Machine") 40DT_MACHINE_START(VIRT, "Dummy Virtual Machine")
49 .init_irq = irqchip_init, 41 .init_irq = irqchip_init,
50 .init_time = virt_timer_init,
51 .init_machine = virt_init, 42 .init_machine = virt_init,
52 .smp = smp_ops(virt_smp_ops), 43 .smp = smp_ops(virt_smp_ops),
53 .dt_compat = virt_dt_match, 44 .dt_compat = virt_dt_match,
diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
index 91e2a6a6fcd4..bf6ab242f047 100644
--- a/arch/arm64/include/asm/arch_timer.h
+++ b/arch/arm64/include/asm/arch_timer.h
@@ -130,4 +130,9 @@ static inline u64 arch_counter_get_cntvct(void)
130 return cval; 130 return cval;
131} 131}
132 132
133static inline int arch_timer_arch_init(void)
134{
135 return 0;
136}
137
133#endif 138#endif
diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c
index b0ef18d14c3b..a551f88ae2c1 100644
--- a/arch/arm64/kernel/time.c
+++ b/arch/arm64/kernel/time.c
@@ -32,6 +32,7 @@
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/delay.h> 34#include <linux/delay.h>
35#include <linux/clocksource.h>
35 36
36#include <clocksource/arm_arch_timer.h> 37#include <clocksource/arm_arch_timer.h>
37 38
@@ -77,10 +78,11 @@ void __init time_init(void)
77{ 78{
78 u32 arch_timer_rate; 79 u32 arch_timer_rate;
79 80
80 if (arch_timer_init()) 81 clocksource_of_init();
81 panic("Unable to initialise architected timer.\n");
82 82
83 arch_timer_rate = arch_timer_get_rate(); 83 arch_timer_rate = arch_timer_get_rate();
84 if (!arch_timer_rate)
85 panic("Unable to initialise architected timer.\n");
84 86
85 /* Cache the sched_clock multiplier to save a divide in the hot path. */ 87 /* Cache the sched_clock multiplier to save a divide in the hot path. */
86 sched_clock_mult = NSEC_PER_SEC / arch_timer_rate; 88 sched_clock_mult = NSEC_PER_SEC / arch_timer_rate;