mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-03-24 04:08:00 +08:00
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: Chase Southwood <chase.southwood@yahoo.com> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
48cf60d164
commit
cef51fd887
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user