aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-04-12 16:39:51 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-15 13:55:58 -0400
commit926848220e601338c918bdbde1d3fe7e63c8c04d (patch)
tree73ec9ceebddd164873872d6427da4d256b7bbb9f
parent3646af9fda7ff886821d86dc824c27ea025cf6f4 (diff)
staging: comedi: plx9052: tidy up the register defines
The PLX INTCSR register defines are a bit wordy and many of them are not used anywhere. For aesthetic reasons, remove all the *_MASK and *_DISABLED defines and rename the remaining bit defines so they are not as wordy. Convert all the bit defines to bit shifts. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/comedi/drivers/amplc_pc236.c36
-rw-r--r--drivers/staging/comedi/drivers/cb_pcimdas.c1
-rw-r--r--drivers/staging/comedi/drivers/plx9052.h69
3 files changed, 32 insertions, 74 deletions
diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c
index 441e27361c5e..e789383ce49d 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -75,23 +75,19 @@ unused.
75#define PC236_IO_SIZE 4 75#define PC236_IO_SIZE 4
76#define PC236_LCR_IO_SIZE 128 76#define PC236_LCR_IO_SIZE 128
77 77
78/* 78/* Disable, and clear, interrupts */
79 * INTCSR values for PCI236. 79#define PCI236_INTR_DISABLE (PLX9052_INTCSR_LI1POL | \
80 */ 80 PLX9052_INTCSR_LI2POL | \
81/* Disable interrupt, also clear any interrupt there */ 81 PLX9052_INTCSR_LI1SEL | \
82#define PCI236_INTR_DISABLE (PLX9052_INTCSR_LI1ENAB_DISABLED \ 82 PLX9052_INTCSR_LI1CLRINT)
83 | PLX9052_INTCSR_LI1POL_HIGH \ 83
84 | PLX9052_INTCSR_LI2POL_HIGH \ 84/* Enable, and clear, interrupts */
85 | PLX9052_INTCSR_PCIENAB_DISABLED \ 85#define PCI236_INTR_ENABLE (PLX9052_INTCSR_LI1ENAB | \
86 | PLX9052_INTCSR_LI1SEL_EDGE \ 86 PLX9052_INTCSR_LI1POL | \
87 | PLX9052_INTCSR_LI1CLRINT_ASSERTED) 87 PLX9052_INTCSR_LI2POL | \
88/* Enable interrupt, also clear any interrupt there. */ 88 PLX9052_INTCSR_PCIENAB | \
89#define PCI236_INTR_ENABLE (PLX9052_INTCSR_LI1ENAB_ENABLED \ 89 PLX9052_INTCSR_LI1SEL | \
90 | PLX9052_INTCSR_LI1POL_HIGH \ 90 PLX9052_INTCSR_LI1CLRINT)
91 | PLX9052_INTCSR_LI2POL_HIGH \
92 | PLX9052_INTCSR_PCIENAB_ENABLED \
93 | PLX9052_INTCSR_LI1SEL_EDGE \
94 | PLX9052_INTCSR_LI1CLRINT_ASSERTED)
95 91
96/* 92/*
97 * Board descriptions for Amplicon PC36AT and PCI236. 93 * Board descriptions for Amplicon PC36AT and PCI236.
@@ -257,14 +253,14 @@ static int pc236_intr_check(struct comedi_device *dev)
257 struct pc236_private *devpriv = dev->private; 253 struct pc236_private *devpriv = dev->private;
258 int retval = 0; 254 int retval = 0;
259 unsigned long flags; 255 unsigned long flags;
256 unsigned int intcsr;
260 257
261 spin_lock_irqsave(&dev->spinlock, flags); 258 spin_lock_irqsave(&dev->spinlock, flags);
262 if (devpriv->enable_irq) { 259 if (devpriv->enable_irq) {
263 retval = 1; 260 retval = 1;
264 if (is_pci_board(thisboard)) { 261 if (is_pci_board(thisboard)) {
265 if ((inl(devpriv->lcr_iobase + PLX9052_INTCSR) 262 intcsr = inl(devpriv->lcr_iobase + PLX9052_INTCSR);
266 & PLX9052_INTCSR_LI1STAT_MASK) 263 if (!(intcsr & PLX9052_INTCSR_LI1STAT)) {
267 == PLX9052_INTCSR_LI1STAT_INACTIVE) {
268 retval = 0; 264 retval = 0;
269 } else { 265 } else {
270 /* Clear interrupt and keep it enabled. */ 266 /* Clear interrupt and keep it enabled. */
diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c
index 31273f4d24a1..29813c9d4a2a 100644
--- a/drivers/staging/comedi/drivers/cb_pcimdas.c
+++ b/drivers/staging/comedi/drivers/cb_pcimdas.c
@@ -46,6 +46,7 @@ See http://www.mccdaq.com/PDFs/Manuals/pcim-das1602-16.pdf for more details.
46 46
47#include "../comedidev.h" 47#include "../comedidev.h"
48 48
49#include "plx9052.h"
49#include "8255.h" 50#include "8255.h"
50 51
51/* #define CBPCIMDAS_DEBUG */ 52/* #define CBPCIMDAS_DEBUG */
diff --git a/drivers/staging/comedi/drivers/plx9052.h b/drivers/staging/comedi/drivers/plx9052.h
index 5894739ff426..ab93b0b95fb7 100644
--- a/drivers/staging/comedi/drivers/plx9052.h
+++ b/drivers/staging/comedi/drivers/plx9052.h
@@ -27,60 +27,21 @@
27#define _PLX9052_H_ 27#define _PLX9052_H_
28 28
29/* 29/*
30 * PLX PCI9052 INTCSR register. 30 * INTCSR - Interrupt Control/Status register
31 */ 31 */
32#define PLX9052_INTCSR 0x4C /* Offset in Local Configuration Registers */ 32#define PLX9052_INTCSR 0x4c
33/* Local Interrupt 1 Enable */ 33#define PLX9052_INTCSR_LI1ENAB (1 << 0) /* LI1 enabled */
34#define PLX9052_INTCSR_LI1ENAB_MASK 0x0001 34#define PLX9052_INTCSR_LI1POL (1 << 1) /* LI1 active high */
35#define PLX9052_INTCSR_LI1ENAB_DISABLED 0x0000 35#define PLX9052_INTCSR_LI1STAT (1 << 2) /* LI1 active */
36#define PLX9052_INTCSR_LI1ENAB_ENABLED 0x0001 36#define PLX9052_INTCSR_LI2ENAB (1 << 3) /* LI2 enabled */
37/* Local Interrupt 1 Polarity */ 37#define PLX9052_INTCSR_LI2POL (1 << 4) /* LI2 active high */
38#define PLX9052_INTCSR_LI1POL_MASK 0x0002 38#define PLX9052_INTCSR_LI2STAT (1 << 5) /* LI2 active */
39#define PLX9052_INTCSR_LI1POL_LOW 0x0000 39#define PLX9052_INTCSR_PCIENAB (1 << 6) /* PCIINT enabled */
40#define PLX9052_INTCSR_LI1POL_HIGH 0x0002 40#define PLX9052_INTCSR_SOFTINT (1 << 7) /* generate soft int */
41/* Local Interrupt 1 Status (read-only) */ 41#define PLX9052_INTCSR_LI1SEL (1 << 8) /* LI1 edge */
42#define PLX9052_INTCSR_LI1STAT_MASK 0x0004 42#define PLX9052_INTCSR_LI2SEL (1 << 9) /* LI2 edge */
43#define PLX9052_INTCSR_LI1STAT_INACTIVE 0x0000 43#define PLX9052_INTCSR_LI1CLRINT (1 << 10) /* LI1 clear int */
44#define PLX9052_INTCSR_LI1STAT_ACTIVE 0x0004 44#define PLX9052_INTCSR_LI2CLRINT (1 << 11) /* LI2 clear int */
45/* Local Interrupt 2 Enable */ 45#define PLX9052_INTCSR_ISAMODE (1 << 12) /* ISA interface mode */
46#define PLX9052_INTCSR_LI2ENAB_MASK 0x0008
47#define PLX9052_INTCSR_LI2ENAB_DISABLED 0x0000
48#define PLX9052_INTCSR_LI2ENAB_ENABLED 0x0008
49/* Local Interrupt 2 Polarity */
50#define PLX9052_INTCSR_LI2POL_MASK 0x0010
51#define PLX9052_INTCSR_LI2POL_LOW 0x0000
52#define PLX9052_INTCSR_LI2POL_HIGH 0x0010
53/* Local Interrupt 2 Status (read-only) */
54#define PLX9052_INTCSR_LI2STAT_MASK 0x0020
55#define PLX9052_INTCSR_LI2STAT_INACTIVE 0x0000
56#define PLX9052_INTCSR_LI2STAT_ACTIVE 0x0020
57/* PCI Interrupt Enable */
58#define PLX9052_INTCSR_PCIENAB_MASK 0x0040
59#define PLX9052_INTCSR_PCIENAB_DISABLED 0x0000
60#define PLX9052_INTCSR_PCIENAB_ENABLED 0x0040
61/* Software Interrupt */
62#define PLX9052_INTCSR_SOFTINT_MASK 0x0080
63#define PLX9052_INTCSR_SOFTINT_UNASSERTED 0x0000
64#define PLX9052_INTCSR_SOFTINT_ASSERTED 0x0080
65/* Local Interrupt 1 Select Enable */
66#define PLX9052_INTCSR_LI1SEL_MASK 0x0100
67#define PLX9052_INTCSR_LI1SEL_LEVEL 0x0000
68#define PLX9052_INTCSR_LI1SEL_EDGE 0x0100
69/* Local Interrupt 2 Select Enable */
70#define PLX9052_INTCSR_LI2SEL_MASK 0x0200
71#define PLX9052_INTCSR_LI2SEL_LEVEL 0x0000
72#define PLX9052_INTCSR_LI2SEL_EDGE 0x0200
73/* Local Edge Triggerable Interrupt 1 Clear Bit */
74#define PLX9052_INTCSR_LI1CLRINT_MASK 0x0400
75#define PLX9052_INTCSR_LI1CLRINT_UNASSERTED 0x0000
76#define PLX9052_INTCSR_LI1CLRINT_ASSERTED 0x0400
77/* Local Edge Triggerable Interrupt 2 Clear Bit */
78#define PLX9052_INTCSR_LI2CLRINT_MASK 0x0800
79#define PLX9052_INTCSR_LI2CLRINT_UNASSERTED 0x0000
80#define PLX9052_INTCSR_LI2CLRINT_ASSERTED 0x0800
81/* ISA Interface Mode Enable (read-only over PCI bus) */
82#define PLX9052_INTCSR_ISAMODE_MASK 0x1000
83#define PLX9052_INTCSR_ISAMODE_DISABLED 0x0000
84#define PLX9052_INTCSR_ISAMODE_ENABLED 0x1000
85 46
86#endif /* _PLX9052_H_ */ 47#endif /* _PLX9052_H_ */