Add support for SB1 hardware watchdog.
Subsystems (2)
PATCH 1/1 Add support for SB1 hardware watchdog.
This patch is for watchdog timers built into SiByte MIPS SoCs.
--- drivers/watchdog/Kconfig | 13 ++ drivers/watchdog/sb_wdog.c | 369 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 382 insertions(+), 0 deletions(-)
drivers/watchdog/Kconfig +13 -0
@@ -616,6 +616,19 @@ config AR7_WDT help Hardware driver for the TI AR7 Watchdog Timer. +config SIBYTE_WDOG + tristate "Sibyte SoC hardware watchdog" + depends on CPU_SB1 + help + Watchdog driver for the built in watchdog hardware in Sibyte + SoC processors. There are apparently two watchdog timers + on such processors; this driver supports only the first one, + because currently Linux only supports exporting one watchdog + to userspace. + + To compile this driver as a loadable module, choose M here. + The module will be called sb_wdog. + # PARISC Architecture # POWERPC Architecture
drivers/watchdog/sb_wdog.c new file +369 -0
369 lines not on this page · raw message
Signature · 1 line
1.4.4.4
drivers/watchdog/Kconfig config AR7_WDT · line 627
Quoted 3 lines
drivers/watchdog/Kconfig +3
-0+ on such processors; this driver supports only the first one, + because currently Linux only supports exporting one watchdog + to userspace.
Yep. Perhaps that should change.
drivers/watchdog/sb_wdog.c line 71
Quoted 8 lines
+ * wdog is the iomem address of the cfg register
+ */
+ voiddrivers/watchdog/sb_wdog.c new file +5
-0+sbwdog_set(char __iomem *wdog, unsigned long t) +{ +__raw_writeb (0 , wdog -0x10 ); +__raw_writeq (t &0x7fffffUL , wdog); +}
What guarantees you don't get a pair of these calls at once or interleaving ?
drivers/watchdog/sb_wdog.c line 191
Quoted 3 lines
drivers/watchdog/sb_wdog.c new file +3
-0+* return the bits from the config register +*/ + ret =put_user (__raw_readb (user_dog), p);
Should return the translated status bits ?
Alan
Quoted 7 lines · On Mon, 3 Dec 2007 18:34:19 +0000 Alan Cox <[email protected]> wrote:
drivers/watchdog/Kconfig config AR7_WDT · line 627
Quoted 5 lines
(quoted diff) +1
-0+ on such processors; this driver supports only the firstone,
(quoted diff) +1
-0+ because currently Linux only supports exporting onewatchdog
drivers/watchdog/Kconfig +1
-0+ to userspace.Yep. Perhaps that should change.
I thought about that just a little; I'm just not sure what it would mean to have multiple watchdog devices.
Quoted 11 lines
drivers/watchdog/sb_wdog.c line 71
Quoted 8 lines
+ * wdog is the iomem address of the cfg register
+ */
+ voiddrivers/watchdog/sb_wdog.c new file +5
-0+sbwdog_set(char __iomem *wdog, unsigned long t) +{ +__raw_writeb (0 , wdog -0x10 ); +__raw_writeq (t &0x7fffffUL , wdog); +}What guarantees you don't get a pair of these calls at once or interleaving ?
Not much, I suppose, except that opening the device file is exclusive. A thread could fork (or dup) after that and get crazy in a theoretical scenario ... are you suggesting this be serialized?
Quoted 7 lines
drivers/watchdog/sb_wdog.c line 191
Quoted 5 lines
drivers/watchdog/sb_wdog.c new file +3
-0+* return the bits from the config register +*/ + ret =put_user (__raw_readb (user_dog), p);Should return the translated status bits ?
Don't need this really. I see a few more things that need cleaning up so I will do that and submit another patch. And with changing of the directory up a level, I also forgot the makefile change.
Quoted 3 lines
Alan
drivers/watchdog/Kconfig config AR7_WDT · line 627
Quoted 5 lines · Andrew Sharp
drivers/watchdog/Kconfig +5
-0+ Watchdog driver for the built in watchdog hardware in Sibyte + SoC processors. There are apparently two watchdog timers + on such processors; this driver supports only the first one, + because currently Linux only supports exporting one watchdog + to userspace.
And even four watchdogs in the BCM1480.
You'd think they'd trust their hardware more than that ;-)
Quoted 9 lines
+ * This driver is intended to make the second of two hardware watchdogs
+ * on the Sibyte 12XX and 11XX SoCs available to the user. There are two
+ * such devices available on the SoC, but it seems that there isn't an
+ * enumeration class for watchdogs in Linux like there is for RTCs.
+ * The second is used rather than the first because it uses IRQ 1,
+ * thereby avoiding all that IRQ 0 problematic nonsense.
+ *
+ * I have not tried this driver on a 1480 processor; it might work
+ * just well enough to really screw things up.
Four rather similar watchdogs using four interrupts also.
Quoted 9 lines
+ * It is a simple timer, and there is an interrupt that is raised the
+ * first time the timer expires. The second time it expires, the chip
+ * is reset and there is no way to redirect that NMI. Which could
+ * be problematic in some cases where this chip is sitting on the HT
+ * bus and has just taken responsibility for providing a cache block.
+ * Since the reset can't be redirected to the external reset pin, it is
+ * possible that other HT connected processors might hang and not reset.
+ * For Linux, a soft reset would probably be even worse than a hard reset.
+ * There you have it.
If read requests are never returned eventually the ZB bus HT host bridge will run out of buffers after the 16th request. The CPU has four more buffers so the 21st read will stall the CPU's execution. About a milisecond later the machine check exception will make the CPU resume execution. But at this stage some registers are marked busy in the register scoreboard and any reference to those CPU registers will cause the CPU to hang again ... until the next machine check. Game over, press button to continue.
Quoted 3 lines
+ * The timer takes 23 bits of a 64 bit register (?) as a count value,
+ * and decrements the count every microsecond, for a max value of
+ *0x7fffffusec or about 8.3ish seconds.
One off - the maximum time is 0x800000µs.
Ralf
Quoted 11 lines · Ralf Baechle
drivers/watchdog/Kconfig config AR7_WDT · line 627
Quoted 5 lines · Andrew Sharp
drivers/watchdog/Kconfig +5
-0+ Watchdog driver for the built in watchdog hardware in Sibyte + SoC processors. There are apparently two watchdog timers + on such processors; this driver supports only the first one, + because currently Linux only supports exporting one watchdog + to userspace.And even four watchdogs in the BCM1480.
You'd think they'd trust their hardware more than that ;-)
Maybe the dogs can be daisy-chained together. After all, who watches the watcher? And who watches him?
Did I ever tell you how lucky you are?
Quoted 11 lines · Ralf Baechle
drivers/watchdog/Kconfig config AR7_WDT · line 627
Quoted 5 lines · Andrew Sharp
drivers/watchdog/Kconfig +5
-0+ Watchdog driver for the built in watchdog hardware in Sibyte + SoC processors. There are apparently two watchdog timers + on such processors; this driver supports only the first one, + because currently Linux only supports exporting one watchdog + to userspace.And even four watchdogs in the BCM1480.
You'd think they'd trust their hardware more than that ;-)
Maybe the dogs can be daisy-chained together. After all, who watches the watcher? And who watches him?
Did I ever tell you how lucky you are?