]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: comedi: addi_watchdog: use addi_tcw.h defines for watchdog
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 10 Nov 2014 23:20:21 +0000 (16:20 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Nov 2014 23:31:34 +0000 (15:31 -0800)
Use the generic TCW (timer/counter/watchdog) defines for the 8-bit watchdog.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/addi_watchdog.c

index 0af141ab39fcb9a89fc1dd8dd70b40c4f0a672d5..c5b082d4e51e3ccce736af728d8a5e17d6dfb5f0 100644 (file)
 
 #include <linux/module.h>
 #include "../comedidev.h"
+#include "addi_tcw.h"
 #include "addi_watchdog.h"
 
-/*
- * Register offsets/defines for the addi-data watchdog
- */
-#define ADDI_WDOG_REG                  0x00
-#define ADDI_WDOG_RELOAD_REG           0x04
-#define ADDI_WDOG_TIMEBASE             0x08
-#define ADDI_WDOG_CTRL_REG             0x0c
-#define ADDI_WDOG_CTRL_ENABLE          (1 << 0)
-#define ADDI_WDOG_CTRL_SW_TRIG         (1 << 9)
-#define ADDI_WDOG_STATUS_REG           0x10
-#define ADDI_WDOG_STATUS_ENABLED       (1 << 0)
-#define ADDI_WDOG_STATUS_SW_TRIG       (1 << 1)
-
 struct addi_watchdog_private {
        unsigned long iobase;
        unsigned int wdog_ctrl;
@@ -60,9 +48,9 @@ static int addi_watchdog_insn_config(struct comedi_device *dev,
 
        switch (data[0]) {
        case INSN_CONFIG_ARM:
-               spriv->wdog_ctrl = ADDI_WDOG_CTRL_ENABLE;
+               spriv->wdog_ctrl = ADDI_TCW_CTRL_ENA;
                reload = data[1] & s->maxdata;
-               outl(reload, spriv->iobase + ADDI_WDOG_RELOAD_REG);
+               outl(reload, spriv->iobase + ADDI_TCW_RELOAD_REG);
 
                /* Time base is 20ms, let the user know the timeout */
                dev_info(dev->class_dev, "watchdog enabled, timeout:%dms\n",
@@ -75,7 +63,7 @@ static int addi_watchdog_insn_config(struct comedi_device *dev,
                return -EINVAL;
        }
 
-       outl(spriv->wdog_ctrl, spriv->iobase + ADDI_WDOG_CTRL_REG);
+       outl(spriv->wdog_ctrl, spriv->iobase + ADDI_TCW_CTRL_REG);
 
        return insn->n;
 }
@@ -89,7 +77,7 @@ static int addi_watchdog_insn_read(struct comedi_device *dev,
        int i;
 
        for (i = 0; i < insn->n; i++)
-               data[i] = inl(spriv->iobase + ADDI_WDOG_STATUS_REG);
+               data[i] = inl(spriv->iobase + ADDI_TCW_STATUS_REG);
 
        return insn->n;
 }
@@ -109,8 +97,8 @@ static int addi_watchdog_insn_write(struct comedi_device *dev,
 
        /* "ping" the watchdog */
        for (i = 0; i < insn->n; i++) {
-               outl(spriv->wdog_ctrl | ADDI_WDOG_CTRL_SW_TRIG,
-                    spriv->iobase + ADDI_WDOG_CTRL_REG);
+               outl(spriv->wdog_ctrl | ADDI_TCW_CTRL_TRIG,
+                    spriv->iobase + ADDI_TCW_CTRL_REG);
        }
 
        return insn->n;
@@ -118,8 +106,8 @@ static int addi_watchdog_insn_write(struct comedi_device *dev,
 
 void addi_watchdog_reset(unsigned long iobase)
 {
-       outl(0x0, iobase + ADDI_WDOG_CTRL_REG);
-       outl(0x0, iobase + ADDI_WDOG_RELOAD_REG);
+       outl(0x0, iobase + ADDI_TCW_CTRL_REG);
+       outl(0x0, iobase + ADDI_TCW_RELOAD_REG);
 }
 EXPORT_SYMBOL_GPL(addi_watchdog_reset);