mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 07:04:24 +00:00
staging: comedi: ni_labpc_pci: remove COMEDI_MITE and HAS_DMA dependancy
The mite module provides the DMA interface for the PCI MITE ASIC used on many National Instruments DAQ boards. This driver does not use DMA and only depends on the mite module to initialize the MITE ASIC. Handle the initialization localy and remove the unnecessary dependancies. 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>
This commit is contained in:
parent
e2f1036a9b
commit
319a883bfd
3 changed files with 35 additions and 16 deletions
|
@ -1049,9 +1049,7 @@ config COMEDI_NI_670X
|
|||
|
||||
config COMEDI_NI_LABPC_PCI
|
||||
tristate "NI Lab-PC PCI-1200 support"
|
||||
depends on HAS_DMA
|
||||
select COMEDI_NI_LABPC
|
||||
select COMEDI_MITE
|
||||
---help---
|
||||
Enable support for National Instruments Lab-PC PCI-1200.
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ struct labpc_boardinfo {
|
|||
};
|
||||
|
||||
struct labpc_private {
|
||||
struct mite_struct *mite; /* for mite chip on pci-1200 */
|
||||
/* number of data points left to be taken */
|
||||
unsigned long long count;
|
||||
/* software copy of analog output values */
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
|
||||
#include "../comedidev.h"
|
||||
|
||||
#include "mite.h"
|
||||
#include "ni_labpc.h"
|
||||
|
||||
enum labpc_pci_boardid {
|
||||
|
@ -53,12 +52,36 @@ static const struct labpc_boardinfo labpc_pci_boards[] = {
|
|||
},
|
||||
};
|
||||
|
||||
/* ripped from mite.h and mite_setup2() to avoid mite dependancy */
|
||||
#define MITE_IODWBSR 0xc0 /* IO Device Window Base Size Register */
|
||||
#define WENAB (1 << 7) /* window enable */
|
||||
|
||||
static int labpc_pci_mite_init(struct pci_dev *pcidev)
|
||||
{
|
||||
void __iomem *mite_base;
|
||||
u32 main_phys_addr;
|
||||
|
||||
/* ioremap the MITE registers (BAR 0) temporarily */
|
||||
mite_base = pci_ioremap_bar(pcidev, 0);
|
||||
if (!mite_base)
|
||||
return -ENOMEM;
|
||||
|
||||
/* set data window to main registers (BAR 1) */
|
||||
main_phys_addr = pci_resource_start(pcidev, 1);
|
||||
writel(main_phys_addr | WENAB, mite_base + MITE_IODWBSR);
|
||||
|
||||
/* finished with MITE registers */
|
||||
iounmap(mite_base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int labpc_pci_auto_attach(struct comedi_device *dev,
|
||||
unsigned long context)
|
||||
{
|
||||
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
|
||||
const struct labpc_boardinfo *board = NULL;
|
||||
struct labpc_private *devpriv;
|
||||
void __iomem *mmio;
|
||||
int ret;
|
||||
|
||||
if (context < ARRAY_SIZE(labpc_pci_boards))
|
||||
|
@ -72,27 +95,26 @@ static int labpc_pci_auto_attach(struct comedi_device *dev,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = labpc_pci_mite_init(pcidev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
mmio = pci_ioremap_bar(pcidev, 1);
|
||||
if (!mmio)
|
||||
return -ENOMEM;
|
||||
dev->iobase = (unsigned long)mmio;
|
||||
|
||||
devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
|
||||
if (!devpriv)
|
||||
return -ENOMEM;
|
||||
|
||||
devpriv->mite = mite_alloc(pcidev);
|
||||
if (!devpriv->mite)
|
||||
return -ENOMEM;
|
||||
ret = mite_setup(devpriv->mite);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
dev->iobase = (unsigned long)devpriv->mite->daq_io_addr;
|
||||
|
||||
return labpc_common_attach(dev, pcidev->irq, IRQF_SHARED);
|
||||
}
|
||||
|
||||
static void labpc_pci_detach(struct comedi_device *dev)
|
||||
{
|
||||
struct labpc_private *devpriv = dev->private;
|
||||
|
||||
if (devpriv)
|
||||
mite_detach(devpriv->mite);
|
||||
if (dev->iobase)
|
||||
iounmap((void __iomem *)dev->iobase);
|
||||
if (dev->irq)
|
||||
free_irq(dev->irq, dev);
|
||||
comedi_pci_disable(dev);
|
||||
|
|
Loading…
Reference in a new issue