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

staging: comedi: me4000: remove struct me4000_cnt_context

The me4000_cnt_contect simply holds the unsigned long i/o addresses
used to read/write the counter registers. Thes can be calculated
as needed. Remove the struct and the associated field 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 9e072731
...@@ -221,7 +221,6 @@ static int init_board_info(struct comedi_device *dev, ...@@ -221,7 +221,6 @@ static int init_board_info(struct comedi_device *dev,
static int init_ao_context(struct comedi_device *dev); static int init_ao_context(struct comedi_device *dev);
static int init_ai_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 init_dio_context(struct comedi_device *dev);
static int init_cnt_context(struct comedi_device *dev);
static int xilinx_download(struct comedi_device *dev); static int xilinx_download(struct comedi_device *dev);
static int reset_board(struct comedi_device *dev); static int reset_board(struct comedi_device *dev);
...@@ -361,15 +360,6 @@ static int me4000_probe(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -361,15 +360,6 @@ static int me4000_probe(struct comedi_device *dev, struct comedi_devconfig *it)
return result; return result;
} }
/* Init counter context */
result = init_cnt_context(dev);
if (result) {
printk(KERN_ERR
"comedi%d: me4000: me4000_probe(): "
"Cannot init cnt context\n", dev->minor);
return result;
}
/* Download the xilinx firmware */ /* Download the xilinx firmware */
result = xilinx_download(dev); result = xilinx_download(dev);
if (result) { if (result) {
...@@ -599,19 +589,6 @@ static int init_dio_context(struct comedi_device *dev) ...@@ -599,19 +589,6 @@ static int init_dio_context(struct comedi_device *dev)
return 0; return 0;
} }
static int init_cnt_context(struct comedi_device *dev)
{
info->cnt_context.ctrl_reg = info->timer_regbase + ME4000_CNT_CTRL_REG;
info->cnt_context.counter_0_reg =
info->timer_regbase + ME4000_CNT_COUNTER_0_REG;
info->cnt_context.counter_1_reg =
info->timer_regbase + ME4000_CNT_COUNTER_1_REG;
info->cnt_context.counter_2_reg =
info->timer_regbase + ME4000_CNT_COUNTER_2_REG;
return 0;
}
#define FIRMWARE_NOT_AVAILABLE 1 #define FIRMWARE_NOT_AVAILABLE 1
#if FIRMWARE_NOT_AVAILABLE #if FIRMWARE_NOT_AVAILABLE
extern unsigned char *xilinx_firm; extern unsigned char *xilinx_firm;
...@@ -1907,19 +1884,19 @@ static int cnt_reset(struct comedi_device *dev, unsigned int channel) ...@@ -1907,19 +1884,19 @@ static int cnt_reset(struct comedi_device *dev, unsigned int channel)
{ {
switch (channel) { switch (channel) {
case 0: case 0:
outb(0x30, info->cnt_context.ctrl_reg); outb(0x30, info->timer_regbase + ME4000_CNT_CTRL_REG);
outb(0x00, info->cnt_context.counter_0_reg); outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
outb(0x00, info->cnt_context.counter_0_reg); outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
break; break;
case 1: case 1:
outb(0x70, info->cnt_context.ctrl_reg); outb(0x70, info->timer_regbase + ME4000_CNT_CTRL_REG);
outb(0x00, info->cnt_context.counter_1_reg); outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
outb(0x00, info->cnt_context.counter_1_reg); outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
break; break;
case 2: case 2:
outb(0xB0, info->cnt_context.ctrl_reg); outb(0xB0, info->timer_regbase + ME4000_CNT_CTRL_REG);
outb(0x00, info->cnt_context.counter_2_reg); outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
outb(0x00, info->cnt_context.counter_2_reg); outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
break; break;
default: default:
printk(KERN_ERR printk(KERN_ERR
...@@ -1981,7 +1958,7 @@ static int cnt_config(struct comedi_device *dev, unsigned int channel, ...@@ -1981,7 +1958,7 @@ static int cnt_config(struct comedi_device *dev, unsigned int channel,
/* Write the control word */ /* Write the control word */
tmp |= 0x30; tmp |= 0x30;
outb(tmp, info->cnt_context.ctrl_reg); outb(tmp, info->timer_regbase + ME4000_CNT_CTRL_REG);
return 0; return 0;
} }
...@@ -2050,21 +2027,21 @@ static int me4000_cnt_insn_read(struct comedi_device *dev, ...@@ -2050,21 +2027,21 @@ static int me4000_cnt_insn_read(struct comedi_device *dev,
switch (insn->chanspec) { switch (insn->chanspec) {
case 0: case 0:
tmp = inb(info->cnt_context.counter_0_reg); tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
data[0] = tmp; data[0] = tmp;
tmp = inb(info->cnt_context.counter_0_reg); tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
data[0] |= tmp << 8; data[0] |= tmp << 8;
break; break;
case 1: case 1:
tmp = inb(info->cnt_context.counter_1_reg); tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
data[0] = tmp; data[0] = tmp;
tmp = inb(info->cnt_context.counter_1_reg); tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
data[0] |= tmp << 8; data[0] |= tmp << 8;
break; break;
case 2: case 2:
tmp = inb(info->cnt_context.counter_2_reg); tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
data[0] = tmp; data[0] = tmp;
tmp = inb(info->cnt_context.counter_2_reg); tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
data[0] |= tmp << 8; data[0] |= tmp << 8;
break; break;
default: default:
...@@ -2098,21 +2075,21 @@ static int me4000_cnt_insn_write(struct comedi_device *dev, ...@@ -2098,21 +2075,21 @@ static int me4000_cnt_insn_write(struct comedi_device *dev,
switch (insn->chanspec) { switch (insn->chanspec) {
case 0: case 0:
tmp = data[0] & 0xFF; tmp = data[0] & 0xFF;
outb(tmp, info->cnt_context.counter_0_reg); outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
tmp = (data[0] >> 8) & 0xFF; tmp = (data[0] >> 8) & 0xFF;
outb(tmp, info->cnt_context.counter_0_reg); outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
break; break;
case 1: case 1:
tmp = data[0] & 0xFF; tmp = data[0] & 0xFF;
outb(tmp, info->cnt_context.counter_1_reg); outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
tmp = (data[0] >> 8) & 0xFF; tmp = (data[0] >> 8) & 0xFF;
outb(tmp, info->cnt_context.counter_1_reg); outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
break; break;
case 2: case 2:
tmp = data[0] & 0xFF; tmp = data[0] & 0xFF;
outb(tmp, info->cnt_context.counter_2_reg); outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
tmp = (data[0] >> 8) & 0xFF; tmp = (data[0] >> 8) & 0xFF;
outb(tmp, info->cnt_context.counter_2_reg); outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
break; break;
default: default:
printk(KERN_ERR printk(KERN_ERR
......
...@@ -274,13 +274,6 @@ struct me4000_dio_context { ...@@ -274,13 +274,6 @@ struct me4000_dio_context {
unsigned long port_3_reg; unsigned long port_3_reg;
}; };
struct me4000_cnt_context {
unsigned long ctrl_reg;
unsigned long counter_0_reg;
unsigned long counter_1_reg;
unsigned long counter_2_reg;
};
struct me4000_info { struct me4000_info {
unsigned long plx_regbase; /* PLX configuration space base address */ unsigned long plx_regbase; /* PLX configuration space base address */
unsigned long me4000_regbase; /* Base address of the ME4000 */ unsigned long me4000_regbase; /* Base address of the ME4000 */
...@@ -304,7 +297,6 @@ struct me4000_info { ...@@ -304,7 +297,6 @@ struct me4000_info {
struct me4000_ai_context ai_context; /* Analog input specific context */ 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_ao_context ao_context[4]; /* Vector with analog output specific context */
struct me4000_dio_context dio_context; /* Digital I/O specific context */ struct me4000_dio_context dio_context; /* Digital I/O specific context */
struct me4000_cnt_context cnt_context; /* Counter specific context */
}; };
#define info ((struct me4000_info *)dev->private) #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