staging: comedi: adv_pci_dio: Advantech PCI-1739U support
authorIan Abbott <abbotti@mev.co.uk>
Mon, 9 Jan 2012 15:45:45 +0000 (15:45 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2012 17:59:40 +0000 (09:59 -0800)
This patch is ported over by me (Ian Abbott) from the out-of-tree Comedi
git repository at "git://comedi.org/git/comedi/comedi.git".

The original patch is by Nicholas Nell.

-----
Advantech PCI-1739U support

Hello,

I've added a bit of simple configuration to adv_pci_dio.c in order to
make the PCI-1739U work with the adv_pci_dio driver. I have tested
inputs only so far but they seem to work. A git style patch is
attached.

Thanks,

--
Nicholas Nell
Professional Research Assistant
University of Colorado
-----

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Nico Nell <nicholas.nell@colorado.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/Kconfig
drivers/staging/comedi/drivers/adv_pci_dio.c

index 4c77e50..12c691d 100644 (file)
@@ -765,8 +765,9 @@ config COMEDI_ADV_PCI_DIO
        default N
        ---help---
          Enable support for Advantech PCI DIO cards
-         PCI-1730, PCI-1733, PCI-1734, PCI-1736UP, PCI-1750, PCI-1751,
-         PCI-1752, PCI-1753/E, PCI-1754, PCI-1756 and PCI-1762
+         PCI-1730, PCI-1733, PCI-1734, PCI-1735U, PCI-1736UP, PCI-1739U,
+         PCI-1750, PCI-1751, PCI-1752, PCI-1753/E, PCI-1754, PCI-1756,
+         PCI-1760 and PCI-1762
 
          To compile this driver as a module, choose M here: the module will be
          called adv_pci_dio.
index 537e585..7af068f 100644 (file)
@@ -8,16 +8,16 @@
 /*
 Driver: adv_pci_dio
 Description: Advantech PCI-1730, PCI-1733, PCI-1734, PCI-1735U,
-       PCI-1736UP, PCI-1750, PCI-1751, PCI-1752, PCI-1753/E,
-       PCI-1754, PCI-1756, PCI-1762
+       PCI-1736UP, PCI-1739U, PCI-1750, PCI-1751, PCI-1752,
+       PCI-1753/E, PCI-1754, PCI-1756, PCI-1760, PCI-1762
 Author: Michal Dobes <dobes@tesnet.cz>
 Devices: [Advantech] PCI-1730 (adv_pci_dio), PCI-1733,
-  PCI-1734, PCI-1735U, PCI-1736UP, PCI-1750,
+  PCI-1734, PCI-1735U, PCI-1736UP, PCI-1739U, PCI-1750,
   PCI-1751, PCI-1752, PCI-1753,
   PCI-1753+PCI-1753E, PCI-1754, PCI-1756,
   PCI-1760, PCI-1762
 Status: untested
-Updated: Tue, 04 May 2010 13:00:00 +0000
+Updated: Mon, 09 Jan 2012 12:40:46 +0000
 
 This driver supports now only insn interface for DI/DO/DIO.
 
@@ -51,6 +51,7 @@ Configuration options:
 /* hardware types of the cards */
 enum hw_cards_id {
        TYPE_PCI1730, TYPE_PCI1733, TYPE_PCI1734, TYPE_PCI1735, TYPE_PCI1736,
+       TYPE_PCI1739,
        TYPE_PCI1750,
        TYPE_PCI1751,
        TYPE_PCI1752,
@@ -109,6 +110,12 @@ enum hw_io_access {
 #define PCI1736_BOARDID    4   /* R:   Board I/D switch for 1736UP */
 #define PCI1736_MAINREG    0   /* Normal register (2) doesn't work */
 
+/* Advantech PCI-1739U */
+#define PCI1739_DIO       0    /* R/W: begin of 8255 registers block */
+#define PCI1739_ICR      32    /* W:   Interrupt control register */
+#define PCI1739_ISR      32    /* R:   Interrupt status register */
+#define PCI1739_BOARDID           8    /* R:   Board I/D switch for 1739U */
+
 /*  Advantech PCI-1750 */
 #define PCI1750_IDI       0    /* R:   Isolated digital input  0-15 */
 #define PCI1750_IDO       0    /* W:   Isolated digital output 0-15 */
@@ -262,6 +269,7 @@ static DEFINE_PCI_DEVICE_TABLE(pci_dio_pci_table) = {
        { PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1734) },
        { PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1735) },
        { PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1736) },
+       { PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1739) },
        { PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1750) },
        { PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1751) },
        { PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1752) },
@@ -316,6 +324,14 @@ static const struct dio_boardtype boardtypes[] = {
         {4, PCI1736_BOARDID, 1, SDF_INTERNAL},
         { {0, 0, 0, 0} },
         IO_8b},
+       {"pci1739", PCI_VENDOR_ID_ADVANTECH, 0x1739, PCIDIO_MAINREG,
+        TYPE_PCI1739,
+        { {0, 0, 0, 0}, {0, 0, 0, 0} },
+        { {0, 0, 0, 0}, {0, 0, 0, 0} },
+        { {48, PCI1739_DIO, 2, 0}, {0, 0, 0, 0} },
+        {0, 0, 0, 0},
+        { {0, 0, 0, 0} },
+        IO_8b},
        {"pci1750", PCI_VENDOR_ID_ADVANTECH, 0x1750, PCIDIO_MAINREG,
         TYPE_PCI1750,
         { {0, 0, 0, 0}, {16, PCI1750_IDI, 2, 0} },
@@ -883,6 +899,11 @@ static int pci_dio_reset(struct comedi_device *dev)
                outb(0, dev->iobase + PCI1736_3_INT_RF);
                break;
 
+       case TYPE_PCI1739:
+               /* disable & clear interrupts */
+               outb(0x88, dev->iobase + PCI1739_ICR);
+               break;
+
        case TYPE_PCI1750:
        case TYPE_PCI1751:
                /* disable & clear interrupts */