Commit b37c1aee authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: 8255_pci: move ni_pcidio 8255 board support

The 8255 based boards in the ni_pcidio driver are all simple
memory mapped 8255 boards that don't require the dma support
provided by the mite driver.

Move the support for these boards from the ni_pcidio driver to
the generic 8255_pci driver.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 77f17d37
...@@ -560,6 +560,8 @@ config COMEDI_8255_PCI ...@@ -560,6 +560,8 @@ config COMEDI_8255_PCI
ADlink - PCI-7224, PCI-7248, and PCI-7296 ADlink - PCI-7224, PCI-7248, and PCI-7296
Measurement Computing - PCI-DIO24, PCI-DIO24H, PCI-DIO48H and Measurement Computing - PCI-DIO24, PCI-DIO24H, PCI-DIO48H and
PCI-DIO96H PCI-DIO96H
National Instruments - PCI-DIO-96, PCI-DIO-96B, PXI-6508, PCI-6503,
PCI-6503B, PCI-6503X, and PXI-6503
To compile this driver as a module, choose M here: the module will To compile this driver as a module, choose M here: the module will
be called 8255_pci. be called 8255_pci.
...@@ -1030,15 +1032,12 @@ config COMEDI_NI_LABPC ...@@ -1030,15 +1032,12 @@ config COMEDI_NI_LABPC
called ni_labpc. called ni_labpc.
config COMEDI_NI_PCIDIO config COMEDI_NI_PCIDIO
tristate "NI PCI-DIO32HS, PCI-DIO96, PCI-6533, PCI-6503 support" tristate "NI PCI-DIO32HS, PCI-6533, PCI-6534 support"
select COMEDI_MITE select COMEDI_MITE
select COMEDI_8255 select COMEDI_8255
---help--- ---help---
Enable support for National Instruments PCI-DIO-32HS, PXI-6533, Enable support for National Instruments PCI-DIO-32HS, PXI-6533,
PCI-DIO-96, PCI-DIO-96B, PXI-6508, PCI-6503, PCI-6503B, PCI-6503X, PCI-6533 and PCI-6534
PXI-6503, PCI-6533 and PCI-6534
The DIO-96 appears as four 8255 subdevices. See the 8255
driver notes for details.
To compile this driver as a module, choose M here: the module will be To compile this driver as a module, choose M here: the module will be
called ni_pcidio. called ni_pcidio.
......
...@@ -35,6 +35,13 @@ Devices: (ADLink) PCI-7224 [adl_pci-7224] - 24 channels ...@@ -35,6 +35,13 @@ Devices: (ADLink) PCI-7224 [adl_pci-7224] - 24 channels
(Measurement Computing) PCI-DIO24H [cb_pci-dio24h] - 24 channels (Measurement Computing) PCI-DIO24H [cb_pci-dio24h] - 24 channels
(Measurement Computing) PCI-DIO48H [cb_pci-dio48h] - 48 channels (Measurement Computing) PCI-DIO48H [cb_pci-dio48h] - 48 channels
(Measurement Computing) PCI-DIO96H [cb_pci-dio96h] - 96 channels (Measurement Computing) PCI-DIO96H [cb_pci-dio96h] - 96 channels
(National Instruments) PCI-DIO-96 [ni_pci-dio-96] - 96 channels
(National Instruments) PCI-DIO-96B [ni_pci-dio-96b] - 96 channels
(National Instruments) PXI-6508 [ni_pxi-6508] - 96 channels
(National Instruments) PCI-6503 [ni_pci-6503] - 24 channels
(National Instruments) PCI-6503B [ni_pci-6503b] - 24 channels
(National Instruments) PCI-6503X [ni_pci-6503x] - 24 channels
(National Instruments) PXI-6503 [ni_pxi-6503] - 24 channels
Author: H Hartley Sweeten <hsweeten@visionengravers.com> Author: H Hartley Sweeten <hsweeten@visionengravers.com>
Updated: Wed, 12 Sep 2012 11:52:01 -0700 Updated: Wed, 12 Sep 2012 11:52:01 -0700
Status: untested Status: untested
...@@ -66,6 +73,14 @@ Configuration Options: not applicable, uses PCI auto config ...@@ -66,6 +73,14 @@ Configuration Options: not applicable, uses PCI auto config
#define PCI_DEVICE_ID_CB_PCIDIO96H 0x0017 #define PCI_DEVICE_ID_CB_PCIDIO96H 0x0017
#define PCI_DEVICE_ID_CB_PCIDIO24 0x0028 #define PCI_DEVICE_ID_CB_PCIDIO24 0x0028
#define PCI_DEVICE_ID_NI_PCIDIO96 0x0160
#define PCI_DEVICE_ID_NI_PCI6503 0x0400
#define PCI_DEVICE_ID_NI_PCI6503B 0x1250
#define PCI_DEVICE_ID_NI_PXI6508 0x13c0
#define PCI_DEVICE_ID_NI_PCIDIO96B 0x1630
#define PCI_DEVICE_ID_NI_PCI6503X 0x17d0
#define PCI_DEVICE_ID_NI_PXI_6503 0x1800
struct pci_8255_boardinfo { struct pci_8255_boardinfo {
const char *name; const char *name;
unsigned short vendor; unsigned short vendor;
...@@ -118,6 +133,55 @@ static const struct pci_8255_boardinfo pci_8255_boards[] = { ...@@ -118,6 +133,55 @@ static const struct pci_8255_boardinfo pci_8255_boards[] = {
.device = PCI_DEVICE_ID_CB_PCIDIO96H, .device = PCI_DEVICE_ID_CB_PCIDIO96H,
.dio_badr = 2, .dio_badr = 2,
.n_8255 = 4, .n_8255 = 4,
}, {
.name = "ni_pci-dio-96",
.vendor = PCI_VENDOR_ID_NI,
.device = PCI_DEVICE_ID_NI_PCIDIO96,
.dio_badr = 1,
.is_mmio = 1,
.n_8255 = 4,
}, {
.name = "ni_pci-dio-96b",
.vendor = PCI_VENDOR_ID_NI,
.device = PCI_DEVICE_ID_NI_PCIDIO96B,
.dio_badr = 1,
.is_mmio = 1,
.n_8255 = 4,
}, {
.name = "ni_pxi-6508",
.vendor = PCI_VENDOR_ID_NI,
.device = PCI_DEVICE_ID_NI_PXI6508,
.dio_badr = 1,
.is_mmio = 1,
.n_8255 = 4,
}, {
.name = "ni_pci-6503",
.vendor = PCI_VENDOR_ID_NI,
.device = PCI_DEVICE_ID_NI_PCI6503,
.dio_badr = 1,
.is_mmio = 1,
.n_8255 = 1,
}, {
.name = "ni_pci-6503b",
.vendor = PCI_VENDOR_ID_NI,
.device = PCI_DEVICE_ID_NI_PCI6503B,
.dio_badr = 1,
.is_mmio = 1,
.n_8255 = 1,
}, {
.name = "ni_pci-6503x",
.vendor = PCI_VENDOR_ID_NI,
.device = PCI_DEVICE_ID_NI_PCI6503X,
.dio_badr = 1,
.is_mmio = 1,
.n_8255 = 1,
}, {
.name = "ni_pxi-6503",
.vendor = PCI_VENDOR_ID_NI,
.device = PCI_DEVICE_ID_NI_PXI_6503,
.dio_badr = 1,
.is_mmio = 1,
.n_8255 = 1,
}, },
}; };
...@@ -265,6 +329,13 @@ static DEFINE_PCI_DEVICE_TABLE(pci_8255_pci_table) = { ...@@ -265,6 +329,13 @@ static DEFINE_PCI_DEVICE_TABLE(pci_8255_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_CB, PCI_DEVICE_ID_CB_PCIDIO24H) }, { PCI_DEVICE(PCI_VENDOR_ID_CB, PCI_DEVICE_ID_CB_PCIDIO24H) },
{ PCI_DEVICE(PCI_VENDOR_ID_CB, PCI_DEVICE_ID_CB_PCIDIO48H) }, { PCI_DEVICE(PCI_VENDOR_ID_CB, PCI_DEVICE_ID_CB_PCIDIO48H) },
{ PCI_DEVICE(PCI_VENDOR_ID_CB, PCI_DEVICE_ID_CB_PCIDIO96H) }, { PCI_DEVICE(PCI_VENDOR_ID_CB, PCI_DEVICE_ID_CB_PCIDIO96H) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCIDIO96) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCIDIO96B) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI6508) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI6503) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI6503B) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PCI6503X) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, PCI_DEVICE_ID_NI_PXI_6503) },
{ 0 } { 0 }
}; };
MODULE_DEVICE_TABLE(pci, pci_8255_pci_table); MODULE_DEVICE_TABLE(pci, pci_8255_pci_table);
......
/* /*
comedi/drivers/ni_pcidio.c comedi/drivers/ni_pcidio.c
driver for National Instruments PCI-DIO-96/PCI-6508 driver for National Instruments PCI-DIO-32HS
National Instruments PCI-DIO-32HS
National Instruments PCI-6503
COMEDI - Linux Control and Measurement Device Interface COMEDI - Linux Control and Measurement Device Interface
Copyright (C) 1999,2002 David A. Schleef <ds@schleef.org> Copyright (C) 1999,2002 David A. Schleef <ds@schleef.org>
...@@ -24,17 +22,14 @@ ...@@ -24,17 +22,14 @@
*/ */
/* /*
Driver: ni_pcidio Driver: ni_pcidio
Description: National Instruments PCI-DIO32HS, PCI-DIO96, PCI-6533, PCI-6503 Description: National Instruments PCI-DIO32HS, PCI-6533
Author: ds Author: ds
Status: works Status: works
Devices: [National Instruments] PCI-DIO-32HS (ni_pcidio), PXI-6533, Devices: [National Instruments] PCI-DIO-32HS (ni_pcidio)
PCI-DIO-96, PCI-DIO-96B, PXI-6508, PCI-6503, PCI-6503B, PCI-6503X, [National Instruments] PXI-6533, PCI-6533 (pxi-6533)
PXI-6503, PCI-6533, PCI-6534 [National Instruments] PCI-6534 (pci-6534)
Updated: Mon, 09 Jan 2012 14:27:23 +0000 Updated: Mon, 09 Jan 2012 14:27:23 +0000
The DIO-96 appears as four 8255 subdevices. See the 8255
driver notes for details.
The DIO32HS board appears as one subdevice, with 32 channels. The DIO32HS board appears as one subdevice, with 32 channels.
Each channel is individually I/O configurable. The channel order Each channel is individually I/O configurable. The channel order
is 0=A0, 1=A1, 2=A2, ... 8=B0, 16=C0, 24=D0. The driver only is 0=A0, 1=A1, 2=A2, ... 8=B0, 16=C0, 24=D0. The driver only
...@@ -56,20 +51,6 @@ it are contained in the ...@@ -56,20 +51,6 @@ it are contained in the
comedi_nonfree_firmware tarball available from http://www.comedi.org comedi_nonfree_firmware tarball available from http://www.comedi.org
*/ */
/*
This driver is for both the NI PCI-DIO-32HS and the PCI-DIO-96,
which have very different architectures. But, since the '96 is
so simple, it is included here.
Manuals (available from ftp://ftp.natinst.com/support/manuals)
320938c.pdf PCI-DIO-96/PXI-6508/PCI-6503 User Manual
321464b.pdf AT/PCI-DIO-32HS User Manual
341329A.pdf PCI-6533 Register-Level Programmer Manual
341330A.pdf DAQ-DIO Technical Reference Manual
*/
#define USE_DMA #define USE_DMA
/* #define DEBUG 1 */ /* #define DEBUG 1 */
/* #define DEBUG_FLAGS */ /* #define DEBUG_FLAGS */
...@@ -79,7 +60,6 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org ...@@ -79,7 +60,6 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org
#include "../comedidev.h" #include "../comedidev.h"
#include "mite.h" #include "mite.h"
#include "8255.h"
#undef DPRINTK #undef DPRINTK
#ifdef DEBUG #ifdef DEBUG
...@@ -91,14 +71,6 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org ...@@ -91,14 +71,6 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org
#define PCI_DIO_SIZE 4096 #define PCI_DIO_SIZE 4096
#define PCI_MITE_SIZE 4096 #define PCI_MITE_SIZE 4096
/* defines for the PCI-DIO-96 */
#define NIDIO_8255_BASE(x) ((x)*4)
#define NIDIO_A 0
#define NIDIO_B 4
#define NIDIO_C 8
#define NIDIO_D 12
/* defines for the PCI-DIO-32HS */ /* defines for the PCI-DIO-32HS */
#define Window_Address 4 /* W */ #define Window_Address 4 /* W */
...@@ -297,76 +269,23 @@ static int ni_pcidio_cancel(struct comedi_device *dev, ...@@ -297,76 +269,23 @@ static int ni_pcidio_cancel(struct comedi_device *dev,
struct comedi_subdevice *s); struct comedi_subdevice *s);
struct nidio_board { struct nidio_board {
int dev_id; int dev_id;
const char *name; const char *name;
int n_8255;
unsigned int is_diodaq:1;
unsigned int uses_firmware:1; unsigned int uses_firmware:1;
}; };
static const struct nidio_board nidio_boards[] = { static const struct nidio_board nidio_boards[] = {
{ {
.dev_id = 0x1150, .dev_id = 0x1150,
.name = "pci-dio-32hs", .name = "pci-dio-32hs",
.n_8255 = 0, }, {
.is_diodaq = 1, .dev_id = 0x1320,
}, .name = "pxi-6533",
{ }, {
.dev_id = 0x1320, .dev_id = 0x12b0,
.name = "pxi-6533", .name = "pci-6534",
.n_8255 = 0, .uses_firmware = 1,
.is_diodaq = 1, },
},
{
.dev_id = 0x12b0,
.name = "pci-6534",
.n_8255 = 0,
.is_diodaq = 1,
.uses_firmware = 1,
},
{
.dev_id = 0x0160,
.name = "pci-dio-96",
.n_8255 = 4,
.is_diodaq = 0,
},
{
.dev_id = 0x1630,
.name = "pci-dio-96b",
.n_8255 = 4,
.is_diodaq = 0,
},
{
.dev_id = 0x13c0,
.name = "pxi-6508",
.n_8255 = 4,
.is_diodaq = 0,
},
{
.dev_id = 0x0400,
.name = "pci-6503",
.n_8255 = 1,
.is_diodaq = 0,
},
{
.dev_id = 0x1250,
.name = "pci-6503b",
.n_8255 = 1,
.is_diodaq = 0,
},
{
.dev_id = 0x17d0,
.name = "pci-6503x",
.n_8255 = 1,
.is_diodaq = 0,
},
{
.dev_id = 0x1800,
.name = "pxi-6503",
.n_8255 = 1,
.is_diodaq = 0,
},
}; };
#define n_nidio_boards ARRAY_SIZE(nidio_boards) #define n_nidio_boards ARRAY_SIZE(nidio_boards)
...@@ -442,16 +361,6 @@ static void ni_pcidio_release_di_mite_channel(struct comedi_device *dev) ...@@ -442,16 +361,6 @@ static void ni_pcidio_release_di_mite_channel(struct comedi_device *dev)
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
} }
static int nidio96_8255_cb(int dir, int port, int data, unsigned long iobase)
{
if (dir) {
writeb(data, (void *)(iobase + port));
return 0;
} else {
return readb((void *)(iobase + port));
}
}
void ni_pcidio_event(struct comedi_device *dev, struct comedi_subdevice *s) void ni_pcidio_event(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
if (s-> if (s->
...@@ -1207,9 +1116,7 @@ static int nidio_find_device(struct comedi_device *dev, int bus, int slot) ...@@ -1207,9 +1116,7 @@ static int nidio_find_device(struct comedi_device *dev, int bus, int slot)
static int nidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int nidio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{ {
struct comedi_subdevice *s; struct comedi_subdevice *s;
int i;
int ret; int ret;
int n_subdevices;
unsigned int irq; unsigned int irq;
printk(KERN_INFO "comedi%d: nidio:", dev->minor); printk(KERN_INFO "comedi%d: nidio:", dev->minor);
...@@ -1241,64 +1148,49 @@ static int nidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1241,64 +1148,49 @@ static int nidio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
if (!this_board->is_diodaq)
n_subdevices = this_board->n_8255;
else
n_subdevices = 1;
ret = comedi_alloc_subdevices(dev, n_subdevices); ret = comedi_alloc_subdevices(dev, 1);
if (ret) if (ret)
return ret; return ret;
if (!this_board->is_diodaq) { printk(KERN_INFO " rev=%d",
for (i = 0; i < this_board->n_8255; i++) { readb(devpriv->mite->daq_io_addr + Chip_Version));
s = &dev->subdevices[i];
subdev_8255_init(dev, s, nidio96_8255_cb, s = &dev->subdevices[0];
(unsigned long)(devpriv->mite->
daq_io_addr + dev->read_subdev = s;
NIDIO_8255_BASE(i))); s->type = COMEDI_SUBD_DIO;
} s->subdev_flags =
} else { SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | SDF_PACKED |
SDF_CMD_READ;
printk(KERN_INFO " rev=%d", s->n_chan = 32;
readb(devpriv->mite->daq_io_addr + Chip_Version)); s->range_table = &range_digital;
s->maxdata = 1;
s = &dev->subdevices[0]; s->insn_config = &ni_pcidio_insn_config;
s->insn_bits = &ni_pcidio_insn_bits;
dev->read_subdev = s; s->do_cmd = &ni_pcidio_cmd;
s->type = COMEDI_SUBD_DIO; s->do_cmdtest = &ni_pcidio_cmdtest;
s->subdev_flags = s->cancel = &ni_pcidio_cancel;
SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | SDF_PACKED | s->len_chanlist = 32; /* XXX */
SDF_CMD_READ; s->buf_change = &ni_pcidio_change;
s->n_chan = 32; s->async_dma_dir = DMA_BIDIRECTIONAL;
s->range_table = &range_digital; s->poll = &ni_pcidio_poll;
s->maxdata = 1;
s->insn_config = &ni_pcidio_insn_config; writel(0, devpriv->mite->daq_io_addr + Port_IO(0));
s->insn_bits = &ni_pcidio_insn_bits; writel(0, devpriv->mite->daq_io_addr + Port_Pin_Directions(0));
s->do_cmd = &ni_pcidio_cmd; writel(0, devpriv->mite->daq_io_addr + Port_Pin_Mask(0));
s->do_cmdtest = &ni_pcidio_cmdtest;
s->cancel = &ni_pcidio_cancel; /* disable interrupts on board */
s->len_chanlist = 32; /* XXX */ writeb(0x00,
s->buf_change = &ni_pcidio_change; devpriv->mite->daq_io_addr +
s->async_dma_dir = DMA_BIDIRECTIONAL; Master_DMA_And_Interrupt_Control);
s->poll = &ni_pcidio_poll;
writel(0, devpriv->mite->daq_io_addr + Port_IO(0));
writel(0, devpriv->mite->daq_io_addr + Port_Pin_Directions(0));
writel(0, devpriv->mite->daq_io_addr + Port_Pin_Mask(0));
/* disable interrupts on board */
writeb(0x00,
devpriv->mite->daq_io_addr +
Master_DMA_And_Interrupt_Control);
ret = request_irq(irq, nidio_interrupt, IRQF_SHARED, ret = request_irq(irq, nidio_interrupt, IRQF_SHARED,
"ni_pcidio", dev); "ni_pcidio", dev);
if (ret < 0) if (ret < 0)
printk(KERN_WARNING " irq not available"); printk(KERN_WARNING " irq not available");
dev->irq = irq; dev->irq = irq;
}
printk("\n"); printk("\n");
...@@ -1307,15 +1199,6 @@ static int nidio_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1307,15 +1199,6 @@ static int nidio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
static void nidio_detach(struct comedi_device *dev) static void nidio_detach(struct comedi_device *dev)
{ {
struct comedi_subdevice *s;
int i;
if (this_board && !this_board->is_diodaq) {
for (i = 0; i < this_board->n_8255; i++) {
s = &dev->subdevices[i];
subdev_8255_cleanup(dev, s);
}
}
if (dev->irq) if (dev->irq)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (devpriv) { if (devpriv) {
...@@ -1350,13 +1233,6 @@ static DEFINE_PCI_DEVICE_TABLE(ni_pcidio_pci_table) = { ...@@ -1350,13 +1233,6 @@ static DEFINE_PCI_DEVICE_TABLE(ni_pcidio_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1150) }, { PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1150) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1320) }, { PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1320) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, 0x12b0) }, { PCI_DEVICE(PCI_VENDOR_ID_NI, 0x12b0) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, 0x0160) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1630) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, 0x13c0) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, 0x0400) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1250) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, 0x17d0) },
{ PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1800) },
{ 0 } { 0 }
}; };
MODULE_DEVICE_TABLE(pci, ni_pcidio_pci_table); MODULE_DEVICE_TABLE(pci, ni_pcidio_pci_table);
......
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