From: H Hartley Sweeten Date: Mon, 10 Nov 2014 23:20:21 +0000 (-0700) Subject: staging: comedi: addi_watchdog: use addi_tcw.h defines for watchdog X-Git-Tag: v3.19-rc1~66^2~157 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a3e0316c1648825dcadb4f779cba14b9ddc00a71;p=karo-tx-linux.git staging: comedi: addi_watchdog: use addi_tcw.h defines for watchdog Use the generic TCW (timer/counter/watchdog) defines for the 8-bit watchdog. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/addi_watchdog.c b/drivers/staging/comedi/drivers/addi_watchdog.c index 0af141ab39fc..c5b082d4e51e 100644 --- a/drivers/staging/comedi/drivers/addi_watchdog.c +++ b/drivers/staging/comedi/drivers/addi_watchdog.c @@ -20,21 +20,9 @@ #include #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);