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: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
77f17d3714
Коммит
b37c1aeed8
|
@ -560,6 +560,8 @@ config COMEDI_8255_PCI
|
|||
ADlink - PCI-7224, PCI-7248, and PCI-7296
|
||||
Measurement Computing - PCI-DIO24, PCI-DIO24H, PCI-DIO48H and
|
||||
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
|
||||
be called 8255_pci.
|
||||
|
@ -1030,15 +1032,12 @@ config COMEDI_NI_LABPC
|
|||
called ni_labpc.
|
||||
|
||||
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_8255
|
||||
---help---
|
||||
Enable support for National Instruments PCI-DIO-32HS, PXI-6533,
|
||||
PCI-DIO-96, PCI-DIO-96B, PXI-6508, PCI-6503, PCI-6503B, PCI-6503X,
|
||||
PXI-6503, PCI-6533 and PCI-6534
|
||||
The DIO-96 appears as four 8255 subdevices. See the 8255
|
||||
driver notes for details.
|
||||
PCI-6533 and PCI-6534
|
||||
|
||||
To compile this driver as a module, choose M here: the module will be
|
||||
called ni_pcidio.
|
||||
|
|
|
@ -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-DIO48H [cb_pci-dio48h] - 48 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>
|
||||
Updated: Wed, 12 Sep 2012 11:52:01 -0700
|
||||
Status: untested
|
||||
|
@ -66,6 +73,14 @@ Configuration Options: not applicable, uses PCI auto config
|
|||
#define PCI_DEVICE_ID_CB_PCIDIO96H 0x0017
|
||||
#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 {
|
||||
const char *name;
|
||||
unsigned short vendor;
|
||||
|
@ -118,6 +133,55 @@ static const struct pci_8255_boardinfo pci_8255_boards[] = {
|
|||
.device = PCI_DEVICE_ID_CB_PCIDIO96H,
|
||||
.dio_badr = 2,
|
||||
.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) = {
|
|||
{ 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_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 }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(pci, pci_8255_pci_table);
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/*
|
||||
comedi/drivers/ni_pcidio.c
|
||||
driver for National Instruments PCI-DIO-96/PCI-6508
|
||||
National Instruments PCI-DIO-32HS
|
||||
National Instruments PCI-6503
|
||||
driver for National Instruments PCI-DIO-32HS
|
||||
|
||||
COMEDI - Linux Control and Measurement Device Interface
|
||||
Copyright (C) 1999,2002 David A. Schleef <ds@schleef.org>
|
||||
|
@ -24,17 +22,14 @@
|
|||
*/
|
||||
/*
|
||||
Driver: ni_pcidio
|
||||
Description: National Instruments PCI-DIO32HS, PCI-DIO96, PCI-6533, PCI-6503
|
||||
Description: National Instruments PCI-DIO32HS, PCI-6533
|
||||
Author: ds
|
||||
Status: works
|
||||
Devices: [National Instruments] PCI-DIO-32HS (ni_pcidio), PXI-6533,
|
||||
PCI-DIO-96, PCI-DIO-96B, PXI-6508, PCI-6503, PCI-6503B, PCI-6503X,
|
||||
PXI-6503, PCI-6533, PCI-6534
|
||||
Devices: [National Instruments] PCI-DIO-32HS (ni_pcidio)
|
||||
[National Instruments] PXI-6533, PCI-6533 (pxi-6533)
|
||||
[National Instruments] PCI-6534 (pci-6534)
|
||||
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.
|
||||
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
|
||||
|
@ -56,20 +51,6 @@ it are contained in the
|
|||
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 DEBUG 1 */
|
||||
/* #define DEBUG_FLAGS */
|
||||
|
@ -79,7 +60,6 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org
|
|||
#include "../comedidev.h"
|
||||
|
||||
#include "mite.h"
|
||||
#include "8255.h"
|
||||
|
||||
#undef DPRINTK
|
||||
#ifdef DEBUG
|
||||
|
@ -91,14 +71,6 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org
|
|||
#define PCI_DIO_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 */
|
||||
|
||||
#define Window_Address 4 /* W */
|
||||
|
@ -297,11 +269,8 @@ static int ni_pcidio_cancel(struct comedi_device *dev,
|
|||
struct comedi_subdevice *s);
|
||||
|
||||
struct nidio_board {
|
||||
|
||||
int dev_id;
|
||||
const char *name;
|
||||
int n_8255;
|
||||
unsigned int is_diodaq:1;
|
||||
unsigned int uses_firmware:1;
|
||||
};
|
||||
|
||||
|
@ -309,64 +278,14 @@ static const struct nidio_board nidio_boards[] = {
|
|||
{
|
||||
.dev_id = 0x1150,
|
||||
.name = "pci-dio-32hs",
|
||||
.n_8255 = 0,
|
||||
.is_diodaq = 1,
|
||||
},
|
||||
{
|
||||
}, {
|
||||
.dev_id = 0x1320,
|
||||
.name = "pxi-6533",
|
||||
.n_8255 = 0,
|
||||
.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)
|
||||
|
@ -442,16 +361,6 @@ static void ni_pcidio_release_di_mite_channel(struct comedi_device *dev)
|
|||
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)
|
||||
{
|
||||
if (s->
|
||||
|
@ -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)
|
||||
{
|
||||
struct comedi_subdevice *s;
|
||||
int i;
|
||||
int ret;
|
||||
int n_subdevices;
|
||||
unsigned int irq;
|
||||
|
||||
printk(KERN_INFO "comedi%d: nidio:", dev->minor);
|
||||
|
@ -1241,25 +1148,11 @@ static int nidio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
if (ret < 0)
|
||||
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)
|
||||
return ret;
|
||||
|
||||
if (!this_board->is_diodaq) {
|
||||
for (i = 0; i < this_board->n_8255; i++) {
|
||||
s = &dev->subdevices[i];
|
||||
subdev_8255_init(dev, s, nidio96_8255_cb,
|
||||
(unsigned long)(devpriv->mite->
|
||||
daq_io_addr +
|
||||
NIDIO_8255_BASE(i)));
|
||||
}
|
||||
} else {
|
||||
|
||||
printk(KERN_INFO " rev=%d",
|
||||
readb(devpriv->mite->daq_io_addr + Chip_Version));
|
||||
|
||||
|
@ -1298,7 +1191,6 @@ static int nidio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
printk(KERN_WARNING " irq not available");
|
||||
|
||||
dev->irq = irq;
|
||||
}
|
||||
|
||||
printk("\n");
|
||||
|
||||
|
@ -1307,15 +1199,6 @@ static int nidio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||
|
||||
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)
|
||||
free_irq(dev->irq, dev);
|
||||
if (devpriv) {
|
||||
|
@ -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, 0x1320) },
|
||||
{ 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 }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(pci, ni_pcidio_pci_table);
|
||||
|
|
Загрузка…
Ссылка в новой задаче