aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/leon_smp.c
diff options
context:
space:
mode:
authorTkhai Kirill <tkhai@yandex.ru>2012-04-04 15:49:26 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-15 13:28:50 -0400
commit62f082830d63cf753ed0dab16f8d3b2d0ffc7f43 (patch)
tree39770d13d3dbff835eb3500c6a913da5c784fec3 /arch/sparc/kernel/leon_smp.c
parent472bc4f2ad164a5aac2e85d891c4faecfc5d62c4 (diff)
sparc32: generic clockevent support
The kernel uses l14 timers as clockevents. l10 timer is used as clocksource if platform master_l10_counter isn't constantly zero. The clocksource is continuous, so it's possible to use high resolution timers. l10 timer is also used as clockevent on UP configurations. This realization is for sun4m, sun4d, sun4c, microsparc-IIep and LEON platforms. The appropriate LEON changes was made by Konrad Eisele. In case of sun4m's oneshot mode, profile irq is zeroed in smp4m_percpu_timer_interrupt(). It is maybe needless (double, triple etc overflow does nothing). sun4d is able to have oneshot mode too, but I haven't any way to test it. So code of its percpu timer handler is made as much equal to the current code as possible. The patch is tested on sun4m box in SMP mode by me, and tested by Konrad on leon in up mode (leon smp is broken atm - due to other reasons). Signed-off-by: Tkhai Kirill <tkhai@yandex.ru> Tested-by: Konrad Eisele <konrad@gaisler.com> [leon up] [sam: revised patch to provide generic support for leon] Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/leon_smp.c')
-rw-r--r--arch/sparc/kernel/leon_smp.c34
1 files changed, 4 insertions, 30 deletions
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 1210fde18740..6173f4d82ded 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -23,6 +23,8 @@
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/gfp.h> 25#include <linux/gfp.h>
26#include <linux/cpu.h>
27#include <linux/clockchips.h>
26 28
27#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
28#include <asm/tlbflush.h> 30#include <asm/tlbflush.h>
@@ -42,6 +44,7 @@
42#include <asm/asi.h> 44#include <asm/asi.h>
43#include <asm/leon.h> 45#include <asm/leon.h>
44#include <asm/leon_amba.h> 46#include <asm/leon_amba.h>
47#include <asm/timer.h>
45 48
46#include "kernel.h" 49#include "kernel.h"
47 50
@@ -68,8 +71,6 @@ static inline unsigned long do_swap(volatile unsigned long *ptr,
68 return val; 71 return val;
69} 72}
70 73
71static void smp_setup_percpu_timer(void);
72
73void __cpuinit leon_callin(void) 74void __cpuinit leon_callin(void)
74{ 75{
75 int cpuid = hard_smpleon_processor_id(); 76 int cpuid = hard_smpleon_processor_id();
@@ -79,7 +80,7 @@ void __cpuinit leon_callin(void)
79 leon_configure_cache_smp(); 80 leon_configure_cache_smp();
80 81
81 /* Get our local ticker going. */ 82 /* Get our local ticker going. */
82 smp_setup_percpu_timer(); 83 register_percpu_ce(cpuid);
83 84
84 calibrate_delay(); 85 calibrate_delay();
85 smp_store_cpu_info(cpuid); 86 smp_store_cpu_info(cpuid);
@@ -196,7 +197,6 @@ void __init leon_boot_cpus(void)
196 leon_smp_setbroadcast(1 << LEON3_IRQ_TICKER); 197 leon_smp_setbroadcast(1 << LEON3_IRQ_TICKER);
197 198
198 leon_configure_cache_smp(); 199 leon_configure_cache_smp();
199 smp_setup_percpu_timer();
200 local_flush_cache_all(); 200 local_flush_cache_all();
201 201
202} 202}
@@ -489,32 +489,6 @@ void leon_cross_call_irq(void)
489 ccall_info.processors_out[i] = 1; 489 ccall_info.processors_out[i] = 1;
490} 490}
491 491
492irqreturn_t leon_percpu_timer_interrupt(int irq, void *unused)
493{
494 int cpu = smp_processor_id();
495
496 leon_clear_profile_irq(cpu);
497
498 profile_tick(CPU_PROFILING);
499
500 if (!--prof_counter(cpu)) {
501 int user = user_mode(get_irq_regs());
502
503 update_process_times(user);
504
505 prof_counter(cpu) = prof_multiplier(cpu);
506 }
507
508 return IRQ_HANDLED;
509}
510
511static void __init smp_setup_percpu_timer(void)
512{
513 int cpu = smp_processor_id();
514
515 prof_counter(cpu) = prof_multiplier(cpu) = 1;
516}
517
518void __init leon_blackbox_id(unsigned *addr) 492void __init leon_blackbox_id(unsigned *addr)
519{ 493{
520 int rd = *addr & 0x3e000000; 494 int rd = *addr & 0x3e000000;