aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-02-04 05:32:18 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-02-04 05:32:18 -0500
commit0355e2ff4466fa0bddee64e3cdc2ba687372f4e2 (patch)
tree88327966a39ee99d9ee11f836c45972a6d277cf6
parentbea15fd77ffa1338c293328b8c74a120be53e861 (diff)
parent6905a65879b51d326396e63dfea40861a30bc17f (diff)
Merge branch 'sched_clock-for-rmk' of git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms into devel-stable
-rw-r--r--arch/arm/Kconfig16
-rw-r--r--arch/arm/kernel/Makefile5
-rw-r--r--arch/arm/kernel/time.c2
-rw-r--r--arch/arm/mach-davinci/time.c28
-rw-r--r--arch/arm/mach-prima2/timer.c21
-rw-r--r--arch/arm/plat-nomadik/Kconfig1
-rw-r--r--arch/arm/plat-versatile/Kconfig1
7 files changed, 19 insertions, 55 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index dcd77dbf4660..befb8f35d6ac 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -51,9 +51,6 @@ config MIGHT_HAVE_PCI
51config SYS_SUPPORTS_APM_EMULATION 51config SYS_SUPPORTS_APM_EMULATION
52 bool 52 bool
53 53
54config HAVE_SCHED_CLOCK
55 bool
56
57config GENERIC_GPIO 54config GENERIC_GPIO
58 bool 55 bool
59 56
@@ -438,7 +435,6 @@ config ARCH_MXC
438 select CLKDEV_LOOKUP 435 select CLKDEV_LOOKUP
439 select CLKSRC_MMIO 436 select CLKSRC_MMIO
440 select GENERIC_IRQ_CHIP 437 select GENERIC_IRQ_CHIP
441 select HAVE_SCHED_CLOCK
442 select MULTI_IRQ_HANDLER 438 select MULTI_IRQ_HANDLER
443 help 439 help
444 Support for Freescale MXC/iMX-based family of processors 440 Support for Freescale MXC/iMX-based family of processors
@@ -530,7 +526,6 @@ config ARCH_IXP4XX
530 select CPU_XSCALE 526 select CPU_XSCALE
531 select GENERIC_GPIO 527 select GENERIC_GPIO
532 select GENERIC_CLOCKEVENTS 528 select GENERIC_CLOCKEVENTS
533 select HAVE_SCHED_CLOCK
534 select MIGHT_HAVE_PCI 529 select MIGHT_HAVE_PCI
535 select DMABOUNCE if PCI 530 select DMABOUNCE if PCI
536 help 531 help
@@ -601,7 +596,6 @@ config ARCH_MMP
601 select CLKDEV_LOOKUP 596 select CLKDEV_LOOKUP
602 select GENERIC_CLOCKEVENTS 597 select GENERIC_CLOCKEVENTS
603 select GPIO_PXA 598 select GPIO_PXA
604 select HAVE_SCHED_CLOCK
605 select TICK_ONESHOT 599 select TICK_ONESHOT
606 select PLAT_PXA 600 select PLAT_PXA
607 select SPARSE_IRQ 601 select SPARSE_IRQ
@@ -642,7 +636,6 @@ config ARCH_TEGRA
642 select GENERIC_CLOCKEVENTS 636 select GENERIC_CLOCKEVENTS
643 select GENERIC_GPIO 637 select GENERIC_GPIO
644 select HAVE_CLK 638 select HAVE_CLK
645 select HAVE_SCHED_CLOCK
646 select HAVE_SMP 639 select HAVE_SMP
647 select MIGHT_HAVE_CACHE_L2X0 640 select MIGHT_HAVE_CACHE_L2X0
648 select ARCH_HAS_CPUFREQ 641 select ARCH_HAS_CPUFREQ
@@ -659,7 +652,6 @@ config ARCH_PICOXCELL
659 select DW_APB_TIMER 652 select DW_APB_TIMER
660 select GENERIC_CLOCKEVENTS 653 select GENERIC_CLOCKEVENTS
661 select GENERIC_GPIO 654 select GENERIC_GPIO
662 select HAVE_SCHED_CLOCK
663 select HAVE_TCM 655 select HAVE_TCM
664 select NO_IOPORT 656 select NO_IOPORT
665 select SPARSE_IRQ 657 select SPARSE_IRQ
@@ -687,7 +679,6 @@ config ARCH_PXA
687 select ARCH_REQUIRE_GPIOLIB 679 select ARCH_REQUIRE_GPIOLIB
688 select GENERIC_CLOCKEVENTS 680 select GENERIC_CLOCKEVENTS
689 select GPIO_PXA 681 select GPIO_PXA
690 select HAVE_SCHED_CLOCK
691 select TICK_ONESHOT 682 select TICK_ONESHOT
692 select PLAT_PXA 683 select PLAT_PXA
693 select SPARSE_IRQ 684 select SPARSE_IRQ
@@ -755,7 +746,6 @@ config ARCH_SA1100
755 select CPU_FREQ 746 select CPU_FREQ
756 select GENERIC_CLOCKEVENTS 747 select GENERIC_CLOCKEVENTS
757 select CLKDEV_LOOKUP 748 select CLKDEV_LOOKUP
758 select HAVE_SCHED_CLOCK
759 select TICK_ONESHOT 749 select TICK_ONESHOT
760 select ARCH_REQUIRE_GPIOLIB 750 select ARCH_REQUIRE_GPIOLIB
761 select HAVE_IDE 751 select HAVE_IDE
@@ -812,7 +802,6 @@ config ARCH_S5P64X0
812 select CLKSRC_MMIO 802 select CLKSRC_MMIO
813 select HAVE_S3C2410_WATCHDOG if WATCHDOG 803 select HAVE_S3C2410_WATCHDOG if WATCHDOG
814 select GENERIC_CLOCKEVENTS 804 select GENERIC_CLOCKEVENTS
815 select HAVE_SCHED_CLOCK
816 select HAVE_S3C2410_I2C if I2C 805 select HAVE_S3C2410_I2C if I2C
817 select HAVE_S3C_RTC if RTC_CLASS 806 select HAVE_S3C_RTC if RTC_CLASS
818 help 807 help
@@ -845,7 +834,6 @@ config ARCH_S5PV210
845 select ARM_L1_CACHE_SHIFT_6 834 select ARM_L1_CACHE_SHIFT_6
846 select ARCH_HAS_CPUFREQ 835 select ARCH_HAS_CPUFREQ
847 select GENERIC_CLOCKEVENTS 836 select GENERIC_CLOCKEVENTS
848 select HAVE_SCHED_CLOCK
849 select HAVE_S3C2410_I2C if I2C 837 select HAVE_S3C2410_I2C if I2C
850 select HAVE_S3C_RTC if RTC_CLASS 838 select HAVE_S3C_RTC if RTC_CLASS
851 select HAVE_S3C2410_WATCHDOG if WATCHDOG 839 select HAVE_S3C2410_WATCHDOG if WATCHDOG
@@ -888,7 +876,6 @@ config ARCH_U300
888 depends on MMU 876 depends on MMU
889 select CLKSRC_MMIO 877 select CLKSRC_MMIO
890 select CPU_ARM926T 878 select CPU_ARM926T
891 select HAVE_SCHED_CLOCK
892 select HAVE_TCM 879 select HAVE_TCM
893 select ARM_AMBA 880 select ARM_AMBA
894 select ARM_PATCH_PHYS_VIRT 881 select ARM_PATCH_PHYS_VIRT
@@ -946,7 +933,6 @@ config ARCH_OMAP
946 select ARCH_HAS_CPUFREQ 933 select ARCH_HAS_CPUFREQ
947 select CLKSRC_MMIO 934 select CLKSRC_MMIO
948 select GENERIC_CLOCKEVENTS 935 select GENERIC_CLOCKEVENTS
949 select HAVE_SCHED_CLOCK
950 select ARCH_HAS_HOLES_MEMORYMODEL 936 select ARCH_HAS_HOLES_MEMORYMODEL
951 help 937 help
952 Support for TI's OMAP platform (OMAP1/2/3/4). 938 Support for TI's OMAP platform (OMAP1/2/3/4).
@@ -1112,13 +1098,11 @@ config ARCH_ACORN
1112config PLAT_IOP 1098config PLAT_IOP
1113 bool 1099 bool
1114 select GENERIC_CLOCKEVENTS 1100 select GENERIC_CLOCKEVENTS
1115 select HAVE_SCHED_CLOCK
1116 1101
1117config PLAT_ORION 1102config PLAT_ORION
1118 bool 1103 bool
1119 select CLKSRC_MMIO 1104 select CLKSRC_MMIO
1120 select GENERIC_IRQ_CHIP 1105 select GENERIC_IRQ_CHIP
1121 select HAVE_SCHED_CLOCK
1122 1106
1123config PLAT_PXA 1107config PLAT_PXA
1124 bool 1108 bool
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 43b740d0e374..9b0eb3febcb0 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -14,8 +14,8 @@ CFLAGS_REMOVE_return_address.o = -pg
14# Object file lists. 14# Object file lists.
15 15
16obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \ 16obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \
17 process.o ptrace.o return_address.o setup.o signal.o \ 17 process.o ptrace.o return_address.o sched_clock.o \
18 sys_arm.o stacktrace.o time.o traps.o 18 setup.o signal.o stacktrace.o sys_arm.o time.o traps.o
19 19
20obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o 20obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o
21 21
@@ -30,7 +30,6 @@ obj-$(CONFIG_ARTHUR) += arthur.o
30obj-$(CONFIG_ISA_DMA) += dma-isa.o 30obj-$(CONFIG_ISA_DMA) += dma-isa.o
31obj-$(CONFIG_PCI) += bios32.o isa.o 31obj-$(CONFIG_PCI) += bios32.o isa.o
32obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o suspend.o 32obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o suspend.o
33obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o
34obj-$(CONFIG_SMP) += smp.o smp_tlb.o 33obj-$(CONFIG_SMP) += smp.o smp_tlb.o
35obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o 34obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o
36obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o 35obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 60955179113c..fe31b22f18fd 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -147,8 +147,6 @@ void __init time_init(void)
147{ 147{
148 system_timer = machine_desc->timer; 148 system_timer = machine_desc->timer;
149 system_timer->init(); 149 system_timer->init();
150#ifdef CONFIG_HAVE_SCHED_CLOCK
151 sched_clock_postinit(); 150 sched_clock_postinit();
152#endif
153} 151}
154 152
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index e1969ce904dc..75da315b6587 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -19,11 +19,14 @@
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21 21
22#include <mach/hardware.h> 22#include <asm/sched_clock.h>
23#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25
25#include <mach/cputype.h> 26#include <mach/cputype.h>
27#include <mach/hardware.h>
26#include <mach/time.h> 28#include <mach/time.h>
29
27#include "clock.h" 30#include "clock.h"
28 31
29static struct clock_event_device clockevent_davinci; 32static struct clock_event_device clockevent_davinci;
@@ -272,19 +275,9 @@ static cycle_t read_cycles(struct clocksource *cs)
272 return (cycles_t)timer32_read(t); 275 return (cycles_t)timer32_read(t);
273} 276}
274 277
275/*
276 * Kernel assumes that sched_clock can be called early but may not have
277 * things ready yet.
278 */
279static cycle_t read_dummy(struct clocksource *cs)
280{
281 return 0;
282}
283
284
285static struct clocksource clocksource_davinci = { 278static struct clocksource clocksource_davinci = {
286 .rating = 300, 279 .rating = 300,
287 .read = read_dummy, 280 .read = read_cycles,
288 .mask = CLOCKSOURCE_MASK(32), 281 .mask = CLOCKSOURCE_MASK(32),
289 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 282 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
290}; 283};
@@ -292,12 +285,9 @@ static struct clocksource clocksource_davinci = {
292/* 285/*
293 * Overwrite weak default sched_clock with something more precise 286 * Overwrite weak default sched_clock with something more precise
294 */ 287 */
295unsigned long long notrace sched_clock(void) 288static u32 notrace davinci_read_sched_clock(void)
296{ 289{
297 const cycle_t cyc = clocksource_davinci.read(&clocksource_davinci); 290 return timer32_read(&timers[TID_CLOCKSOURCE]);
298
299 return clocksource_cyc2ns(cyc, clocksource_davinci.mult,
300 clocksource_davinci.shift);
301} 291}
302 292
303/* 293/*
@@ -397,12 +387,14 @@ static void __init davinci_timer_init(void)
397 davinci_clock_tick_rate = clk_get_rate(timer_clk); 387 davinci_clock_tick_rate = clk_get_rate(timer_clk);
398 388
399 /* setup clocksource */ 389 /* setup clocksource */
400 clocksource_davinci.read = read_cycles;
401 clocksource_davinci.name = id_to_name[clocksource_id]; 390 clocksource_davinci.name = id_to_name[clocksource_id];
402 if (clocksource_register_hz(&clocksource_davinci, 391 if (clocksource_register_hz(&clocksource_davinci,
403 davinci_clock_tick_rate)) 392 davinci_clock_tick_rate))
404 printk(err, clocksource_davinci.name); 393 printk(err, clocksource_davinci.name);
405 394
395 setup_sched_clock(davinci_read_sched_clock, 32,
396 davinci_clock_tick_rate);
397
406 /* setup clockevent */ 398 /* setup clockevent */
407 clockevent_davinci.name = id_to_name[timers[TID_CLOCKEVENT].id]; 399 clockevent_davinci.name = id_to_name[timers[TID_CLOCKEVENT].id];
408 clockevent_davinci.mult = div_sc(davinci_clock_tick_rate, NSEC_PER_SEC, 400 clockevent_davinci.mult = div_sc(davinci_clock_tick_rate, NSEC_PER_SEC,
diff --git a/arch/arm/mach-prima2/timer.c b/arch/arm/mach-prima2/timer.c
index b7a6091ce791..0d024b1e916d 100644
--- a/arch/arm/mach-prima2/timer.c
+++ b/arch/arm/mach-prima2/timer.c
@@ -18,6 +18,7 @@
18#include <linux/of.h> 18#include <linux/of.h>
19#include <linux/of_address.h> 19#include <linux/of_address.h>
20#include <mach/map.h> 20#include <mach/map.h>
21#include <asm/sched_clock.h>
21#include <asm/mach/time.h> 22#include <asm/mach/time.h>
22 23
23#define SIRFSOC_TIMER_COUNTER_LO 0x0000 24#define SIRFSOC_TIMER_COUNTER_LO 0x0000
@@ -165,21 +166,9 @@ static struct irqaction sirfsoc_timer_irq = {
165}; 166};
166 167
167/* Overwrite weak default sched_clock with more precise one */ 168/* Overwrite weak default sched_clock with more precise one */
168unsigned long long notrace sched_clock(void) 169static u32 notrace sirfsoc_read_sched_clock(void)
169{ 170{
170 static int is_mapped; 171 return (u32)(sirfsoc_timer_read(NULL) & 0xffffffff);
171
172 /*
173 * sched_clock is called earlier than .init of sys_timer
174 * if we map timer memory in .init of sys_timer, system
175 * will panic due to illegal memory access
176 */
177 if (!is_mapped) {
178 sirfsoc_of_timer_map();
179 is_mapped = 1;
180 }
181
182 return sirfsoc_timer_read(NULL) * (NSEC_PER_SEC / CLOCK_TICK_RATE);
183} 172}
184 173
185static void __init sirfsoc_clockevent_init(void) 174static void __init sirfsoc_clockevent_init(void)
@@ -210,6 +199,8 @@ static void __init sirfsoc_timer_init(void)
210 BUG_ON(rate < CLOCK_TICK_RATE); 199 BUG_ON(rate < CLOCK_TICK_RATE);
211 BUG_ON(rate % CLOCK_TICK_RATE); 200 BUG_ON(rate % CLOCK_TICK_RATE);
212 201
202 sirfsoc_of_timer_map();
203
213 writel_relaxed(rate / CLOCK_TICK_RATE / 2 - 1, sirfsoc_timer_base + SIRFSOC_TIMER_DIV); 204 writel_relaxed(rate / CLOCK_TICK_RATE / 2 - 1, sirfsoc_timer_base + SIRFSOC_TIMER_DIV);
214 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO); 205 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
215 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI); 206 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
@@ -217,6 +208,8 @@ static void __init sirfsoc_timer_init(void)
217 208
218 BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, CLOCK_TICK_RATE)); 209 BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, CLOCK_TICK_RATE));
219 210
211 setup_sched_clock(sirfsoc_read_sched_clock, 32, CLOCK_TICK_RATE);
212
220 BUG_ON(setup_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq)); 213 BUG_ON(setup_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq));
221 214
222 sirfsoc_clockevent_init(); 215 sirfsoc_clockevent_init();
diff --git a/arch/arm/plat-nomadik/Kconfig b/arch/arm/plat-nomadik/Kconfig
index bca4914b4b9d..4c48c8b60b54 100644
--- a/arch/arm/plat-nomadik/Kconfig
+++ b/arch/arm/plat-nomadik/Kconfig
@@ -23,7 +23,6 @@ config HAS_MTU
23config NOMADIK_MTU_SCHED_CLOCK 23config NOMADIK_MTU_SCHED_CLOCK
24 bool 24 bool
25 depends on HAS_MTU 25 depends on HAS_MTU
26 select HAVE_SCHED_CLOCK
27 help 26 help
28 Use the Multi Timer Unit as the sched_clock. 27 Use the Multi Timer Unit as the sched_clock.
29 28
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig
index 52353beb369d..c6f4b9625e71 100644
--- a/arch/arm/plat-versatile/Kconfig
+++ b/arch/arm/plat-versatile/Kconfig
@@ -12,6 +12,5 @@ config PLAT_VERSATILE_LEDS
12 12
13config PLAT_VERSATILE_SCHED_CLOCK 13config PLAT_VERSATILE_SCHED_CLOCK
14 def_bool y if !ARCH_INTEGRATOR_AP 14 def_bool y if !ARCH_INTEGRATOR_AP
15 select HAVE_SCHED_CLOCK
16 15
17endif 16endif