Skip to content

Commit 82dca61

Browse files
Andres Salomontorvalds
authored andcommitted
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>
1 parent 3c55494 commit 82dca61

5 files changed

Lines changed: 462 additions & 40 deletions

File tree

‎arch/x86/include/asm/geode.h‎

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,6 @@ extern int geode_get_dev_base(unsigned int dev);
4747

4848
#define MSR_DIVIL_SOFT_RESET 0x51400017
4949

50-
#define MSR_PIC_YSEL_LOW 0x51400020
51-
#define MSR_PIC_YSEL_HIGH 0x51400021
52-
#define MSR_PIC_ZSEL_LOW 0x51400022
53-
#define MSR_PIC_ZSEL_HIGH 0x51400023
54-
#define MSR_PIC_IRQM_LPC 0x51400025
55-
56-
#define MSR_MFGPT_IRQ 0x51400028
57-
#define MSR_MFGPT_NR 0x51400029
58-
#define MSR_MFGPT_SETUP 0x5140002B
59-
6050
#define MSR_LX_SPARE_MSR 0x80000011 /* DC-specific */
6151

6252
#define MSR_GX_GLD_MSR_CONFIG 0xC0002001
@@ -169,36 +159,6 @@ static inline int geode_has_vsa2(void)
169159
}
170160
#endif
171161

172-
/* MFGPTs */
173-
174-
#define MFGPT_MAX_TIMERS 8
175-
#define MFGPT_TIMER_ANY (-1)
176-
177-
#define MFGPT_DOMAIN_WORKING 1
178-
#define MFGPT_DOMAIN_STANDBY 2
179-
#define MFGPT_DOMAIN_ANY (MFGPT_DOMAIN_WORKING | MFGPT_DOMAIN_STANDBY)
180-
181-
#define MFGPT_CMP1 0
182-
#define MFGPT_CMP2 1
183-
184-
#define MFGPT_EVENT_IRQ 0
185-
#define MFGPT_EVENT_NMI 1
186-
#define MFGPT_EVENT_RESET 3
187-
188-
#define MFGPT_REG_CMP1 0
189-
#define MFGPT_REG_CMP2 2
190-
#define MFGPT_REG_COUNTER 4
191-
#define MFGPT_REG_SETUP 6
192-
193-
#define MFGPT_SETUP_CNTEN (1 << 15)
194-
#define MFGPT_SETUP_CMP2 (1 << 14)
195-
#define MFGPT_SETUP_CMP1 (1 << 13)
196-
#define MFGPT_SETUP_SETUP (1 << 12)
197-
#define MFGPT_SETUP_STOPEN (1 << 11)
198-
#define MFGPT_SETUP_EXTEN (1 << 10)
199-
#define MFGPT_SETUP_REVEN (1 << 5)
200-
#define MFGPT_SETUP_CLKSEL (1 << 4)
201-
202162
static inline void geode_mfgpt_write(int timer, u16 reg, u16 value)
203163
{
204164
u32 base = geode_get_dev_base(GEODE_DEV_MFGPT);

‎drivers/misc/Kconfig‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,30 @@ config SGI_XP
187187
this feature will allow for direct communication between SSIs
188188
based on a network adapter and DMA messaging.
189189

190+
config CS5535_MFGPT
191+
tristate "CS5535/CS5536 Geode Multi-Function General Purpose Timer (MFGPT) support"
192+
depends on PCI && !MGEODE_LX
193+
depends on X86
194+
default n
195+
help
196+
This driver provides access to MFGPT functionality for other
197+
drivers that need timers. MFGPTs are available in the CS5535 and
198+
CS5536 companion chips that are found in AMD Geode and several
199+
other platforms. They have a better resolution and max interval
200+
than the generic PIT, and are suitable for use as high-res timers.
201+
You probably don't want to enable this manually; other drivers that
202+
make use of it should enable it.
203+
204+
config CS5535_MFGPT_DEFAULT_IRQ
205+
int
206+
default 7
207+
help
208+
MFGPTs on the CS5535 require an interrupt. The selected IRQ
209+
can be overridden as a module option as well as by driver that
210+
use the cs5535_mfgpt_ API; however, different architectures might
211+
want to use a different IRQ by default. This is here for
212+
architectures to set as necessary.
213+
190214
config HP_ILO
191215
tristate "Channel interface driver for HP iLO/iLO2 processor"
192216
depends on PCI

‎drivers/misc/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o
1818
obj-$(CONFIG_KGDB_TESTS) += kgdbts.o
1919
obj-$(CONFIG_SGI_XP) += sgi-xp/
2020
obj-$(CONFIG_SGI_GRU) += sgi-gru/
21+
obj-$(CONFIG_CS5535_MFGPT) += cs5535-mfgpt.o
2122
obj-$(CONFIG_HP_ILO) += hpilo.o
2223
obj-$(CONFIG_ISL29003) += isl29003.o
2324
obj-$(CONFIG_EP93XX_PWM) += ep93xx_pwm.o

0 commit comments

Comments
 (0)