aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/cs5535.h
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@collabora.co.uk>2009-12-14 21:00:37 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-15 11:53:28 -0500
commit82dca611bb516ec5fb7d04077733d6a4b70f52d1 (patch)
tree67e085277bcc06e0aa7bf305e586ce856ef11078 /include/linux/cs5535.h
parent3c55494670745e523f69b56edb66ca0b50a470c2 (diff)
cs5535: add a generic MFGPT driver
This is based on the old code on arch/x86/kernel/mfgpt_32.c, except it's not x86 specific, it's modular, and it makes use of a PCI BAR rather than a random MSR. Currently module unloading is not supported; it's uncertain whether or not it can be made work with the hardware. [akpm@linux-foundation.org: add X86 dependency] Signed-off-by: Andres Salomon <dilinger@collabora.co.uk> Cc: Jordan Crouse <jordan@cosmicpenguin.net> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: john stultz <johnstul@us.ibm.com> Cc: Chris Ball <cjb@laptop.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/cs5535.h')
-rw-r--r--include/linux/cs5535.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/include/linux/cs5535.h b/include/linux/cs5535.h
index cfea689dfa34..30ecb04fa570 100644
--- a/include/linux/cs5535.h
+++ b/include/linux/cs5535.h
@@ -18,6 +18,16 @@
18#define MSR_LBAR_ACPI 0x5140000E 18#define MSR_LBAR_ACPI 0x5140000E
19#define MSR_LBAR_PMS 0x5140000F 19#define MSR_LBAR_PMS 0x5140000F
20 20
21#define MSR_PIC_YSEL_LOW 0x51400020
22#define MSR_PIC_YSEL_HIGH 0x51400021
23#define MSR_PIC_ZSEL_LOW 0x51400022
24#define MSR_PIC_ZSEL_HIGH 0x51400023
25#define MSR_PIC_IRQM_LPC 0x51400025
26
27#define MSR_MFGPT_IRQ 0x51400028
28#define MSR_MFGPT_NR 0x51400029
29#define MSR_MFGPT_SETUP 0x5140002B
30
21/* resource sizes */ 31/* resource sizes */
22#define LBAR_GPIO_SIZE 0xFF 32#define LBAR_GPIO_SIZE 0xFF
23#define LBAR_MFGPT_SIZE 0x40 33#define LBAR_MFGPT_SIZE 0x40
@@ -55,4 +65,61 @@ void cs5535_gpio_set(unsigned offset, unsigned int reg);
55void cs5535_gpio_clear(unsigned offset, unsigned int reg); 65void cs5535_gpio_clear(unsigned offset, unsigned int reg);
56int cs5535_gpio_isset(unsigned offset, unsigned int reg); 66int cs5535_gpio_isset(unsigned offset, unsigned int reg);
57 67
68/* MFGPTs */
69
70#define MFGPT_MAX_TIMERS 8
71#define MFGPT_TIMER_ANY (-1)
72
73#define MFGPT_DOMAIN_WORKING 1
74#define MFGPT_DOMAIN_STANDBY 2
75#define MFGPT_DOMAIN_ANY (MFGPT_DOMAIN_WORKING | MFGPT_DOMAIN_STANDBY)
76
77#define MFGPT_CMP1 0
78#define MFGPT_CMP2 1
79
80#define MFGPT_EVENT_IRQ 0
81#define MFGPT_EVENT_NMI 1
82#define MFGPT_EVENT_RESET 3
83
84#define MFGPT_REG_CMP1 0
85#define MFGPT_REG_CMP2 2
86#define MFGPT_REG_COUNTER 4
87#define MFGPT_REG_SETUP 6
88
89#define MFGPT_SETUP_CNTEN (1 << 15)
90#define MFGPT_SETUP_CMP2 (1 << 14)
91#define MFGPT_SETUP_CMP1 (1 << 13)
92#define MFGPT_SETUP_SETUP (1 << 12)
93#define MFGPT_SETUP_STOPEN (1 << 11)
94#define MFGPT_SETUP_EXTEN (1 << 10)
95#define MFGPT_SETUP_REVEN (1 << 5)
96#define MFGPT_SETUP_CLKSEL (1 << 4)
97
98struct cs5535_mfgpt_timer;
99
100extern uint16_t cs5535_mfgpt_read(struct cs5535_mfgpt_timer *timer,
101 uint16_t reg);
102extern void cs5535_mfgpt_write(struct cs5535_mfgpt_timer *timer, uint16_t reg,
103 uint16_t value);
104
105extern int cs5535_mfgpt_toggle_event(struct cs5535_mfgpt_timer *timer, int cmp,
106 int event, int enable);
107extern int cs5535_mfgpt_set_irq(struct cs5535_mfgpt_timer *timer, int cmp,
108 int *irq, int enable);
109extern struct cs5535_mfgpt_timer *cs5535_mfgpt_alloc_timer(int timer,
110 int domain);
111extern void cs5535_mfgpt_free_timer(struct cs5535_mfgpt_timer *timer);
112
113static inline int cs5535_mfgpt_setup_irq(struct cs5535_mfgpt_timer *timer,
114 int cmp, int *irq)
115{
116 return cs5535_mfgpt_set_irq(timer, cmp, irq, 1);
117}
118
119static inline int cs5535_mfgpt_release_irq(struct cs5535_mfgpt_timer *timer,
120 int cmp, int *irq)
121{
122 return cs5535_mfgpt_set_irq(timer, cmp, irq, 0);
123}
124
58#endif 125#endif