Commit cef51fd8 authored by Chase Southwood's avatar Chase Southwood Committed by Greg Kroah-Hartman

Staging: comedi: addi-data: tidy up watchdog register

This patch for fixes the register map defines for the watchdog registers
such that they are all the real offsets to each register, rather than a
mix of real offsets and adders to those offsets.
Signed-off-by: default avatarChase Southwood <chase.southwood@yahoo.com>
Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 48cf60d1
......@@ -65,7 +65,6 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
#define ADDIDATA_TIMER 0
#define ADDIDATA_COUNTER 1
#define ADDIDATA_WATCHDOG 2
#define APCI1564_DIGITAL_OP_WATCHDOG 0x28
#define APCI1564_TIMER 0x48
#define APCI1564_COUNTER1 0x0
#define APCI1564_COUNTER2 0x20
......@@ -92,6 +91,14 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
#define APCI1564_DO_INT_CTRL_REG 0x1c
#define APCI1564_DO_INT_STATUS_REG 0x20
#define APCI1564_DO_IRQ_REG 0x24
#define APCI1564_WDOG_REG 0x28
#define APCI1564_WDOG_RELOAD_REG 0x2c
#define APCI1564_WDOG_TIMEBASE_REG 0x30
#define APCI1564_WDOG_CTRL_REG 0x34
#define APCI1564_WDOG_STATUS_REG 0x38
#define APCI1564_WDOG_IRQ_REG 0x3c
#define APCI1564_WDOG_WARN_TIMEVAL_REG 0x40
#define APCI1564_WDOG_WARN_TIMEBASE_REG 0x44
/* Global variables */
static unsigned int ui_InterruptStatus_1564;
......@@ -285,13 +292,9 @@ static int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev,
devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG;
/* Disable the watchdog */
outl(0x0,
devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG +
APCI1564_TCW_PROG);
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_WDOG_CTRL_REG);
/* Loading the Reload value */
outl(data[3],
devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG +
APCI1564_TCW_RELOAD_VALUE);
outl(data[3], devpriv->i_IobaseAmcc + APCI1564_WDOG_RELOAD_REG);
} else if (data[0] == ADDIDATA_TIMER) {
/* First Stop The Timer */
ul_Command1 =
......@@ -305,10 +308,7 @@ static int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev,
outl(0x02, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); /* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DI_IRQ_REG);
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DO_IRQ_REG);
outl(0x0,
devpriv->i_IobaseAmcc +
APCI1564_DIGITAL_OP_WATCHDOG +
APCI1564_TCW_IRQ);
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_WDOG_IRQ_REG);
outl(0x0,
devpriv->iobase + APCI1564_COUNTER1 +
APCI1564_TCW_IRQ);
......@@ -427,19 +427,14 @@ static int i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device *d
if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
switch (data[1]) {
case 0: /* stop the watchdog */
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_PROG); /* disable the watchdog */
/* disable the watchdog */
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_WDOG_CTRL_REG);
break;
case 1: /* start the watchdog */
outl(0x0001,
devpriv->i_IobaseAmcc +
APCI1564_DIGITAL_OP_WATCHDOG +
APCI1564_TCW_PROG);
outl(0x0001, devpriv->i_IobaseAmcc + APCI1564_WDOG_CTRL_REG);
break;
case 2: /* Software trigger */
outl(0x0201,
devpriv->i_IobaseAmcc +
APCI1564_DIGITAL_OP_WATCHDOG +
APCI1564_TCW_PROG);
outl(0x0201, devpriv->i_IobaseAmcc + APCI1564_WDOG_CTRL_REG);
break;
default:
dev_err(dev->class_dev, "Specified functionality does not exist.\n");
......@@ -522,13 +517,8 @@ static int i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device *dev,
if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) {
/* Stores the status of the Watchdog */
data[0] =
inl(devpriv->i_IobaseAmcc +
APCI1564_DIGITAL_OP_WATCHDOG +
APCI1564_TCW_TRIG_STATUS) & 0x1;
data[1] =
inl(devpriv->i_IobaseAmcc +
APCI1564_DIGITAL_OP_WATCHDOG);
data[0] = inl(devpriv->i_IobaseAmcc + APCI1564_WDOG_STATUS_REG) & 0x1;
data[1] = inl(devpriv->i_IobaseAmcc + APCI1564_WDOG_REG);
} else if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) {
/* Stores the status of the Timer */
data[0] =
......@@ -803,9 +793,7 @@ static int i_APCI1564_Reset(struct comedi_device *dev)
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DO_REG);
/* Disables the interrupt. */
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DO_INT_CTRL_REG);
outl(0x0,
devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG +
APCI1564_TCW_RELOAD_VALUE);
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_WDOG_RELOAD_REG);
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_TIMER);
outl(0x0, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment