watchdog, gpio, soekris net5501 and more
Alex Hornung
ahornung at gmail.com
Sun Oct 4 06:26:59 PDT 2009
Hi,
I've just committed my soekris net5501 branch, on which I have been adding
support for this particular piece of hardware. The ported hardware drivers are:
* glxsb (Geode LX Security Block)
* nsclpcsio (A Super I/O chip with gpio and sensors)
* CS5536 and sc1100 geode (watchdog, timer and gpio for the companion chip
CS5536 and sc1100 cpu)
As a side effect to the above hardware drivers, I've also developed a watchdog
and gpio framework.
The watchdog framework is written completely from scratch but remains mostly
compatible from a userland point of view with OpenBSD's implementation. Major
difference is that the watchdog is reset from userland via ioctl and not sysctl.
I've also imported OpenBSD's watchdogd and modified to suit my watchdog
implementation, but as one can see, only few changes were needed. If anyone
wants to add support for some watchdog, best way to go about it is to check out
the pc32/i386/cs5536.c implementation of watchdogs.
By default, if watchdogs are enabled by the "options WATCHDOG_ENABLE" kernel
option, a timeout of 10 seconds is set and the kernel takes care of resetting
the watchdog. There's also an option "WDOG_DISABLE_ON_PANIC" which will disable
all watchdog timers on panic. This is useful so that the watchdog doesn't reset
the hardware in midst of a debugging session.
The two relevant sysctls are kern.watchdog.auto, which enables automatic
in-kernel reset of the watchdog, and kern.watchdog.period, which is used to set
the watchdog period.
The gpio (General Purpose I/O) framework is somewhat based on OpenBSD's,
maintaining a similar API and similar data structures to make porting of gpio
drivers and consumers as painless as possible. While the internals are quite
different, this should not difficult the porting process.
So far the gpio framework itself and a consumer, gpio_led, are available. The
cs5536 driver uses the gpio_led gpio consumer on net5501 as an example. As a
goodie there's also a "ERROR_LED_ON_PANIC" option, which, if enabled, will
search for a gpio_led called "error" and turn it on if a panic occurs.
I will also add a gpioctl userland utility at some point, but I didn't have the
time yet.
While both the watchdog and gpio frameworks have behaved well during my tests,
especially the gpio framework should be treated with care and only be used on
development machines. Please consider the gpio framework experimental.
I've tested compilation of both amd64 and x86 with these changes, and they don't
seem to break anything, but let me know if something went wrong!
Cheers,
Alex Hornung
More information about the Users
mailing list