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

staging: comedi: me4000: remove dio context

The dio context is a struct containing all the register addresses
used with the dio subdevice. These can easily be calculated when
needed. Remove the me4000_dio_context struct, its intialization
function, and it's variable in the private data.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 362bcbde
......@@ -219,7 +219,6 @@ static int init_board_info(struct comedi_device *dev,
struct pci_dev *pci_dev_p);
static int init_ao_context(struct comedi_device *dev);
static int init_ai_context(struct comedi_device *dev);
static int init_dio_context(struct comedi_device *dev);
static int xilinx_download(struct comedi_device *dev);
static int reset_board(struct comedi_device *dev);
......@@ -325,10 +324,6 @@ static int me4000_probe(struct comedi_device *dev, struct comedi_devconfig *it)
if (result)
return result;
result = init_dio_context(dev);
if (result)
return result;
result = xilinx_download(dev);
if (result)
return result;
......@@ -483,22 +478,6 @@ static int init_ai_context(struct comedi_device *dev)
return 0;
}
static int init_dio_context(struct comedi_device *dev)
{
info->dio_context.dir_reg = dev->iobase + ME4000_DIO_DIR_REG;
info->dio_context.ctrl_reg = dev->iobase + ME4000_DIO_CTRL_REG;
info->dio_context.port_0_reg =
dev->iobase + ME4000_DIO_PORT_0_REG;
info->dio_context.port_1_reg =
dev->iobase + ME4000_DIO_PORT_1_REG;
info->dio_context.port_2_reg =
dev->iobase + ME4000_DIO_PORT_2_REG;
info->dio_context.port_3_reg =
dev->iobase + ME4000_DIO_PORT_3_REG;
return 0;
}
#define FIRMWARE_NOT_AVAILABLE 1
#if FIRMWARE_NOT_AVAILABLE
extern unsigned char *xilinx_firm;
......@@ -1671,21 +1650,21 @@ static int me4000_dio_insn_bits(struct comedi_device *dev,
/* Write out the new digital output lines */
outl((s->state >> 0) & 0xFF,
info->dio_context.port_0_reg);
dev->iobase + ME4000_DIO_PORT_0_REG);
outl((s->state >> 8) & 0xFF,
info->dio_context.port_1_reg);
dev->iobase + ME4000_DIO_PORT_1_REG);
outl((s->state >> 16) & 0xFF,
info->dio_context.port_2_reg);
dev->iobase + ME4000_DIO_PORT_2_REG);
outl((s->state >> 24) & 0xFF,
info->dio_context.port_3_reg);
dev->iobase + ME4000_DIO_PORT_3_REG);
}
/* On return, data[1] contains the value of
the digital input and output lines. */
data[1] = ((inl(info->dio_context.port_0_reg) & 0xFF) << 0) |
((inl(info->dio_context.port_1_reg) & 0xFF) << 8) |
((inl(info->dio_context.port_2_reg) & 0xFF) << 16) |
((inl(info->dio_context.port_3_reg) & 0xFF) << 24);
data[1] = ((inl(dev->iobase + ME4000_DIO_PORT_0_REG) & 0xFF) << 0) |
((inl(dev->iobase + ME4000_DIO_PORT_1_REG) & 0xFF) << 8) |
((inl(dev->iobase + ME4000_DIO_PORT_2_REG) & 0xFF) << 16) |
((inl(dev->iobase + ME4000_DIO_PORT_3_REG) & 0xFF) << 24);
return insn->n;
}
......@@ -1717,7 +1696,7 @@ static int me4000_dio_insn_config(struct comedi_device *dev,
* On the ME-4000 it is only possible to switch port wise (8 bit)
*/
tmp = inl(info->dio_context.ctrl_reg);
tmp = inl(dev->iobase + ME4000_DIO_CTRL_REG);
if (data[0] == INSN_CONFIG_DIO_OUTPUT) {
if (chan < 8) {
......@@ -1731,7 +1710,7 @@ static int me4000_dio_insn_config(struct comedi_device *dev,
* If one the first port is a fixed output
* port and the second is a fixed input port.
*/
if (!inl(info->dio_context.dir_reg))
if (!inl(dev->iobase + ME4000_DIO_DIR_REG))
return -ENODEV;
s->io_bits |= 0xFF00;
......@@ -1758,7 +1737,7 @@ static int me4000_dio_insn_config(struct comedi_device *dev,
* If one the first port is a fixed output
* port and the second is a fixed input port.
*/
if (!inl(info->dio_context.dir_reg))
if (!inl(dev->iobase + ME4000_DIO_DIR_REG))
return -ENODEV;
s->io_bits &= ~0xFF;
......@@ -1781,7 +1760,7 @@ static int me4000_dio_insn_config(struct comedi_device *dev,
}
}
outl(tmp, info->dio_context.ctrl_reg);
outl(tmp, dev->iobase + ME4000_DIO_CTRL_REG);
return 1;
}
......@@ -2105,9 +2084,10 @@ static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
* Check for optoisolated ME-4000 version. If one the first
* port is a fixed output port and the second is a fixed input port.
*/
if (!inl(info->dio_context.dir_reg)) {
if (!inl(dev->iobase + ME4000_DIO_DIR_REG)) {
s->io_bits |= 0xFF;
outl(ME4000_DIO_CTRL_BIT_MODE_0, info->dio_context.dir_reg);
outl(ME4000_DIO_CTRL_BIT_MODE_0,
dev->iobase + ME4000_DIO_DIR_REG);
}
/*=========================================================================
......
......@@ -265,15 +265,6 @@ struct me4000_ai_context {
unsigned long sample_counter_reg;
};
struct me4000_dio_context {
unsigned long dir_reg;
unsigned long ctrl_reg;
unsigned long port_0_reg;
unsigned long port_1_reg;
unsigned long port_2_reg;
unsigned long port_3_reg;
};
struct me4000_info {
unsigned long plx_regbase; /* PLX configuration space base address */
unsigned long timer_regbase; /* Base address of the timer circuit */
......@@ -290,7 +281,6 @@ struct me4000_info {
struct me4000_ai_context ai_context; /* Analog input specific context */
struct me4000_ao_context ao_context[4]; /* Vector with analog output specific context */
struct me4000_dio_context dio_context; /* Digital I/O specific context */
};
#define info ((struct me4000_info *)dev->private)
......
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