char: Add MFGPT driver for the CS5535/CS5536
RFC 1/1 char: Add MFGPT driver for the CS5535/CS5536
The Geode CS5535 and CS5536 companion chips contain a block of timers known as the Multi Function General Purpose Timers. The primary use for these timers is to control an output pin nominally connected to a LED or other visual indicator. They also can be configured to reset the system, which is handy as a watchdog timer. they _can_ be used to fire software interrupts on timeout too, but this is less useful since the timers are fairly low resolution and there are much better options available.
The attached driver provides a low-level interface to the block, and allows for other kernel drivers to use the timers. It also provides
the usual ioctl() and sysfs interfaces. Please review and comment
accordingly.
Thanks,
Jordan
Signature · 4 lines
Jordan Crouse Senior Linux Engineer Advanced Micro Devices, Inc. <www.amd.com/embeddedprocessors>
[PATCH] char: Add a MFGPT driver for the CS5535/CS5536
From: Jordan Crouse <[email protected]>
Add support for the MFPGT timers on the CS5535 and CS5536. The MFGPT timers provide special timers that can be used to fire interrupts, control output pins, or reset the system.
---
drivers/char/Kconfig | 9 drivers/char/Makefile | 1 drivers/char/mfgpt.c | 964 +++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/mfgpt.h | 95 +++++ 4 files changed, 1069 insertions(+), 0 deletions(-)
drivers/char/Kconfig +9 -0
@@ -1034,6 +1034,15 @@ config MMTIMER The mmtimer device allows direct userspace access to the Altix system timer. +config MFGPT + tristate "AMD Geode multi-purpose timers" + default m + depends on X86 && PCI + help + AMD Geode processors have several multi-purpose timers available. + Say Y here to define an API for other kernel drivers to use + the timers. + source "drivers/char/tpm/Kconfig" config TELCLOCK
drivers/char/Makefile +1 -0
@@ -90,6 +90,7 @@ obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o obj-$(CONFIG_TANBAC_TB0219) += tb0219.o obj-$(CONFIG_TELCLOCK) += tlclk.o +obj-$(CONFIG_MFGPT) += mfgpt.o obj-$(CONFIG_WATCHDOG) += watchdog/ obj-$(CONFIG_MWAVE) += mwave/
drivers/char/mfgpt.c new file +964 -0
964 lines not on this page · raw message
include/linux/mfgpt.h new file +95 -0
95 lines not on this page · raw message
Quoted 10 lines · On Wed, 22 Nov 2006 13:57:36 -0700 "Jordan Crouse" <[email protected]>…
The Geode CS5535 and CS5536 companion chips contain a block of timers known as the Multi Function General Purpose Timers. The primary use for these timers is to control an output pin nominally connected to a LED or other visual indicator. They also can be configured to reset the system, which is handy as a watchdog timer. they _can_ be used to fire software interrupts on timeout too, but this is less useful since the timers are fairly low resolution and there are much better options available.
The attached driver provides a low-level interface to the block, and allows for other kernel drivers to use the timers.
Three comments
1. Use inlines not defines when you can - it means we get type
checking
2. There is an RTC timer interface - could you use that interface
for some of this so its compatible and consistent ?
3. Ditto for a watchdog use - although that would be a separate
driver using the kernel hooks anyway.
Kernel side looks fairly sane
Quoted 7 lines · Alan
Quoted 2 lines
The attached driver provides a low-level interface to the block, and allows for other kernel drivers to use the timers.
Three comments
2. There is an RTC timer interface - could you use that interface
for some of this so its compatible and consistent ?
Do you mean, use the RTC interface itself (i.e. - turn the mfgpt driver into an RTC driver), or just emulate parts of the RTC interface in the
MFGPT driver. I would be fine with the second option - the first doesn't
really fit, since the only functionality the RTC and the MFGPT share is the periodic interrupt feature (which is sub-optimal on RTC anyway).
If the "timer interrupt" feature feels tacked on, thats because it is. The best use for the MFGPT block is to drive a duty cycle on the output pin suitable for LEDs and such. Most Geode customers would use it for that purpose. Running a close second on the usefulness scale is the watchdog timer - its always nice to have that sort of functionality available at the hardware level (and its a double bonus that the watchdog can be set up to continue running while in suspend).
The interrupt/NMI functionality was added to the hardware for the BIOS to use, and we added it to the kernel driver for a sense of completeness. I personally can't fathom anybody using the timers, and I would gladly remove them if nobody else can come up with a realistic usage model.
Quoted 2 lines
3. Ditto for a watchdog use - although that would be a separate
driver using the kernel hooks anyway.
That was the plan - I do have a watchdog driver that I had when I first wrote the MFGPT driver for a now defunct project. I should dust it off and add it in.
Thanks,
Jordan
Signature · 4 lines
Jordan Crouse Senior Linux Engineer Advanced Micro Devices, Inc. <www.amd.com/embeddedprocessors>