Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 324950
b: refs/heads/master
c: ba98ab0
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Sep 8, 2012
1 parent dac8ea1 commit eebf681
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 54 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9e07273124d5586c4a59c4191cdd1e3743e978f3
refs/heads/master: ba98ab03f762696180227e015a13f1bac0a11f60
67 changes: 22 additions & 45 deletions trunk/drivers/staging/comedi/drivers/me4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_ai_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 reset_board(struct comedi_device *dev);

Expand Down Expand Up @@ -361,15 +360,6 @@ static int me4000_probe(struct comedi_device *dev, struct comedi_devconfig *it)
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 */
result = xilinx_download(dev);
if (result) {
Expand Down Expand Up @@ -599,19 +589,6 @@ static int init_dio_context(struct comedi_device *dev)
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
#if FIRMWARE_NOT_AVAILABLE
extern unsigned char *xilinx_firm;
Expand Down Expand Up @@ -1907,19 +1884,19 @@ static int cnt_reset(struct comedi_device *dev, unsigned int channel)
{
switch (channel) {
case 0:
outb(0x30, info->cnt_context.ctrl_reg);
outb(0x00, info->cnt_context.counter_0_reg);
outb(0x00, info->cnt_context.counter_0_reg);
outb(0x30, info->timer_regbase + ME4000_CNT_CTRL_REG);
outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
break;
case 1:
outb(0x70, info->cnt_context.ctrl_reg);
outb(0x00, info->cnt_context.counter_1_reg);
outb(0x00, info->cnt_context.counter_1_reg);
outb(0x70, info->timer_regbase + ME4000_CNT_CTRL_REG);
outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
break;
case 2:
outb(0xB0, info->cnt_context.ctrl_reg);
outb(0x00, info->cnt_context.counter_2_reg);
outb(0x00, info->cnt_context.counter_2_reg);
outb(0xB0, info->timer_regbase + ME4000_CNT_CTRL_REG);
outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
break;
default:
printk(KERN_ERR
Expand Down Expand Up @@ -1981,7 +1958,7 @@ static int cnt_config(struct comedi_device *dev, unsigned int channel,

/* Write the control word */
tmp |= 0x30;
outb(tmp, info->cnt_context.ctrl_reg);
outb(tmp, info->timer_regbase + ME4000_CNT_CTRL_REG);

return 0;
}
Expand Down Expand Up @@ -2050,21 +2027,21 @@ static int me4000_cnt_insn_read(struct comedi_device *dev,

switch (insn->chanspec) {
case 0:
tmp = inb(info->cnt_context.counter_0_reg);
tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
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;
break;
case 1:
tmp = inb(info->cnt_context.counter_1_reg);
tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
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;
break;
case 2:
tmp = inb(info->cnt_context.counter_2_reg);
tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
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;
break;
default:
Expand Down Expand Up @@ -2098,21 +2075,21 @@ static int me4000_cnt_insn_write(struct comedi_device *dev,
switch (insn->chanspec) {
case 0:
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;
outb(tmp, info->cnt_context.counter_0_reg);
outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
break;
case 1:
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;
outb(tmp, info->cnt_context.counter_1_reg);
outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
break;
case 2:
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;
outb(tmp, info->cnt_context.counter_2_reg);
outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
break;
default:
printk(KERN_ERR
Expand Down
8 changes: 0 additions & 8 deletions trunk/drivers/staging/comedi/drivers/me4000.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,6 @@ struct me4000_dio_context {
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 {
unsigned long plx_regbase; /* PLX configuration space base address */
unsigned long me4000_regbase; /* Base address of the ME4000 */
Expand All @@ -304,7 +297,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 */
struct me4000_cnt_context cnt_context; /* Counter specific context */
};

#define info ((struct me4000_info *)dev->private)
Expand Down

0 comments on commit eebf681

Please sign in to comment.