diff options
Diffstat (limited to 'arch/arc/kernel/time.c')
-rw-r--r-- | arch/arc/kernel/time.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/arch/arc/kernel/time.c b/arch/arc/kernel/time.c index 36c2aa99436f..dbe74f418019 100644 --- a/arch/arc/kernel/time.c +++ b/arch/arc/kernel/time.c | |||
@@ -144,12 +144,12 @@ static struct clocksource arc_counter = { | |||
144 | /********** Clock Event Device *********/ | 144 | /********** Clock Event Device *********/ |
145 | 145 | ||
146 | /* | 146 | /* |
147 | * Arm the timer to interrupt after @limit cycles | 147 | * Arm the timer to interrupt after @cycles |
148 | * The distinction for oneshot/periodic is done in arc_event_timer_ack() below | 148 | * The distinction for oneshot/periodic is done in arc_event_timer_ack() below |
149 | */ | 149 | */ |
150 | static void arc_timer_event_setup(unsigned int limit) | 150 | static void arc_timer_event_setup(unsigned int cycles) |
151 | { | 151 | { |
152 | write_aux_reg(ARC_REG_TIMER0_LIMIT, limit); | 152 | write_aux_reg(ARC_REG_TIMER0_LIMIT, cycles); |
153 | write_aux_reg(ARC_REG_TIMER0_CNT, 0); /* start from 0 */ | 153 | write_aux_reg(ARC_REG_TIMER0_CNT, 0); /* start from 0 */ |
154 | 154 | ||
155 | write_aux_reg(ARC_REG_TIMER0_CTRL, TIMER_CTRL_IE | TIMER_CTRL_NH); | 155 | write_aux_reg(ARC_REG_TIMER0_CTRL, TIMER_CTRL_IE | TIMER_CTRL_NH); |
@@ -168,6 +168,10 @@ static void arc_clkevent_set_mode(enum clock_event_mode mode, | |||
168 | { | 168 | { |
169 | switch (mode) { | 169 | switch (mode) { |
170 | case CLOCK_EVT_MODE_PERIODIC: | 170 | case CLOCK_EVT_MODE_PERIODIC: |
171 | /* | ||
172 | * At X Hz, 1 sec = 1000ms -> X cycles; | ||
173 | * 10ms -> X / 100 cycles | ||
174 | */ | ||
171 | arc_timer_event_setup(arc_get_core_freq() / HZ); | 175 | arc_timer_event_setup(arc_get_core_freq() / HZ); |
172 | break; | 176 | break; |
173 | case CLOCK_EVT_MODE_ONESHOT: | 177 | case CLOCK_EVT_MODE_ONESHOT: |
@@ -210,12 +214,6 @@ static irqreturn_t timer_irq_handler(int irq, void *dev_id) | |||
210 | return IRQ_HANDLED; | 214 | return IRQ_HANDLED; |
211 | } | 215 | } |
212 | 216 | ||
213 | static struct irqaction arc_timer_irq = { | ||
214 | .name = "Timer0 (clock-evt-dev)", | ||
215 | .flags = IRQF_TIMER | IRQF_PERCPU, | ||
216 | .handler = timer_irq_handler, | ||
217 | }; | ||
218 | |||
219 | /* | 217 | /* |
220 | * Setup the local event timer for @cpu | 218 | * Setup the local event timer for @cpu |
221 | */ | 219 | */ |
@@ -228,15 +226,9 @@ void arc_local_timer_setup() | |||
228 | clockevents_config_and_register(evt, arc_get_core_freq(), | 226 | clockevents_config_and_register(evt, arc_get_core_freq(), |
229 | 0, ARC_TIMER_MAX); | 227 | 0, ARC_TIMER_MAX); |
230 | 228 | ||
231 | /* | 229 | /* setup the per-cpu timer IRQ handler - for all cpus */ |
232 | * setup the per-cpu timer IRQ handler - for all cpus | 230 | arc_request_percpu_irq(TIMER0_IRQ, cpu, timer_irq_handler, |
233 | * For non boot CPU explicitly unmask at intc | 231 | "Timer0 (per-cpu-tick)", evt); |
234 | * setup_irq() -> .. -> irq_startup() already does this on boot-cpu | ||
235 | */ | ||
236 | if (!cpu) | ||
237 | setup_irq(TIMER0_IRQ, &arc_timer_irq); | ||
238 | else | ||
239 | arch_unmask_irq(TIMER0_IRQ); | ||
240 | } | 232 | } |
241 | 233 | ||
242 | /* | 234 | /* |