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

staging: comedi: addi_apci_1500: tidy up PCI Bar 1 register map

For aesthetics, convert the enum for the PCI Bar 1 register map to
defines and move them to the main driver source file. Rename the
registers.
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 34373cd0
......@@ -50,16 +50,6 @@
#define STOP 1
#define TRIGGER 2
/*
* Zillog I/O enumeration
*/
enum {
APCI1500_Z8536_PORT_C,
APCI1500_Z8536_PORT_B,
APCI1500_Z8536_PORT_A,
APCI1500_Z8536_CONTROL_REGISTER
};
/*
* Z8536 CIO Internal Address
*/
......@@ -136,8 +126,8 @@ static unsigned int z8536_read(struct comedi_device *dev, unsigned int reg)
unsigned int val;
spin_lock_irqsave(&dev->spinlock, flags);
outb(reg, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
val = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(reg, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
val = inb(devpriv->iobase + APCI1500_Z8536_CTRL_REG);
spin_unlock_irqrestore(&dev->spinlock, flags);
return val;
......@@ -150,8 +140,8 @@ static void z8536_write(struct comedi_device *dev,
unsigned long flags;
spin_lock_irqsave(&dev->spinlock, flags);
outb(reg, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(val, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(reg, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
outb(val, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
spin_unlock_irqrestore(&dev->spinlock, flags);
}
......@@ -165,12 +155,12 @@ static void z8536_reset(struct comedi_device *dev)
* sequence will reset it and put it in State 0.
*/
spin_lock_irqsave(&dev->spinlock, flags);
inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(1, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER);
inb(devpriv->iobase + APCI1500_Z8536_CTRL_REG);
outb(0, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
inb(devpriv->iobase + APCI1500_Z8536_CTRL_REG);
outb(0, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
outb(1, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
outb(0, devpriv->iobase + APCI1500_Z8536_CTRL_REG);
spin_unlock_irqrestore(&dev->spinlock, flags);
z8536_write(dev, 0xf4, APCI1500_RW_MASTER_CONFIGURATION_CONTROL);
......@@ -1551,9 +1541,8 @@ static irqreturn_t apci1500_interrupt(int irq, void *d)
z8536_write(dev, i_RegValue,
APCI1500_RW_PORT_B_COMMAND_AND_STATUS);
/* Reads port B */
i_RegValue =
inb((unsigned int) devpriv->iobase +
APCI1500_Z8536_PORT_B);
i_RegValue = inb(devpriv->iobase +
APCI1500_Z8536_PORTB_REG);
i_RegValue = i_RegValue & 0xC0;
/* Tests if this is an external error */
......
......@@ -7,6 +7,14 @@
#include "comedi_fc.h"
#include "amcc_s5933.h"
/*
* PCI Bar 1 Register map (devpriv->iobase)
*/
#define APCI1500_Z8536_PORTC_REG 0x00
#define APCI1500_Z8536_PORTB_REG 0x01
#define APCI1500_Z8536_PORTA_REG 0x02
#define APCI1500_Z8536_CTRL_REG 0x03
struct apci1500_private {
int iobase;
int i_IobaseAmcc;
......
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