diff options
| author | Rob Herring <rob.herring@calxeda.com> | 2013-04-10 19:27:51 -0400 |
|---|---|---|
| committer | Rob Herring <rob.herring@calxeda.com> | 2013-04-11 16:11:15 -0400 |
| commit | 0583fe478a7d93be2c814b7e50d6e81c287edfe8 (patch) | |
| tree | 1fedae32e915a0caf60fa20be32824a67262cf99 | |
| parent | f414f13f2fd0d8bb12a87268a55827cda771d42b (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>
| -rw-r--r-- | arch/arm/include/asm/arch_timer.h | 13 | ||||
| -rw-r--r-- | arch/arm/kernel/arch_timer.c | 17 | ||||
| -rw-r--r-- | arch/arm/mach-exynos/mach-exynos5-dt.c | 1 | ||||
| -rw-r--r-- | arch/arm/mach-exynos/mct.c | 6 | ||||
| -rw-r--r-- | arch/arm/mach-highbank/highbank.c | 5 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/timer.c | 5 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/board-kzm9d.c | 1 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/setup-emev2.c | 1 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/setup-r8a7740.c | 1 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/setup-sh7372.c | 1 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/setup-sh73a0.c | 1 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/timer.c | 7 | ||||
| -rw-r--r-- | arch/arm/mach-vexpress/v2m.c | 7 | ||||
| -rw-r--r-- | arch/arm/mach-virt/virt.c | 9 | ||||
| -rw-r--r-- | arch/arm64/include/asm/arch_timer.h | 5 | ||||
| -rw-r--r-- | arch/arm64/kernel/time.c | 6 | ||||
| -rw-r--r-- | drivers/clocksource/Kconfig | 1 | ||||
| -rw-r--r-- | drivers/clocksource/arm_arch_timer.c | 23 | ||||
| -rw-r--r-- | include/clocksource/arm_arch_timer.h | 6 |
19 files changed, 29 insertions, 87 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 |
| 13 | int arch_timer_of_register(void); | 13 | int arch_timer_arch_init(void); |
| 14 | int 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 | ||
| 114 | static inline int arch_timer_of_register(void) | ||
| 115 | { | ||
| 116 | return -ENXIO; | ||
| 117 | } | ||
| 118 | |||
| 119 | static 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 | ||
| 42 | int __init arch_timer_of_register(void) | 42 | int __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 | |||
| 55 | int __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 | ||
| 470 | void __init exynos4_timer_init(void) | 469 | void __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 | |||
