aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mn10300/kernel/time.c
diff options
context:
space:
mode:
authorAkira Takeuchi <takeuchi.akr@jp.panasonic.com>2010-10-27 12:28:55 -0400
committerDavid Howells <dhowells@redhat.com>2010-10-27 12:28:55 -0400
commit368dd5acd154b09c043cc4392a74da01599b37d5 (patch)
treedd94ae3d044f6e774dec2437613515bd6b46dacb /arch/mn10300/kernel/time.c
parent04157a6e7df99fd5ed64955233d6e00ab6613614 (diff)
MN10300: And Panasonic AM34 subarch and implement SMP
Implement the Panasonic MN10300 AM34 CPU subarch and implement SMP support for MN10300. Also implement support for the MN2WS0060 processor and the ASB2364 evaluation board which are AM34 based. Signed-off-by: Akira Takeuchi <takeuchi.akr@jp.panasonic.com> Signed-off-by: Kiyoshi Owada <owada.kiyoshi@jp.panasonic.com> Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'arch/mn10300/kernel/time.c')
-rw-r--r--arch/mn10300/kernel/time.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/arch/mn10300/kernel/time.c b/arch/mn10300/kernel/time.c
index 0b5c856b4266..0cb9bdb3b6bd 100644
--- a/arch/mn10300/kernel/time.c
+++ b/arch/mn10300/kernel/time.c
@@ -22,12 +22,7 @@
22#include <asm/processor.h> 22#include <asm/processor.h>
23#include <asm/intctl-regs.h> 23#include <asm/intctl-regs.h>
24#include <asm/rtc.h> 24#include <asm/rtc.h>
25 25#include "internal.h"
26#ifdef CONFIG_MN10300_RTC
27unsigned long mn10300_ioclk; /* system I/O clock frequency */
28unsigned long mn10300_iobclk; /* system I/O clock frequency */
29unsigned long mn10300_tsc_per_HZ; /* number of ioclks per jiffy */
30#endif /* CONFIG_MN10300_RTC */
31 26
32static unsigned long mn10300_last_tsc; /* time-stamp counter at last time 27static unsigned long mn10300_last_tsc; /* time-stamp counter at last time
33 * interrupt occurred */ 28 * interrupt occurred */
@@ -95,6 +90,19 @@ static void __init mn10300_sched_clock_init(void)
95 __muldiv64u(NSEC_PER_SEC, 1 << 16, MN10300_TSCCLK); 90 __muldiv64u(NSEC_PER_SEC, 1 << 16, MN10300_TSCCLK);
96} 91}
97 92
93/**
94 * local_timer_interrupt - Local timer interrupt handler
95 *
96 * Handle local timer interrupts for this CPU. They may have been propagated
97 * to this CPU from the CPU that actually gets them by way of an IPI.
98 */
99irqreturn_t local_timer_interrupt(void)
100{
101 profile_tick(CPU_PROFILING);
102 update_process_times(user_mode(get_irq_regs()));
103 return IRQ_HANDLED;
104}
105
98/* 106/*
99 * advance the kernel's time keeping clocks (xtime and jiffies) 107 * advance the kernel's time keeping clocks (xtime and jiffies)
100 * - we use Timer 0 & 1 cascaded as a clock to nudge us the next time 108 * - we use Timer 0 & 1 cascaded as a clock to nudge us the next time
@@ -103,6 +111,7 @@ static void __init mn10300_sched_clock_init(void)
103static irqreturn_t timer_interrupt(int irq, void *dev_id) 111static irqreturn_t timer_interrupt(int irq, void *dev_id)
104{ 112{
105 unsigned tsc, elapse; 113 unsigned tsc, elapse;
114 irqreturn_t ret;
106 115
107 write_seqlock(&xtime_lock); 116 write_seqlock(&xtime_lock);
108 117
@@ -114,15 +123,16 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
114 mn10300_last_tsc -= MN10300_TSC_PER_HZ; 123 mn10300_last_tsc -= MN10300_TSC_PER_HZ;
115 124
116 /* advance the kernel's time tracking system */ 125 /* advance the kernel's time tracking system */
117 profile_tick(CPU_PROFILING);
118 do_timer(1); 126 do_timer(1);
119 } 127 }
120 128
121 write_sequnlock(&xtime_lock); 129 write_sequnlock(&xtime_lock);
122 130
123 update_process_times(user_mode(get_irq_regs())); 131 ret = local_timer_interrupt();
124 132#ifdef CONFIG_SMP
125 return IRQ_HANDLED; 133 send_IPI_allbutself(LOCAL_TIMER_IPI);
134#endif
135 return ret;
126} 136}
127 137
128/* 138/*
@@ -148,7 +158,7 @@ void __init time_init(void)
148 /* use timer 0 & 1 cascaded to tick at as close to HZ as possible */ 158 /* use timer 0 & 1 cascaded to tick at as close to HZ as possible */
149 setup_irq(TMJCIRQ, &timer_irq); 159 setup_irq(TMJCIRQ, &timer_irq);
150 160
151 set_intr_level(TMJCIRQ, TMJCICR_LEVEL); 161 set_intr_level(TMJCIRQ, NUM2GxICR_LEVEL(CONFIG_TIMER_IRQ_LEVEL));
152 162
153 startup_jiffies_counter(); 163 startup_jiffies_counter();
154 164