Re: [RFC][POWERPC] WDT: added support for the WDT Chain driver.

2009-09-02 Thread Detlev Zundel
Hello Vitaly,

 From: Heiko Schocher h...@denx.de

 [POWERPC] WDT: added support for the WDT Chain driver.

 This new driver implements a character device with major number 10
 and minor number 130.  It is a software abstraction of the hardware
 watchdog with two different APIs.  While the driver periodically
 triggers the hardware watchdog, the software can setup independent
 timeout periods.

 More info in Documentation/watchdog/wdt_chain.txt

 Signed-off-by: Heiko Schocher h...@denx.de
 Signed-off-by: Vitaly Bordug v...@kernel.crashing.org
 ---
 This code was (and is) originally residing in DENX public git repo. I
 think it would be useful upstream, to prevent reinventing the same
 thing. 

Thanks a lot for taking an interest in this piece of code.  I would
suggest however that you coordinate with Heiko as he has worked some
more on this driver in the meantime.  This new code however is not in
our repository.  We should start the RFC discussion with current code.

For the casual reader this means, don't invest time into reviewing this
but wait for a cleaned up version instead.

Thanks
  Detlev

--
DENX Software Engineering GmbH,  MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[RFC][POWERPC] WDT: added support for the WDT Chain driver.

2009-09-01 Thread Vitaly Bordug

From: Heiko Schocher h...@denx.de

[POWERPC] WDT: added support for the WDT Chain driver.

This new driver implements a character device with major number 10
and minor number 130.  It is a software abstraction of the hardware
watchdog with two different APIs.  While the driver periodically
triggers the hardware watchdog, the software can setup independent
timeout periods.

More info in Documentation/watchdog/wdt_chain.txt

Signed-off-by: Heiko Schocher h...@denx.de
Signed-off-by: Vitaly Bordug v...@kernel.crashing.org
---
This code was (and is) originally residing in DENX public git repo. I
think it would be useful upstream, to prevent reinventing the same
thing. 

The BSP files are optional but included so that to keep consistency
with original patch. Direct immr dereference will not work now of
course, but I'd like to know if the entire idea and common stuff look
OK for mainline, before adding anything ontop.

TIA

 Documentation/watchdog/00-INDEX  |2 
 Documentation/watchdog/wdt_chain.txt |  200 ++
 drivers/watchdog/Kconfig |   11 
 drivers/watchdog/Makefile|3 
 drivers/watchdog/wdt_chain_hwl_mpc82xx.c |  102 +++
 drivers/watchdog/wdt_chain_hwl_mpc8xx.c  |  148 
 drivers/watchdog/wdt_chains.c| 1013
 ++
 include/linux/wdt_chains.h   |  102 +++ 8 files changed,
 1581 insertions(+), 0 deletions(-) create mode 100644
 Documentation/watchdog/wdt_chain.txt create mode 100644
 drivers/watchdog/wdt_chain_hwl_mpc82xx.c create mode 100644
 drivers/watchdog/wdt_chain_hwl_mpc8xx.c create mode 100644
 drivers/watchdog/wdt_chains.c create mode 100644
 include/linux/wdt_chains.h


diff --git a/Documentation/watchdog/00-INDEX
b/Documentation/watchdog/00-INDEX index c3ea47e..f8e1ad7 100644
--- a/Documentation/watchdog/00-INDEX
+++ b/Documentation/watchdog/00-INDEX
@@ -8,3 +8,5 @@ watchdog-api.txt
- description of the Linux Watchdog driver API.
 wdt.txt
- description of the Watchdog Timer Interfaces for Linux.
+wdt_chain.txt
+   - description of the Watchdog Chain Timer Interfaces for Linux.
diff --git a/Documentation/watchdog/wdt_chain.txt
b/Documentation/watchdog/wdt_chain.txt new file mode 100644
index 000..78cf4cb
--- /dev/null
+++ b/Documentation/watchdog/wdt_chain.txt
@@ -0,0 +1,200 @@
+Last Reviewed: 29/08/2008
+
+   WDT Watchdog CHAIN Timer Interfaces For The Linux Operating
System
+   Heiko Schocher h...@denx.de
+
+driver implements a character device with major number 10 and minor
+number 130.  It is a software abstraction of the hardware watchdog
+with two different APIs.  While the driver periodically triggers the
+hardware watchdog, the software can setup independent timeout periods.
+
+REGULAR API
+The regular API provides a facility to setup a watchdog behaviour
+shared by all processes using the driver.  This interface uses read(2),
+write(2) and the first two ioctl(2) calls listed below.  The
+parameterless ioctl(2) calls select the operational mode of the
+driver, which can be
+   open-only
+or
+   always.
+
+In open-only mode, the watchdog will not expire if the device file is
+not opened by any process, while in always mode the behaviour is
+independent of the device file being opened.
+
+Reading from the device file will return an unsigned integer denoting
+the number of seconds left till the watchdog expires.  Writing an
+unsigned integer to the device file will set the expiration period in
+seconds.  Note that the hardware watchdog will be triggered
+independently with a configurable period.  See the section
+CONFIGURATION for details.
+
+An expiration of the watchdog will trigger a hard-reset of the machine.
+
+CHAIN API
+The second API, which is implemented only through calls to ioctl(2),
+can be used to register configurable
+   watchdog chains
+from either user or kernel space.  A watchdog chain is identified by
+an unsigned integer and can contain up to three action stages.
+
+time intervalin seconds and an action
+
+is associated with each stage.  When the chain is not reset before the
+interval elapses, the associated action is triggered and the chain
+moves on to the next stage.
+
+A chain can request to kill the registering process if the interval
+elapses.  In this case a restarted process can register with the
+driver giving the same identifier and reset the chain.  This is the
+main reason why there is no association between chains and processes
+or open device files.
+
+For a detailed description of the possible chain configurations, see
+the description of the WDT_CHAIN_REGISTER ioctl call.
+
+Note that when mixing the two interfaces, the second API takes
+precedence.  That is, expiry of the interval set by writing to the
+device file while a chain is registered, will not trigger any actions.
+
+Also note that the default operational mode of the driver,
+i.e. open-only or always can