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

staging: comedi: adl_pci9111: use plx9052.h defines

Use the PLX 9052 register defines in plx9052.h instead of duplicating
the defines locally in this driver.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 92684822
...@@ -75,6 +75,7 @@ a multiple of chanlist_len*convert_arg. ...@@ -75,6 +75,7 @@ a multiple of chanlist_len*convert_arg.
#include "../comedidev.h" #include "../comedidev.h"
#include "8253.h" #include "8253.h"
#include "plx9052.h"
#include "comedi_fc.h" #include "comedi_fc.h"
#define PCI9111_DRIVER_NAME "adl_pci9111" #define PCI9111_DRIVER_NAME "adl_pci9111"
...@@ -120,6 +121,14 @@ a multiple of chanlist_len*convert_arg. ...@@ -120,6 +121,14 @@ a multiple of chanlist_len*convert_arg.
#define PCI9111_8254_BASE_REG 0x40 #define PCI9111_8254_BASE_REG 0x40
#define PCI9111_INT_CLR_REG 0x48 #define PCI9111_INT_CLR_REG 0x48
/* PLX 9052 Local Interrupt 1 enabled and active */
#define PCI9111_LI1_ACTIVE (PLX9052_INTCSR_LI1ENAB | \
PLX9052_INTCSR_LI1STAT)
/* PLX 9052 Local Interrupt 2 enabled and active */
#define PCI9111_LI2_ACTIVE (PLX9052_INTCSR_LI2ENAB | \
PLX9052_INTCSR_LI2STAT)
static const struct comedi_lrange pci9111_ai_range = { static const struct comedi_lrange pci9111_ai_range = {
5, 5,
{ {
...@@ -150,17 +159,6 @@ struct pci9111_private_data { ...@@ -150,17 +159,6 @@ struct pci9111_private_data {
short ai_bounce_buffer[2 * PCI9111_FIFO_HALF_SIZE]; short ai_bounce_buffer[2 * PCI9111_FIFO_HALF_SIZE];
}; };
#define PLX9050_REGISTER_INTERRUPT_CONTROL 0x4c
#define PLX9050_LINTI1_ENABLE (1 << 0)
#define PLX9050_LINTI1_ACTIVE_HIGH (1 << 1)
#define PLX9050_LINTI1_STATUS (1 << 2)
#define PLX9050_LINTI2_ENABLE (1 << 3)
#define PLX9050_LINTI2_ACTIVE_HIGH (1 << 4)
#define PLX9050_LINTI2_STATUS (1 << 5)
#define PLX9050_PCI_INTERRUPT_ENABLE (1 << 6)
#define PLX9050_SOFTWARE_INTERRUPT (1 << 7)
static void plx9050_interrupt_control(unsigned long io_base, static void plx9050_interrupt_control(unsigned long io_base,
bool LINTi1_enable, bool LINTi1_enable,
bool LINTi1_active_high, bool LINTi1_active_high,
...@@ -171,18 +169,18 @@ static void plx9050_interrupt_control(unsigned long io_base, ...@@ -171,18 +169,18 @@ static void plx9050_interrupt_control(unsigned long io_base,
int flags = 0; int flags = 0;
if (LINTi1_enable) if (LINTi1_enable)
flags |= PLX9050_LINTI1_ENABLE; flags |= PLX9052_INTCSR_LI1ENAB;
if (LINTi1_active_high) if (LINTi1_active_high)
flags |= PLX9050_LINTI1_ACTIVE_HIGH; flags |= PLX9052_INTCSR_LI1POL;
if (LINTi2_enable) if (LINTi2_enable)
flags |= PLX9050_LINTI2_ENABLE; flags |= PLX9052_INTCSR_LI2ENAB;
if (LINTi2_active_high) if (LINTi2_active_high)
flags |= PLX9050_LINTI2_ACTIVE_HIGH; flags |= PLX9052_INTCSR_LI2POL;
if (interrupt_enable) if (interrupt_enable)
flags |= PLX9050_PCI_INTERRUPT_ENABLE; flags |= PLX9052_INTCSR_PCIENAB;
outb(flags, io_base + PLX9050_REGISTER_INTERRUPT_CONTROL); outb(flags, io_base + PLX9052_INTCSR);
} }
static void pci9111_timer_set(struct comedi_device *dev) static void pci9111_timer_set(struct comedi_device *dev)
...@@ -607,21 +605,17 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device) ...@@ -607,21 +605,17 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device)
spin_lock_irqsave(&dev->spinlock, irq_flags); spin_lock_irqsave(&dev->spinlock, irq_flags);
/* Check if we are source of interrupt */ /* Check if we are source of interrupt */
intcsr = inb(dev_private->lcr_io_base + intcsr = inb(dev_private->lcr_io_base + PLX9052_INTCSR);
PLX9050_REGISTER_INTERRUPT_CONTROL); if (!(((intcsr & PLX9052_INTCSR_PCIENAB) != 0) &&
if (!(((intcsr & PLX9050_PCI_INTERRUPT_ENABLE) != 0) (((intcsr & PCI9111_LI1_ACTIVE) == PCI9111_LI1_ACTIVE) ||
&& (((intcsr & (PLX9050_LINTI1_ENABLE | PLX9050_LINTI1_STATUS)) ((intcsr & PCI9111_LI2_ACTIVE) == PCI9111_LI2_ACTIVE)))) {
== (PLX9050_LINTI1_ENABLE | PLX9050_LINTI1_STATUS))
|| ((intcsr & (PLX9050_LINTI2_ENABLE | PLX9050_LINTI2_STATUS))
== (PLX9050_LINTI2_ENABLE | PLX9050_LINTI2_STATUS))))) {
/* Not the source of the interrupt. */ /* Not the source of the interrupt. */
/* (N.B. not using PLX9050_SOFTWARE_INTERRUPT) */ /* (N.B. not using PLX9052_INTCSR_SOFTINT) */
spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
return IRQ_NONE; return IRQ_NONE;
} }
if ((intcsr & (PLX9050_LINTI1_ENABLE | PLX9050_LINTI1_STATUS)) == if ((intcsr & PCI9111_LI1_ACTIVE) == PCI9111_LI1_ACTIVE) {
(PLX9050_LINTI1_ENABLE | PLX9050_LINTI1_STATUS)) {
/* Interrupt comes from fifo_half-full signal */ /* Interrupt comes from fifo_half-full signal */
status = inb(dev->iobase + PCI9111_AI_RANGE_STAT_REG); status = inb(dev->iobase + PCI9111_AI_RANGE_STAT_REG);
......
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