Commit 717ab674 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: amplc_pc236: separately configure ISA and PCI

The amplc_pc236 driver supports both ISA and PCI cards, but currently
it is only possible to select the driver if PCI is configured.  This
patch splits the configuration to make the ISA and PCI parts seperately
selectable, and changes the driver to only include the selected ISA
and/or PCI board types.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8c287d20
...@@ -223,6 +223,16 @@ config COMEDI_AMPLC_DIO200_ISA ...@@ -223,6 +223,16 @@ config COMEDI_AMPLC_DIO200_ISA
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 amplc_dio200. called amplc_dio200.
config COMEDI_AMPLC_PC236_ISA
tristate "Amplicon PC36AT DIO board support"
select COMEDI_AMPLC_PC236
default N
---help---
Enable support for Amplicon PC36AT ISA DIO board.
To compile this driver as a module, choose M here: the module will be
called amplc_pc236.
config COMEDI_RTI800 config COMEDI_RTI800
tristate "Analog Devices RTI-800/815 ISA card support" tristate "Analog Devices RTI-800/815 ISA card support"
default N default N
...@@ -794,12 +804,12 @@ config COMEDI_AMPLC_DIO200_PCI ...@@ -794,12 +804,12 @@ config COMEDI_AMPLC_DIO200_PCI
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 amplc_dio200. called amplc_dio200.
config COMEDI_AMPLC_PC236 config COMEDI_AMPLC_PC236_PCI
tristate "Amplicon PC36AT and PCI236 DIO board support" tristate "Amplicon PCI236 DIO board support"
select COMEDI_8255 select COMEDI_AMPLC_PC236
default N default N
---help--- ---help---
Enable support for Amplicon PC36AT and PCI236 DIO boards Enable support for Amplicon PCI236 DIO board.
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 amplc_pc236. called amplc_pc236.
...@@ -1399,3 +1409,8 @@ config COMEDI_AMPLC_DIO200 ...@@ -1399,3 +1409,8 @@ config COMEDI_AMPLC_DIO200
def_tristate N def_tristate N
depends on COMEDI depends on COMEDI
select COMEDI_8255 select COMEDI_8255
config COMEDI_AMPLC_PC236
def_tristate N
depends on COMEDI
select COMEDI_8255
...@@ -63,6 +63,14 @@ unused. ...@@ -63,6 +63,14 @@ unused.
#define PC236_DRIVER_NAME "amplc_pc236" #define PC236_DRIVER_NAME "amplc_pc236"
#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA_MODULE
#define CONFIG_COMEDI_AMPLC_PC236_ISA
#endif
#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI_MODULE
#define CONFIG_COMEDI_AMPLC_PC236_PCI
#endif
/* PCI236 PCI configuration register information */ /* PCI236 PCI configuration register information */
#define PCI_VENDOR_ID_AMPLICON 0x14dc #define PCI_VENDOR_ID_AMPLICON 0x14dc
#define PCI_DEVICE_ID_AMPLICON_PCI236 0x0009 #define PCI_DEVICE_ID_AMPLICON_PCI236 0x0009
...@@ -106,13 +114,15 @@ struct pc236_board { ...@@ -106,13 +114,15 @@ struct pc236_board {
enum pc236_model model; enum pc236_model model;
}; };
static const struct pc236_board pc236_boards[] = { static const struct pc236_board pc236_boards[] = {
#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA
{ {
.name = "pc36at", .name = "pc36at",
.fancy_name = "PC36AT", .fancy_name = "PC36AT",
.bustype = isa_bustype, .bustype = isa_bustype,
.model = pc36at_model, .model = pc36at_model,
}, },
#ifdef CONFIG_COMEDI_PCI #endif
#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI
{ {
.name = "pci236", .name = "pci236",
.fancy_name = "PCI236", .fancy_name = "PCI236",
...@@ -120,8 +130,6 @@ static const struct pc236_board pc236_boards[] = { ...@@ -120,8 +130,6 @@ static const struct pc236_board pc236_boards[] = {
.bustype = pci_bustype, .bustype = pci_bustype,
.model = pci236_model, .model = pci236_model,
}, },
#endif
#ifdef CONFIG_COMEDI_PCI
{ {
.name = PC236_DRIVER_NAME, .name = PC236_DRIVER_NAME,
.fancy_name = PC236_DRIVER_NAME, .fancy_name = PC236_DRIVER_NAME,
...@@ -132,14 +140,14 @@ static const struct pc236_board pc236_boards[] = { ...@@ -132,14 +140,14 @@ static const struct pc236_board pc236_boards[] = {
#endif #endif
}; };
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_AMPLC_PC236_PCI
static DEFINE_PCI_DEVICE_TABLE(pc236_pci_table) = { static DEFINE_PCI_DEVICE_TABLE(pc236_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI236) }, { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI236) },
{0} {0}
}; };
MODULE_DEVICE_TABLE(pci, pc236_pci_table); MODULE_DEVICE_TABLE(pci, pc236_pci_table);
#endif /* CONFIG_COMEDI_PCI */ #endif /* CONFIG_COMEDI_AMPLC_PC236_PCI */
/* /*
* Useful for shorthand access to the particular board structure * Useful for shorthand access to the particular board structure
...@@ -151,7 +159,7 @@ MODULE_DEVICE_TABLE(pci, pc236_pci_table); ...@@ -151,7 +159,7 @@ MODULE_DEVICE_TABLE(pci, pc236_pci_table);
feel free to suggest moving the variable to the struct comedi_device struct. feel free to suggest moving the variable to the struct comedi_device struct.
*/ */
struct pc236_private { struct pc236_private {
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_AMPLC_PC236_PCI
/* PCI device */ /* PCI device */
struct pci_dev *pci_dev; struct pci_dev *pci_dev;
unsigned long lcr_iobase; /* PLX PCI9052 config registers in PCIBAR1 */ unsigned long lcr_iobase; /* PLX PCI9052 config registers in PCIBAR1 */
...@@ -179,7 +187,7 @@ static struct comedi_driver driver_amplc_pc236 = { ...@@ -179,7 +187,7 @@ static struct comedi_driver driver_amplc_pc236 = {
.num_names = ARRAY_SIZE(pc236_boards), .num_names = ARRAY_SIZE(pc236_boards),
}; };
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_AMPLC_PC236_PCI
static int __devinit driver_amplc_pc236_pci_probe(struct pci_dev *dev, static int __devinit driver_amplc_pc236_pci_probe(struct pci_dev *dev,
const struct pci_device_id const struct pci_device_id
*ent) *ent)
...@@ -234,8 +242,10 @@ module_init(driver_amplc_pc236_init_module); ...@@ -234,8 +242,10 @@ module_init(driver_amplc_pc236_init_module);
module_exit(driver_amplc_pc236_cleanup_module); module_exit(driver_amplc_pc236_cleanup_module);
#endif #endif
#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA
static int pc236_request_region(unsigned minor, unsigned long from, static int pc236_request_region(unsigned minor, unsigned long from,
unsigned long extent); unsigned long extent);
#endif
static void pc236_intr_disable(struct comedi_device *dev); static void pc236_intr_disable(struct comedi_device *dev);
static void pc236_intr_enable(struct comedi_device *dev); static void pc236_intr_enable(struct comedi_device *dev);
static int pc236_intr_check(struct comedi_device *dev); static int pc236_intr_check(struct comedi_device *dev);
...@@ -255,7 +265,7 @@ static irqreturn_t pc236_interrupt(int irq, void *d); ...@@ -255,7 +265,7 @@ static irqreturn_t pc236_interrupt(int irq, void *d);
* This function looks for a PCI device matching the requested board name, * This function looks for a PCI device matching the requested board name,
* bus and slot. * bus and slot.
*/ */
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_AMPLC_PC236_PCI
static int static int
pc236_find_pci(struct comedi_device *dev, int bus, int slot, pc236_find_pci(struct comedi_device *dev, int bus, int slot,
struct pci_dev **pci_dev_p) struct pci_dev **pci_dev_p)
...@@ -324,7 +334,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -324,7 +334,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
struct comedi_subdevice *s; struct comedi_subdevice *s;
unsigned long iobase = 0; unsigned long iobase = 0;
unsigned int irq = 0; unsigned int irq = 0;
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_AMPLC_PC236_PCI
struct pci_dev *pci_dev = NULL; struct pci_dev *pci_dev = NULL;
int bus = 0, slot = 0; int bus = 0, slot = 0;
#endif #endif
...@@ -345,12 +355,14 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -345,12 +355,14 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
} }
/* Process options. */ /* Process options. */
switch (thisboard->bustype) { switch (thisboard->bustype) {
#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA
case isa_bustype: case isa_bustype:
iobase = it->options[0]; iobase = it->options[0];
irq = it->options[1]; irq = it->options[1];
share_irq = 0; share_irq = 0;
break; break;
#ifdef CONFIG_COMEDI_PCI #endif
#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI
case pci_bustype: case pci_bustype:
bus = it->options[0]; bus = it->options[0];
slot = it->options[1]; slot = it->options[1];
...@@ -361,7 +373,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -361,7 +373,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return ret; return ret;
devpriv->pci_dev = pci_dev; devpriv->pci_dev = pci_dev;
break; break;
#endif /* CONFIG_COMEDI_PCI */ #endif
default: default:
printk(KERN_ERR printk(KERN_ERR
"comedi%d: %s: BUG! cannot determine board type!\n", "comedi%d: %s: BUG! cannot determine board type!\n",
...@@ -376,7 +388,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -376,7 +388,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
dev->board_name = thisboard->name; dev->board_name = thisboard->name;
/* Enable device and reserve I/O spaces. */ /* Enable device and reserve I/O spaces. */
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_AMPLC_PC236_PCI
if (pci_dev) { if (pci_dev) {
ret = comedi_pci_enable(pci_dev, PC236_DRIVER_NAME); ret = comedi_pci_enable(pci_dev, PC236_DRIVER_NAME);
...@@ -392,9 +404,11 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -392,9 +404,11 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
} else } else
#endif #endif
{ {
#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA
ret = pc236_request_region(dev->minor, iobase, PC236_IO_SIZE); ret = pc236_request_region(dev->minor, iobase, PC236_IO_SIZE);
if (ret < 0) if (ret < 0)
return ret; return ret;
#endif
} }
dev->iobase = iobase; dev->iobase = iobase;
...@@ -439,12 +453,19 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -439,12 +453,19 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
} }
} }
printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name);
if (thisboard->bustype == isa_bustype) { switch (thisboard->bustype) {
#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA
case isa_bustype:
printk("(base %#lx) ", iobase); printk("(base %#lx) ", iobase);
} else { break;
#ifdef CONFIG_COMEDI_PCI #endif
#ifdef CONFIG_COMEDI_AMPLC_PC236_PCI
case pci_bustype:
printk("(pci %s) ", pci_name(pci_dev)); printk("(pci %s) ", pci_name(pci_dev));
break;
#endif #endif
default:
break;
} }
if (irq) if (irq)
printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE")); printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE"));
...@@ -476,7 +497,7 @@ static int pc236_detach(struct comedi_device *dev) ...@@ -476,7 +497,7 @@ static int pc236_detach(struct comedi_device *dev)
if (dev->subdevices) if (dev->subdevices)
subdev_8255_cleanup(dev, dev->subdevices + 0); subdev_8255_cleanup(dev, dev->subdevices + 0);
if (devpriv) { if (devpriv) {
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_AMPLC_PC236_PCI
if (devpriv->pci_dev) { if (devpriv->pci_dev) {
if (dev->iobase) if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev); comedi_pci_disable(devpriv->pci_dev);
...@@ -484,8 +505,10 @@ static int pc236_detach(struct comedi_device *dev) ...@@ -484,8 +505,10 @@ static int pc236_detach(struct comedi_device *dev)
} else } else
#endif #endif
{ {
#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, PC236_IO_SIZE); release_region(dev->iobase, PC236_IO_SIZE);
#endif
} }
} }
if (dev->board_name) { if (dev->board_name) {
...@@ -499,6 +522,7 @@ static int pc236_detach(struct comedi_device *dev) ...@@ -499,6 +522,7 @@ static int pc236_detach(struct comedi_device *dev)
* This function checks and requests an I/O region, reporting an error * This function checks and requests an I/O region, reporting an error
* if there is a conflict. * if there is a conflict.
*/ */
#ifdef CONFIG_COMEDI_AMPLC_PC236_ISA
static int pc236_request_region(unsigned minor, unsigned long from, static int pc236_request_region(unsigned minor, unsigned long from,
unsigned long extent) unsigned long extent)
{ {
...@@ -509,6 +533,7 @@ static int pc236_request_region(unsigned minor, unsigned long from, ...@@ -509,6 +533,7 @@ static int pc236_request_region(unsigned minor, unsigned long from,
} }
return 0; return 0;
} }
#endif
/* /*
* This function is called to mark the interrupt as disabled (no command * This function is called to mark the interrupt as disabled (no command
...@@ -521,7 +546,7 @@ static void pc236_intr_disable(struct comedi_device *dev) ...@@ -521,7 +546,7 @@ static void pc236_intr_disable(struct comedi_device *dev)
spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
devpriv->enable_irq = 0; devpriv->enable_irq = 0;
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_AMPLC_PC236_PCI
if (devpriv->lcr_iobase) if (devpriv->lcr_iobase)
outl(PCI236_INTR_DISABLE, devpriv->lcr_iobase + PLX9052_INTCSR); outl(PCI236_INTR_DISABLE, devpriv->lcr_iobase + PLX9052_INTCSR);
#endif #endif
...@@ -539,7 +564,7 @@ static void pc236_intr_enable(struct comedi_device *dev) ...@@ -539,7 +564,7 @@ static void pc236_intr_enable(struct comedi_device *dev)
spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
devpriv->enable_irq = 1; devpriv->enable_irq = 1;
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_AMPLC_PC236_PCI
if (devpriv->lcr_iobase) if (devpriv->lcr_iobase)
outl(PCI236_INTR_ENABLE, devpriv->lcr_iobase + PLX9052_INTCSR); outl(PCI236_INTR_ENABLE, devpriv->lcr_iobase + PLX9052_INTCSR);
#endif #endif
...@@ -561,7 +586,7 @@ static int pc236_intr_check(struct comedi_device *dev) ...@@ -561,7 +586,7 @@ static int pc236_intr_check(struct comedi_device *dev)
spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
if (devpriv->enable_irq) { if (devpriv->enable_irq) {
retval = 1; retval = 1;
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_AMPLC_PC236_PCI
if (devpriv->lcr_iobase) { if (devpriv->lcr_iobase) {
if ((inl(devpriv->lcr_iobase + PLX9052_INTCSR) if ((inl(devpriv->lcr_iobase + PLX9052_INTCSR)
& PLX9052_INTCSR_LI1STAT_MASK) & PLX9052_INTCSR_LI1STAT_MASK)
......
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