diff options
author | Andres Salomon <dilinger@queued.net> | 2007-10-12 17:04:06 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@inhelltoy.tec.linutronix.de> | 2007-10-12 17:04:06 -0400 |
commit | 83d7384f8d4aa216b49cf9cb286ea743054b119f (patch) | |
tree | 9f56bf83bbbb0dc7056c3dd5e11b1d0ab0d4cefb /include/asm-x86/geode.h | |
parent | 5fa3a246ea2e1be2ffaa01343bc183c8c0bfa472 (diff) |
x86: Geode Multi-Function General Purpose Timers support
This adds support for Multi-Function General Purpose Timers. It detects the
available timers during southbridge init, and provides an API for allocating
and setting the timers. They're higher resolution than the standard PIT, so
the MFGPTs come in handy for quite a few things.
Note that we never clobber the timers that the BIOS might have opted to use;
we just check for unused timers.
Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Signed-off-by: Andres Salomon <dilinger@debian.org>
Cc: Andi Kleen <ak@suse.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/geode.h')
-rw-r--r-- | include/asm-x86/geode.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/include/asm-x86/geode.h b/include/asm-x86/geode.h index 6da4bbbea3dc..d94898831bac 100644 --- a/include/asm-x86/geode.h +++ b/include/asm-x86/geode.h | |||
@@ -156,4 +156,54 @@ static inline int is_geode(void) | |||
156 | return (is_geode_gx() || is_geode_lx()); | 156 | return (is_geode_gx() || is_geode_lx()); |
157 | } | 157 | } |
158 | 158 | ||
159 | /* MFGPTs */ | ||
160 | |||
161 | #define MFGPT_MAX_TIMERS 8 | ||
162 | #define MFGPT_TIMER_ANY -1 | ||
163 | |||
164 | #define MFGPT_DOMAIN_WORKING 1 | ||
165 | #define MFGPT_DOMAIN_STANDBY 2 | ||
166 | #define MFGPT_DOMAIN_ANY (MFGPT_DOMAIN_WORKING | MFGPT_DOMAIN_STANDBY) | ||
167 | |||
168 | #define MFGPT_CMP1 0 | ||
169 | #define MFGPT_CMP2 1 | ||
170 | |||
171 | #define MFGPT_EVENT_IRQ 0 | ||
172 | #define MFGPT_EVENT_NMI 1 | ||
173 | #define MFGPT_EVENT_RESET 3 | ||
174 | |||
175 | #define MFGPT_REG_CMP1 0 | ||
176 | #define MFGPT_REG_CMP2 2 | ||
177 | #define MFGPT_REG_COUNTER 4 | ||
178 | #define MFGPT_REG_SETUP 6 | ||
179 | |||
180 | #define MFGPT_SETUP_CNTEN (1 << 15) | ||
181 | #define MFGPT_SETUP_CMP2 (1 << 14) | ||
182 | #define MFGPT_SETUP_CMP1 (1 << 13) | ||
183 | #define MFGPT_SETUP_SETUP (1 << 12) | ||
184 | #define MFGPT_SETUP_STOPEN (1 << 11) | ||
185 | #define MFGPT_SETUP_EXTEN (1 << 10) | ||
186 | #define MFGPT_SETUP_REVEN (1 << 5) | ||
187 | #define MFGPT_SETUP_CLKSEL (1 << 4) | ||
188 | |||
189 | static inline void geode_mfgpt_write(int timer, u16 reg, u16 value) | ||
190 | { | ||
191 | u32 base = geode_get_dev_base(GEODE_DEV_MFGPT); | ||
192 | outw(value, base + reg + (timer * 8)); | ||
193 | } | ||
194 | |||
195 | static inline u16 geode_mfgpt_read(int timer, u16 reg) | ||
196 | { | ||
197 | u32 base = geode_get_dev_base(GEODE_DEV_MFGPT); | ||
198 | return inw(base + reg + (timer * 8)); | ||
199 | } | ||
200 | |||
201 | extern int __init geode_mfgpt_detect(void); | ||
202 | extern int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable); | ||
203 | extern int geode_mfgpt_set_irq(int timer, int cmp, int irq, int enable); | ||
204 | extern int geode_mfgpt_alloc_timer(int timer, int domain, struct module *owner); | ||
205 | |||
206 | #define geode_mfgpt_setup_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 1) | ||
207 | #define geode_mfgpt_release_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 0) | ||
208 | |||
159 | #endif | 209 | #endif |