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) ...@@ -27,7 +27,7 @@ static int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev)
{ {
struct apci3xxx_private *devpriv = dev->private; struct apci3xxx_private *devpriv = dev->private;
if ((readl(devpriv->dw_AiBase + 8) & 0x80000UL) == 0x80000UL) if ((readl(devpriv->mmio + 8) & 0x80000) == 0x80000)
return 1; return 1;
else else
return 0; return 0;
...@@ -164,13 +164,13 @@ static int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, ...@@ -164,13 +164,13 @@ static int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev,
/*******************************/ /*******************************/
writel((unsigned int)b_TimeBase, writel((unsigned int)b_TimeBase,
devpriv->dw_AiBase + 36); devpriv->mmio + 36);
/**************************/ /**************************/
/* Set the convert timing */ /* Set the convert timing */
/*************************/ /*************************/
writel(dw_ReloadValue, devpriv->dw_AiBase + 32); writel(dw_ReloadValue, devpriv->mmio + 32);
} else { } else {
/**************************/ /**************************/
/* Any conversion started */ /* Any conversion started */
...@@ -304,29 +304,29 @@ static int apci3xxx_ai_insn_read(struct comedi_device *dev, ...@@ -304,29 +304,29 @@ static int apci3xxx_ai_insn_read(struct comedi_device *dev,
return -EBUSY; return -EBUSY;
/* Clear the FIFO */ /* Clear the FIFO */
writel(0x10000, devpriv->dw_AiBase + 12); writel(0x10000, devpriv->mmio + 12);
/* Get and save the delay mode */ /* Get and save the delay mode */
delay_mode = readl(devpriv->dw_AiBase + 4); delay_mode = readl(devpriv->mmio + 4);
delay_mode &= 0xfffffef0; delay_mode &= 0xfffffef0;
/* Channel configuration selection */ /* Channel configuration selection */
writel(delay_mode, devpriv->dw_AiBase + 4); writel(delay_mode, devpriv->mmio + 4);
/* Make the configuration */ /* Make the configuration */
val = (range & 3) | ((range >> 2) << 6) | val = (range & 3) | ((range >> 2) << 6) |
(devpriv->b_SingelDiff << 7); (devpriv->b_SingelDiff << 7);
writel(val, devpriv->dw_AiBase + 0); writel(val, devpriv->mmio + 0);
/* Channel selection */ /* Channel selection */
writel(delay_mode | 0x100, devpriv->dw_AiBase + 4); writel(delay_mode | 0x100, devpriv->mmio + 4);
writel(chan, devpriv->dw_AiBase + 0); writel(chan, devpriv->mmio + 0);
/* Restore delay mode */ /* Restore delay mode */
writel(delay_mode, devpriv->dw_AiBase + 4); writel(delay_mode, devpriv->mmio + 4);
/* Set the number of sequence to 1 */ /* Set the number of sequence to 1 */
writel(1, devpriv->dw_AiBase + 48); writel(1, devpriv->mmio + 48);
/* Save the interrupt flag */ /* Save the interrupt flag */
devpriv->b_EocEosInterrupt = use_interrupt; devpriv->b_EocEosInterrupt = use_interrupt;
...@@ -338,20 +338,20 @@ static int apci3xxx_ai_insn_read(struct comedi_device *dev, ...@@ -338,20 +338,20 @@ static int apci3xxx_ai_insn_read(struct comedi_device *dev,
if (!use_interrupt) { if (!use_interrupt) {
for (i = 0; i < insn->n; i++) { for (i = 0; i < insn->n; i++) {
/* Start the conversion */ /* Start the conversion */
writel(0x80000, devpriv->dw_AiBase + 8); writel(0x80000, devpriv->mmio + 8);
/* Wait the EOS */ /* Wait the EOS */
do { do {
val = readl(devpriv->dw_AiBase + 20); val = readl(devpriv->mmio + 20);
val &= 0x1; val &= 0x1;
} while (!val); } while (!val);
/* Read the analog value */ /* Read the analog value */
data[i] = readl(devpriv->dw_AiBase + 28); data[i] = readl(devpriv->mmio + 28);
} }
} else { } else {
/* Start the conversion */ /* Start the conversion */
writel(0x180000, devpriv->dw_AiBase + 8); writel(0x180000, devpriv->mmio + 8);
} }
return insn->n; return insn->n;
......
...@@ -367,7 +367,7 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = { ...@@ -367,7 +367,7 @@ static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = {
}; };
struct apci3xxx_private { struct apci3xxx_private {
void __iomem *dw_AiBase; void __iomem *mmio;
unsigned int ui_AiNbrofChannels; /* how many channels is measured */ unsigned int ui_AiNbrofChannels; /* how many channels is measured */
unsigned int ui_AiReadData[32]; unsigned int ui_AiReadData[32];
unsigned char b_EocEosInterrupt; unsigned char b_EocEosInterrupt;
...@@ -387,10 +387,10 @@ static irqreturn_t apci3xxx_irq_handler(int irq, void *d) ...@@ -387,10 +387,10 @@ static irqreturn_t apci3xxx_irq_handler(int irq, void *d)
int i; int i;
/* Test if interrupt occur */ /* Test if interrupt occur */
status = readl(devpriv->dw_AiBase + 16); status = readl(devpriv->mmio + 16);
if ((status & 0x2) == 0x2) { if ((status & 0x2) == 0x2) {
/* Reset the interrupt */ /* Reset the interrupt */
writel(status, devpriv->dw_AiBase + 16); writel(status, devpriv->mmio + 16);
/* Test if interrupt enabled */ /* Test if interrupt enabled */
if (devpriv->b_EocEosInterrupt == 1) { if (devpriv->b_EocEosInterrupt == 1) {
...@@ -398,7 +398,7 @@ static irqreturn_t apci3xxx_irq_handler(int irq, void *d) ...@@ -398,7 +398,7 @@ static irqreturn_t apci3xxx_irq_handler(int irq, void *d)
for (i = 0; i < devpriv->ui_AiNbrofChannels; i++) { for (i = 0; i < devpriv->ui_AiNbrofChannels; i++) {
unsigned int val; unsigned int val;
val = readl(devpriv->dw_AiBase + 28); val = readl(devpriv->mmio + 28);
devpriv->ui_AiReadData[i] = val; devpriv->ui_AiReadData[i] = val;
} }
...@@ -425,14 +425,14 @@ static int apci3xxx_ao_insn_write(struct comedi_device *dev, ...@@ -425,14 +425,14 @@ static int apci3xxx_ao_insn_write(struct comedi_device *dev,
for (i = 0; i < insn->n; i++) { for (i = 0; i < insn->n; i++) {
/* Set the range selection */ /* Set the range selection */
writel(range, devpriv->dw_AiBase + 96); writel(range, devpriv->mmio + 96);
/* Write the analog value to the selected channel */ /* 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 */ /* Wait the end of transfer */
do { do {
status = readl(devpriv->dw_AiBase + 96); status = readl(devpriv->mmio + 96);
} while ((status & 0x100) != 0x100); } while ((status & 0x100) != 0x100);
} }
...@@ -558,18 +558,18 @@ static int apci3xxx_reset(struct comedi_device *dev) ...@@ -558,18 +558,18 @@ static int apci3xxx_reset(struct comedi_device *dev)
devpriv->b_EocEosInterrupt = 0; devpriv->b_EocEosInterrupt = 0;
/* Clear the start command */ /* Clear the start command */
writel(0, devpriv->dw_AiBase + 8); writel(0, devpriv->mmio + 8);
/* Reset the interrupt flags */ /* Reset the interrupt flags */
val = readl(devpriv->dw_AiBase + 16); val = readl(devpriv->mmio + 16);
writel(val, devpriv->dw_AiBase + 16); writel(val, devpriv->mmio + 16);
/* clear the EOS */ /* clear the EOS */
readl(devpriv->dw_AiBase + 20); readl(devpriv->mmio + 20);
/* Clear the FIFO */ /* Clear the FIFO */
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
val = readl(devpriv->dw_AiBase + 28); val = readl(devpriv->mmio + 28);
/* Enable the interrupt */ /* Enable the interrupt */
enable_irq(dev->irq); enable_irq(dev->irq);
...@@ -603,7 +603,7 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, ...@@ -603,7 +603,7 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
return ret; return ret;
dev->iobase = pci_resource_start(pcidev, 2); 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) { if (pcidev->irq > 0) {
ret = request_irq(pcidev->irq, apci3xxx_irq_handler, ret = request_irq(pcidev->irq, apci3xxx_irq_handler,
...@@ -717,8 +717,8 @@ static void apci3xxx_detach(struct comedi_device *dev) ...@@ -717,8 +717,8 @@ static void apci3xxx_detach(struct comedi_device *dev)
apci3xxx_reset(dev); apci3xxx_reset(dev);
if (dev->irq) if (dev->irq)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (devpriv->dw_AiBase) if (devpriv->mmio)
iounmap(devpriv->dw_AiBase); iounmap(devpriv->mmio);
} }
comedi_pci_disable(dev); 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