]> Pileus Git - ~andy/linux/commitdiff
staging: comedi: ni_at_ao: use 8253.h helpers
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 1 Oct 2013 00:52:32 +0000 (17:52 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Oct 2013 21:04:49 +0000 (14:04 -0700)
To better document the code, use the 8254.h helpers to set the
timers instead of doing the outb() instructions.

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/ni_at_ao.c

index d18aaf1f439211e59fc23fd2c0195261e9b4877b..fed82f886d9823446c0fd37b3c964a39e9d013e2 100644 (file)
@@ -37,8 +37,11 @@ Configuration options:
  */
 
 #include <linux/module.h>
+
 #include "../comedidev.h"
 
+#include "8253.h"
+
 /*
  * Register map
  */
@@ -60,34 +63,7 @@ Configuration options:
 #define ATAO_CFG3_DOUTEN1      (1 << 2)
 #define ATAO_CFG3_EN2_5V       (1 << 1)
 #define ATAO_CFG3_SCANEN       (1 << 0)
-#define ATAO_82C53_BASE                0x06    /* RW 8 */
-#define ATAO_82C53_CNTR1       0x06    /* RW 8 */
-#define ATAO_82C53_CNTR2       0x07    /* RW 8 */
-#define ATAO_82C53_CNTR3       0x08    /* RW 8 */
-#define ATAO_82C53_CNTRCMD     0x09    /* W 8 */
-#define CNTRSEL1               (1 << 7)
-#define CNTRSEL0               (1 << 6)
-#define RWSEL1                 (1 << 5)
-#define RWSEL0                 (1 << 4)
-#define MODESEL2               (1 << 3)
-#define MODESEL1               (1 << 2)
-#define MODESEL0               (1 << 1)
-#define BCDSEL                 (1 << 0)
-  /* read-back command */
-#define COUNT                  (1 << 5)
-#define STATUS                 (1 << 4)
-#define CNTR3                  (1 << 3)
-#define CNTR2                  (1 << 2)
-#define CNTR1                  (1 << 1)
-  /* status */
-#define OUT                    (1 << 7)
-#define _NULL                  (1 << 6)
-#define RW1                    (1 << 5)
-#define RW0                    (1 << 4)
-#define MODE2                  (1 << 3)
-#define MODE1                  (1 << 2)
-#define MODE0                  (1 << 1)
-#define BCD                    (1 << 0)
+#define ATAO_82C53_BASE                0x06
 #define ATAO_CFG1_REG          0x0a
 #define ATAO_CFG1_EXTINT2EN    (1 << 15)
 #define ATAO_CFG1_EXTINT1EN    (1 << 14)
@@ -153,9 +129,11 @@ static void atao_reset(struct comedi_device *dev)
        devpriv->cfg1 = 0;
        outw(devpriv->cfg1, dev->iobase + ATAO_CFG1_REG);
 
-       outb(RWSEL0 | MODESEL2, dev->iobase + ATAO_82C53_CNTRCMD);
-       outb(0x03, dev->iobase + ATAO_82C53_CNTR1);
-       outb(CNTRSEL0 | RWSEL0 | MODESEL2, dev->iobase + ATAO_82C53_CNTRCMD);
+       /* Put outputs of counter 1 and counter 2 in a high state */
+       i8254_load(dev->iobase + ATAO_82C53_BASE, 0,
+                  0, 0x0003, I8254_MODE4 | I8254_BINARY);
+       i8254_set_mode(dev->iobase + ATAO_82C53_BASE, 0,
+                  1, I8254_MODE4 | I8254_BINARY);
 
        outw(ATAO_CFG2_CALLD_NOP, dev->iobase + ATAO_CFG2_REG);