PCI Bar 0 accesses the AMCC S5933 PCI controller used on this board.
Use the defines from amcc_35933.h and remove the "magic" numbers.

Rename the CamelCase private data member 'i_IobaseAmcc' used to hold
the address for PCI Bar 0.

Signed-off-by: H Hartley Sweeten <hswee...@visionengravers.com>
Cc: Ian Abbott <abbo...@mev.co.uk>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 .../staging/comedi/drivers/addi-data/hwdrv_apci1500.c  | 18 ++++++++++--------
 drivers/staging/comedi/drivers/addi_apci_1500.c        |  9 +++++++--
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
index 11e3d84..df3cb0a 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c
@@ -1412,7 +1412,7 @@ static int apci1500_do_bits(struct comedi_device *dev,
        int i_Constant;
 
        devpriv->tsk_Current = current;
-       outl(0x0, devpriv->i_IobaseAmcc + 0x38);
+       outl(0x0, devpriv->amcc + AMCC_OP_REG_INTCSR);
        if (data[0] == 1) {
                i_Constant = 0xC0;
        } else {
@@ -1466,10 +1466,12 @@ static int apci1500_do_bits(struct comedi_device *dev,
        z8536_write(dev, 0xd0, APCI1500_RW_MASTER_INTERRUPT_CONTROL);
 
        /* Enables the PCI interrupt */
-       outl(0x3000, devpriv->i_IobaseAmcc + 0x38);
-       ui_Status = inl(devpriv->i_IobaseAmcc + 0x10);
-       ui_Status = inl(devpriv->i_IobaseAmcc + 0x38);
-       outl(0x23000, devpriv->i_IobaseAmcc + 0x38);
+       outl(0x2000 | INTCSR_INBOX_FULL_INT,
+            devpriv->amcc + AMCC_OP_REG_INTCSR);
+       ui_Status = inl(devpriv->amcc + AMCC_OP_REG_IMB1);
+       ui_Status = inl(devpriv->amcc + AMCC_OP_REG_INTCSR);
+       outl(INTCSR_INBOX_INTR_STATUS | 0x2000 | INTCSR_INBOX_FULL_INT,
+            devpriv->amcc + AMCC_OP_REG_INTCSR);
 
        return insn->n;
 }
@@ -1486,10 +1488,10 @@ static irqreturn_t apci1500_interrupt(int irq, void *d)
        i_InterruptMask = 0;
 
        /* Read the board interrupt status */
-       ui_InterruptStatus = inl(devpriv->i_IobaseAmcc + 0x38);
+       ui_InterruptStatus = inl(devpriv->amcc + AMCC_OP_REG_INTCSR);
 
        /* Test if board generated a interrupt */
-       if ((ui_InterruptStatus & 0x800000) == 0x800000) {
+       if (ui_InterruptStatus & INTCSR_INTR_ASSERTED) {
                /* Disable all Interrupt */
                /* Selects the master interrupt control register */
                /* Disables  the main interrupt on the board */
@@ -1532,7 +1534,7 @@ static irqreturn_t apci1500_interrupt(int irq, void *d)
                        if (i_RegValue) {
                                /* Disable the interrupt */
                                /* Selects the command and status register of 
port B */
-                               outl(0x0, devpriv->i_IobaseAmcc + 0x38);
+                               outl(0x0, devpriv->amcc + AMCC_OP_REG_INTCSR);
 
                                if (i_RegValue & 0x80) {
                                        i_InterruptMask =
diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c 
b/drivers/staging/comedi/drivers/addi_apci_1500.c
index 1d24be1..8fe48e7 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1500.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1500.c
@@ -8,6 +8,11 @@
 #include "amcc_s5933.h"
 
 /*
+ * PCI Bar 0 Register map (devpriv->amcc)
+ * see amcc_s5933.h for register and bit defines
+ */
+
+/*
 * PCI Bar 1 Register map (dev->iobase)
  */
 #define APCI1500_Z8536_PORTC_REG       0x00
@@ -16,7 +21,7 @@
 #define APCI1500_Z8536_CTRL_REG                0x03
 
 struct apci1500_private {
-       int i_IobaseAmcc;
+       unsigned long amcc;
        int i_IobaseAddon;
        unsigned char b_OutputMemoryStatus;
        struct task_struct *tsk_Current;
@@ -41,7 +46,7 @@ static int apci1500_auto_attach(struct comedi_device *dev,
                return ret;
 
        dev->iobase = pci_resource_start(pcidev, 1);
-       devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0);
+       devpriv->amcc = pci_resource_start(pcidev, 0);
        devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2);
 
        if (pcidev->irq > 0) {
-- 
2.0.3

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to