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

staging: comedi: addi_apci_3xxx: rename 'dw_AiBase' in private data

This variable holds the ioremap'ed PCI bar 3 used to read/write the
analog input and output registers. Rename it to simply 'mmio'.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dc633646
......@@ -27,7 +27,7 @@ static int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev)
{
struct apci3xxx_private *devpriv = dev->private;
if ((readl(devpriv->dw_AiBase + 8) & 0x80000UL) == 0x80000UL)
if ((readl(devpriv->mmio + 8) & 0x80000) == 0x80000)
return 1;
else
return 0;
......@@ -164,13 +164,13 @@ static int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev,
/*******************************/
writel((unsigned int)b_TimeBase,
devpriv->dw_AiBase + 36);
devpriv->mmio + 36);
/**************************/
/* Set the convert timing */
/*************************/
writel(dw_ReloadValue, devpriv->dw_AiBase + 32);
writel(dw_ReloadValue, devpriv->mmio + 32);
} else {
/**************************/
/* Any conversion started */
......@@ -304,29 +304,29 @@ static int apci3xxx_ai_insn_read(struct comedi_device *dev,
return -EBUSY;
/* Clear the FIFO */
writel(0x10000, devpriv->dw_AiBase + 12);
writel(0x10000, devpriv->mmio + 12);
/* Get and save the delay mode */
delay_mode = readl(devpriv->dw_AiBase + 4);
delay_mode = readl(devpriv->mmio + 4);
delay_mode &= 0xfffffef0;
/* Channel configuration selection */
writel(delay_mode, devpriv->dw_AiBase + 4);
writel(delay_mode, devpriv->mmio + 4);
/* Make the configuration */
val = (range & 3) | ((range >> 2) << 6) |
(devpriv->b_SingelDiff << 7);
writel(val, devpriv->dw_AiBase + 0);
writel(val, devpriv->mmio + 0);
/* Channel selection */
writel(delay_mode | 0x100, devpriv->dw_AiBase + 4);
writel(chan, devpriv->dw_AiBase + 0);
writel(delay_mode | 0x100, devpriv->mmio + 4);
writel(chan, devpriv->mmio + 0);
/* Restore delay mode */
writel(delay_mode, devpriv->dw_AiBase + 4);
writel(delay_mode, devpriv->mmio + 4);
/* Set the number of sequence to 1 */
writel(1, devpriv->dw_AiBase + 48);
writel(1, devpriv->mmio + 48);
/* Save the interrupt flag */
devpriv->b_EocEosInterrupt = use_interrupt;
......@@ -338,20 +338,20 @@ static int apci3xxx_ai_insn_read(struct comedi_device *dev,
if (!use_interrupt) {
for (i = 0; i < insn->n; i++) {
/* Start the conversion */
writel(0x80000, devpriv->dw_AiBase + 8);
writel(0x80000, devpriv->mmio + 8);
/* Wait the EOS */
do {
val = readl(devpriv->dw_AiBase + 20);
val = readl(devpriv->mmio + 20);
val &= 0x1;
} while (!val);
/* Read the analog value */
data[i] = readl(devpriv->dw_AiBase + 28);
data[i] = readl(devpriv->mmio + 28);
}
} else {
/* Start the conversion */
writel(0x180000, devpriv->dw_AiBase + 8);
writel(0x180000, devpriv->mmio + 8);
}
return insn->n;
......
......@@ -367,7 +367,7 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
};
struct apci3xxx_private {
void __iomem *dw_AiBase;
void __iomem *mmio;
unsigned int ui_AiNbrofChannels; /* how many channels is measured */
unsigned int ui_AiReadData[32];
unsigned char b_EocEosInterrupt;
......@@ -387,10 +387,10 @@ static irqreturn_t apci3xxx_irq_handler(int irq, void *d)
int i;
/* Test if interrupt occur */
status = readl(devpriv->dw_AiBase + 16);
status = readl(devpriv->mmio + 16);
if ((status & 0x2) == 0x2) {
/* Reset the interrupt */
writel(status, devpriv->dw_AiBase + 16);
writel(status, devpriv->mmio + 16);
/* Test if interrupt enabled */
if (devpriv->b_EocEosInterrupt == 1) {
......@@ -398,7 +398,7 @@ static irqreturn_t apci3xxx_irq_handler(int irq, void *d)
for (i = 0; i < devpriv->ui_AiNbrofChannels; i++) {
unsigned int val;
val = readl(devpriv->dw_AiBase + 28);
val = readl(devpriv->mmio + 28);
devpriv->ui_AiReadData[i] = val;
}
......@@ -425,14 +425,14 @@ static int apci3xxx_ao_insn_write(struct comedi_device *dev,
for (i = 0; i < insn->n; i++) {
/* Set the range selection */
writel(range, devpriv->dw_AiBase + 96);
writel(range, devpriv->mmio + 96);
/* Write the analog value to the selected channel */
writel((data[i] << 8) | chan, devpriv->dw_AiBase + 100);
writel((data[i] << 8) | chan, devpriv->mmio + 100);
/* Wait the end of transfer */
do {
status = readl(devpriv->dw_AiBase + 96);
status = readl(devpriv->mmio + 96);
} while ((status & 0x100) != 0x100);
}
......@@ -558,18 +558,18 @@ static int apci3xxx_reset(struct comedi_device *dev)
devpriv->b_EocEosInterrupt = 0;
/* Clear the start command */
writel(0, devpriv->dw_AiBase + 8);
writel(0, devpriv->mmio + 8);
/* Reset the interrupt flags */
val = readl(devpriv->dw_AiBase + 16);
writel(val, devpriv->dw_AiBase + 16);
val = readl(devpriv->mmio + 16);
writel(val, devpriv->mmio + 16);
/* clear the EOS */
readl(devpriv->dw_AiBase + 20);
readl(devpriv->mmio + 20);
/* Clear the FIFO */
for (i = 0; i < 16; i++)
val = readl(devpriv->dw_AiBase + 28);
val = readl(devpriv->mmio + 28);
/* Enable the interrupt */
enable_irq(dev->irq);
......@@ -603,7 +603,7 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
return ret;
dev->iobase = pci_resource_start(pcidev, 2);
devpriv->dw_AiBase = pci_ioremap_bar(pcidev, 3);
devpriv->mmio = pci_ioremap_bar(pcidev, 3);
if (pcidev->irq > 0) {
ret = request_irq(pcidev->irq, apci3xxx_irq_handler,
......@@ -717,8 +717,8 @@ static void apci3xxx_detach(struct comedi_device *dev)
apci3xxx_reset(dev);
if (dev->irq)
free_irq(dev->irq, dev);
if (devpriv->dw_AiBase)
iounmap(devpriv->dw_AiBase);
if (devpriv->mmio)
iounmap(devpriv->mmio);
}
comedi_pci_disable(dev);
}
......
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