From 18be14034bf2364d9f100148ddd2594d81ab2855 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 3 Dec 2014 11:25:40 -0700 Subject: [PATCH] staging: comedi: addi_apci_1500: tidy up PCI Bar 2 register map Move the PCI Bar 1 register map defines to the main driver source file. For aesthetics, rename the defines. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci1500.c | 21 +++++++------------ .../staging/comedi/drivers/addi_apci_1500.c | 7 +++++++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c index 7eb7d9ecd7a5..a8887689e1fc 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c @@ -26,12 +26,9 @@ /* DIGITAL INPUT-OUTPUT DEFINE */ -#define APCI1500_DIGITAL_OP 2 -#define APCI1500_DIGITAL_IP 0 #define APCI1500_AND 2 #define APCI1500_OR 4 #define APCI1500_OR_PRIORITY 6 -#define APCI1500_CLK_SELECT 0 #define COUNTER1 0 #define COUNTER2 1 #define COUNTER3 2 @@ -600,7 +597,7 @@ static int apci1500_di_insn_bits(struct comedi_device *dev, { struct apci1500_private *devpriv = dev->private; - data[1] = inw(devpriv->addon + APCI1500_DIGITAL_IP); + data[1] = inw(devpriv->addon + APCI1500_DI_REG); return insn->n; } @@ -641,7 +638,7 @@ static int apci1500_do_write(struct comedi_device *dev, if (data[3] == 0) { if (data[1] == 0) { data[0] = (data[0] << ui_NoOfChannel) | ui_Temp; - outw(data[0], devpriv->addon + APCI1500_DIGITAL_OP); + outw(data[0], devpriv->addon + APCI1500_DO_REG); } else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -675,8 +672,7 @@ static int apci1500_do_write(struct comedi_device *dev, } - outw(data[0], - devpriv->addon + APCI1500_DIGITAL_OP); + outw(data[0], devpriv->addon + APCI1500_DO_REG); } else { dev_warn(dev->class_dev, "Specified channel not supported\n"); @@ -694,8 +690,7 @@ static int apci1500_do_write(struct comedi_device *dev, (data[0] << ui_NoOfChannel) ^ 0xffffffff; data[0] = data[0] & ui_Temp; - outw(data[0], - devpriv->addon + APCI1500_DIGITAL_OP); + outw(data[0], devpriv->addon + APCI1500_DO_REG); } else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -749,8 +744,8 @@ static int apci1500_do_write(struct comedi_device *dev, } - outw(data[0], devpriv->addon + - APCI1500_DIGITAL_OP); + outw(data[0], + devpriv->addon + APCI1500_DO_REG); } else { dev_warn(dev->class_dev, "Specified channel not supported\n"); @@ -793,7 +788,7 @@ static int apci1500_timer_config(struct comedi_device *dev, /* Selection of the input clock */ if (data[0] == 0 || data[0] == 1 || data[0] == 2) { - outw(data[0], devpriv->addon + APCI1500_CLK_SELECT); + outw(data[0], devpriv->addon + APCI1500_CLK_SEL_REG); } else { if (data[0] != 3) { dev_warn(dev->class_dev, @@ -1625,7 +1620,7 @@ static int apci1500_reset(struct comedi_device *dev) z8536_reset(dev); /* reset all the digital outputs */ - outw(0x0, devpriv->addon + APCI1500_DIGITAL_OP); + outw(0x0, devpriv->addon + APCI1500_DO_REG); /* Deactivates all interrupts */ z8536_write(dev, 0x00, APCI1500_RW_MASTER_INTERRUPT_CONTROL); diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index 9cb80e031c10..6892c0a72ce0 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -20,6 +20,13 @@ #define APCI1500_Z8536_PORTA_REG 0x02 #define APCI1500_Z8536_CTRL_REG 0x03 +/* + * PCI Bar 2 Register map (devpriv->addon) + */ +#define APCI1500_CLK_SEL_REG 0x00 +#define APCI1500_DI_REG 0x00 +#define APCI1500_DO_REG 0x02 + struct apci1500_private { unsigned long amcc; unsigned long addon;