Commit 9a1f7223 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: rtd520: add a few comments

H Hartley Sweeten's recent series of patches to clean up the rtd520
driver made some of the register accesses harder to understand.  Add a
few comments to provide some clues to the reader.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3cdefc92
...@@ -494,6 +494,7 @@ static int rtd520_probe_fifo_depth(struct comedi_device *dev) ...@@ -494,6 +494,7 @@ static int rtd520_probe_fifo_depth(struct comedi_device *dev)
writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR);
rtd_load_channelgain_list(dev, 1, &chanspec); rtd_load_channelgain_list(dev, 1, &chanspec);
/* ADC conversion trigger source: SOFTWARE */
writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); writel(0, devpriv->las0 + LAS0_ADC_CONVERSION);
/* convert samples */ /* convert samples */
for (i = 0; i < limit; ++i) { for (i = 0; i < limit; ++i) {
...@@ -544,7 +545,7 @@ static int rtd_ai_rinsn(struct comedi_device *dev, ...@@ -544,7 +545,7 @@ static int rtd_ai_rinsn(struct comedi_device *dev,
/* write channel to multiplexer and clear channel gain table */ /* write channel to multiplexer and clear channel gain table */
rtd_load_channelgain_list(dev, 1, &insn->chanspec); rtd_load_channelgain_list(dev, 1, &insn->chanspec);
/* set conversion source */ /* ADC conversion trigger source: SOFTWARE */
writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); writel(0, devpriv->las0 + LAS0_ADC_CONVERSION);
/* convert n samples */ /* convert n samples */
...@@ -908,8 +909,9 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ ...@@ -908,8 +909,9 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */
/* fall into transferDone */ /* fall into transferDone */
transferDone: transferDone:
/* pacer stop source: SOFTWARE */
writel(0, devpriv->las0 + LAS0_PACER_STOP); writel(0, devpriv->las0 + LAS0_PACER_STOP);
writel(0, devpriv->las0 + LAS0_PACER); writel(0, devpriv->las0 + LAS0_PACER); /* stop pacer */
writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); writel(0, devpriv->las0 + LAS0_ADC_CONVERSION);
devpriv->intMask = 0; devpriv->intMask = 0;
writew(devpriv->intMask, devpriv->las0 + LAS0_IT); writew(devpriv->intMask, devpriv->las0 + LAS0_IT);
...@@ -1180,8 +1182,9 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1180,8 +1182,9 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
int timer; int timer;
/* stop anything currently running */ /* stop anything currently running */
/* pacer stop source: SOFTWARE */
writel(0, devpriv->las0 + LAS0_PACER_STOP); writel(0, devpriv->las0 + LAS0_PACER_STOP);
writel(0, devpriv->las0 + LAS0_PACER); writel(0, devpriv->las0 + LAS0_PACER); /* stop pacer */
writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); writel(0, devpriv->las0 + LAS0_ADC_CONVERSION);
devpriv->intMask = 0; devpriv->intMask = 0;
writew(devpriv->intMask, devpriv->las0 + LAS0_IT); writew(devpriv->intMask, devpriv->las0 + LAS0_IT);
...@@ -1215,12 +1218,17 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1215,12 +1218,17 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
/* setup the common case and override if needed */ /* setup the common case and override if needed */
if (cmd->chanlist_len > 1) { if (cmd->chanlist_len > 1) {
/*DPRINTK ("rtd520: Multi channel setup\n"); */ /*DPRINTK ("rtd520: Multi channel setup\n"); */
/* pacer start source: SOFTWARE */
writel(0, devpriv->las0 + LAS0_PACER_START); writel(0, devpriv->las0 + LAS0_PACER_START);
/* burst trigger source: PACER */
writel(1, devpriv->las0 + LAS0_BURST_START); writel(1, devpriv->las0 + LAS0_BURST_START);
/* ADC conversion trigger source: BURST */
writel(2, devpriv->las0 + LAS0_ADC_CONVERSION); writel(2, devpriv->las0 + LAS0_ADC_CONVERSION);
} else { /* single channel */ } else { /* single channel */
/*DPRINTK ("rtd520: single channel setup\n"); */ /*DPRINTK ("rtd520: single channel setup\n"); */
/* pacer start source: SOFTWARE */
writel(0, devpriv->las0 + LAS0_PACER_START); writel(0, devpriv->las0 + LAS0_PACER_START);
/* ADC conversion trigger source: PACER */
writel(1, devpriv->las0 + LAS0_ADC_CONVERSION); writel(1, devpriv->las0 + LAS0_ADC_CONVERSION);
} }
writel((devpriv->fifoLen / 2 - 1) & 0xffff, devpriv->las0 + LAS0_ACNT); writel((devpriv->fifoLen / 2 - 1) & 0xffff, devpriv->las0 + LAS0_ACNT);
...@@ -1269,7 +1277,9 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1269,7 +1277,9 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->transCount = 0; devpriv->transCount = 0;
devpriv->flags &= ~SEND_EOS; devpriv->flags &= ~SEND_EOS;
} }
/* pacer clock source: INTERNAL 8MHz */
writel(1, devpriv->las0 + LAS0_PACER_SELECT); writel(1, devpriv->las0 + LAS0_PACER_SELECT);
/* just interrupt, don't stop */
writel(1, devpriv->las0 + LAS0_ACNT_STOP_ENABLE); writel(1, devpriv->las0 + LAS0_ACNT_STOP_ENABLE);
/* BUG??? these look like enumerated values, but they are bit fields */ /* BUG??? these look like enumerated values, but they are bit fields */
...@@ -1305,6 +1315,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1305,6 +1315,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
break; break;
case TRIG_EXT: case TRIG_EXT:
/* pacer start source: EXTERNAL */
writel(1, devpriv->las0 + LAS0_PACER_START); writel(1, devpriv->las0 + LAS0_PACER_START);
break; break;
...@@ -1327,6 +1338,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1327,6 +1338,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
break; break;
case TRIG_EXT: /* external */ case TRIG_EXT: /* external */
/* burst trigger source: EXTERNAL */
writel(2, devpriv->las0 + LAS0_BURST_START); writel(2, devpriv->las0 + LAS0_BURST_START);
break; break;
...@@ -1378,7 +1390,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1378,7 +1390,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
/* BUG: start_src is ASSUMED to be TRIG_NOW */ /* BUG: start_src is ASSUMED to be TRIG_NOW */
/* BUG? it seems like things are running before the "start" */ /* BUG? it seems like things are running before the "start" */
readl(devpriv->las0 + LAS0_PACER); readl(devpriv->las0 + LAS0_PACER); /* start pacer */
return 0; return 0;
} }
...@@ -1391,8 +1403,9 @@ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1391,8 +1403,9 @@ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
u32 overrun; u32 overrun;
u16 status; u16 status;
/* pacer stop source: SOFTWARE */
writel(0, devpriv->las0 + LAS0_PACER_STOP); writel(0, devpriv->las0 + LAS0_PACER_STOP);
writel(0, devpriv->las0 + LAS0_PACER); writel(0, devpriv->las0 + LAS0_PACER); /* stop pacer */
writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); writel(0, devpriv->las0 + LAS0_ADC_CONVERSION);
devpriv->intMask = 0; devpriv->intMask = 0;
writew(devpriv->intMask, devpriv->las0 + LAS0_IT); writew(devpriv->intMask, devpriv->las0 + LAS0_IT);
......
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