blob: f088d63b92c705ebbe0b89cb9d3118647102d5e2 [file] [log] [blame]
Russell Kingbc282482009-05-17 18:58:34 +01001/*
2 * arch/arm/include/asm/localtimer.h
3 *
4 * Copyright (C) 2004-2005 ARM Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARM_LOCALTIMER_H
11#define __ASM_ARM_LOCALTIMER_H
12
Shawn Guobb1ac3e2011-10-06 14:57:24 +010013#include <linux/errno.h>
Marc Zyngier292b2932011-07-20 16:24:14 +010014#include <linux/interrupt.h>
Shawn Guobb1ac3e2011-10-06 14:57:24 +010015
Russell Kingbc282482009-05-17 18:58:34 +010016struct clock_event_device;
17
Marc Zyngier0ef330e2012-01-10 19:26:45 +000018struct local_timer_ops {
19 int (*setup)(struct clock_event_device *);
20 void (*stop)(struct clock_event_device *);
21};
22
Russell Kingbc282482009-05-17 18:58:34 +010023/*
24 * Setup a per-cpu timer, whether it be a local timer or dummy broadcast
25 */
26void percpu_timer_setup(void);
27
Russell Kingbc282482009-05-17 18:58:34 +010028#ifdef CONFIG_LOCAL_TIMERS
Russell Kingf32f4ce2009-05-16 12:14:21 +010029
30#ifdef CONFIG_HAVE_ARM_TWD
31
32#include "smp_twd.h"
33
Marc Zyngierabde7102012-01-10 19:07:28 +000034#endif
Russell Kingf32f4ce2009-05-16 12:14:21 +010035
Russell Kingbc282482009-05-17 18:58:34 +010036/*
Marc Zyngier28af6902011-07-22 12:52:37 +010037 * Stop the local timer
Russell Kingbc282482009-05-17 18:58:34 +010038 */
Marc Zyngier28af6902011-07-22 12:52:37 +010039void local_timer_stop(struct clock_event_device *);
Russell Kingbc282482009-05-17 18:58:34 +010040
Russell Kingbc282482009-05-17 18:58:34 +010041/*
42 * Setup a local timer interrupt for a CPU.
43 */
Santosh Shilimkaraf90f102011-02-23 18:53:15 +010044int local_timer_setup(struct clock_event_device *);
Russell Kingbc282482009-05-17 18:58:34 +010045
Marc Zyngier0ef330e2012-01-10 19:26:45 +000046/*
47 * Register a local timer driver
48 */
49int local_timer_register(struct local_timer_ops *);
50
Santosh Shilimkaraf90f102011-02-23 18:53:15 +010051#else
52
53static inline int local_timer_setup(struct clock_event_device *evt)
54{
55 return -ENXIO;
56}
Marc Zyngier28af6902011-07-22 12:52:37 +010057
58static inline void local_timer_stop(struct clock_event_device *evt)
59{
60}
Marc Zyngier0ef330e2012-01-10 19:26:45 +000061
62static inline int local_timer_register(struct local_timer_ops *ops)
63{
64 return -ENXIO;
65}
Russell Kingbc282482009-05-17 18:58:34 +010066#endif
67
68#endif