Re: [PATCH 08/71] ncr5380: Move NCR53C400-specific code

2015-11-19 Thread Hannes Reinecke
On 11/18/2015 09:35 AM, Finn Thain wrote:
> Move board-specific code like this,
>   NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
> from the core driver to the board driver. Eliminate the NCR53C400 macro
> from the core driver. Removal of all macros like this one will be
> necessary in order to have one core driver that can support all kinds of
> boards.
> 
> Signed-off-by: Finn Thain 
> 
> ---
>  drivers/scsi/NCR5380.c   |   18 --
>  drivers/scsi/g_NCR5380.c |   23 ++-
>  drivers/scsi/g_NCR5380.h |6 ++
>  3 files changed, 20 insertions(+), 27 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckezSeries & Storage
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/71] ncr5380: Move NCR53C400-specific code

2015-11-18 Thread Finn Thain
Move board-specific code like this,
NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
from the core driver to the board driver. Eliminate the NCR53C400 macro
from the core driver. Removal of all macros like this one will be
necessary in order to have one core driver that can support all kinds of
boards.

Signed-off-by: Finn Thain 

---
 drivers/scsi/NCR5380.c   |   18 --
 drivers/scsi/g_NCR5380.c |   23 ++-
 drivers/scsi/g_NCR5380.h |6 ++
 3 files changed, 20 insertions(+), 27 deletions(-)

Index: linux/drivers/scsi/NCR5380.c
===
--- linux.orig/drivers/scsi/NCR5380.c   2015-11-18 19:33:10.0 +1100
+++ linux/drivers/scsi/NCR5380.c2015-11-18 19:33:12.0 +1100
@@ -654,9 +654,6 @@ static void prepare_info(struct Scsi_Hos
 #ifdef UNSAFE
 "UNSAFE "
 #endif
-#ifdef NCR53C400
-"NCR53C400 "
-#endif
 "");
 }
 
@@ -782,15 +779,6 @@ static int NCR5380_init(struct Scsi_Host
 
if(in_interrupt())
printk(KERN_ERR "NCR5380_init called with interrupts off!\n");
-   /* 
-* On NCR53C400 boards, NCR5380 registers are mapped 8 past 
-* the base address.
-*/
-
-#ifdef NCR53C400
-   if (flags & FLAG_NCR53C400)
-   instance->io_port += NCR53C400_address_adjust;
-#endif
 
hostdata->aborted = 0;
hostdata->id_mask = 1 << instance->this_id;
@@ -824,12 +812,6 @@ static int NCR5380_init(struct Scsi_Host
NCR5380_write(MODE_REG, MR_BASE);
NCR5380_write(TARGET_COMMAND_REG, 0);
NCR5380_write(SELECT_ENABLE_REG, 0);
-
-#ifdef NCR53C400
-   if (hostdata->flags & FLAG_NCR53C400) {
-   NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
-   }
-#endif
return 0;
 }
 
Index: linux/drivers/scsi/g_NCR5380.c
===
--- linux.orig/drivers/scsi/g_NCR5380.c 2015-11-18 19:33:10.0 +1100
+++ linux/drivers/scsi/g_NCR5380.c  2015-11-18 19:33:12.0 +1100
@@ -64,9 +64,7 @@
 #define AUTOPROBE_IRQ
 
 #ifdef CONFIG_SCSI_GENERIC_NCR53C400
-#define NCR53C400_PSEUDO_DMA 1
 #define PSEUDO_DMA
-#define NCR53C400
 #endif
 
 #include 
@@ -263,7 +261,7 @@ static int __init generic_NCR5380_detect
static unsigned int __initdata dtc_3181e_ports[] = {
0x220, 0x240, 0x280, 0x2a0, 0x2c0, 0x300, 0x320, 0x340, 0
};
-   int flags = 0;
+   int flags;
struct Scsi_Host *instance;
 #ifdef SCSI_G_NCR5380_MEM
unsigned long base;
@@ -324,12 +322,17 @@ static int __init generic_NCR5380_detect
continue;
 
ports = NULL;
+   flags = 0;
switch (overrides[current_override].board) {
case BOARD_NCR5380:
flags = FLAG_NO_PSEUDO_DMA;
break;
case BOARD_NCR53C400:
+#ifdef PSEUDO_DMA
flags = FLAG_NCR53C400;
+#else
+   flags = FLAG_NO_PSEUDO_DMA;
+#endif
break;
case BOARD_NCR53C400A:
flags = FLAG_NO_PSEUDO_DMA;
@@ -415,6 +418,13 @@ static int __init generic_NCR5380_detect
 #ifndef SCSI_G_NCR5380_MEM
instance->io_port = 
overrides[current_override].NCR5380_map_name;
instance->n_io_port = region_size;
+
+   /*
+* On NCR53C400 boards, NCR5380 registers are mapped 8 past
+* the base address.
+*/
+   if (overrides[current_override].board == BOARD_NCR53C400)
+   instance->io_port += 8;
 #else
instance->base = overrides[current_override].NCR5380_map_name;
((struct NCR5380_hostdata *)instance->hostdata)->iomem = iomem;
@@ -422,6 +432,9 @@ static int __init generic_NCR5380_detect
 
NCR5380_init(instance, flags);
 
+   if (overrides[current_override].board == BOARD_NCR53C400)
+   NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
+
NCR5380_maybe_reset_bus(instance);
 
if (overrides[current_override].irq != IRQ_AUTO)
@@ -506,7 +519,7 @@ generic_NCR5380_biosparam(struct scsi_de
 }
 #endif
 
-#ifdef NCR53C400_PSEUDO_DMA
+#ifdef PSEUDO_DMA
 
 /**
  * NCR5380_pread   -   pseudo DMA read
@@ -690,7 +703,7 @@ static inline int NCR5380_pwrite(struct
;   // TIMEOUT
return 0;
 }
-#endif /* PSEUDO_DMA */
+#endif /* PSEUDO_DMA */
 
 /*
  * Include the NCR5380 core code that we build our driver around   
Index: linux/drivers/scsi/g_NCR5380.h
===
--- linux.orig/drivers/scsi/g_NCR5380.h 2015-11-18 19:33:09.0 +1100
+++ linux/drivers/scsi/g_NCR5380.h  2015