summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2016-03-23 06:10:14 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-04-11 16:57:09 -0400
commit1bb4600245d4d40245dd505ca17528e0b9a9ba8c (patch)
tree17e5a40c2e3e9a3ded8c5d33883ec4cacbac3af9
parente63449c43a58fc185ff35ace6a842817f57ec6c8 (diff)
ncr5380: Disable the DMA errata workaround flag by default
The only chip that needs the workarounds enabled is an early NMOS device. That means that the common case is to disable them. Unfortunately the sense of the flag is such that it has to be set for the common case. Rename the flag so that zero can be used to mean "no errata workarounds needed". This simplifies the code. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Reviewed-by: Hannes Reinecke <hare@suse.com> Tested-by: Michael Schmitz <schmitzmic@gmail.com> Tested-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/NCR5380.c14
-rw-r--r--drivers/scsi/NCR5380.h2
-rw-r--r--drivers/scsi/arm/cumana_1.c2
-rw-r--r--drivers/scsi/arm/oak.c2
-rw-r--r--drivers/scsi/dtc.c2
-rw-r--r--drivers/scsi/g_NCR5380.c8
-rw-r--r--drivers/scsi/pas16.c2
-rw-r--r--drivers/scsi/t128.c2
8 files changed, 14 insertions, 20 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 826b63d1aa84..69c73c36b923 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -457,7 +457,7 @@ static void prepare_info(struct Scsi_Host *instance)
457 instance->base, instance->irq, 457 instance->base, instance->irq,
458 instance->can_queue, instance->cmd_per_lun, 458 instance->can_queue, instance->cmd_per_lun,
459 instance->sg_tablesize, instance->this_id, 459 instance->sg_tablesize, instance->this_id,
460 hostdata->flags & FLAG_NO_DMA_FIXUP ? "NO_DMA_FIXUP " : "", 460 hostdata->flags & FLAG_DMA_FIXUP ? "DMA_FIXUP " : "",
461 hostdata->flags & FLAG_NO_PSEUDO_DMA ? "NO_PSEUDO_DMA " : "", 461 hostdata->flags & FLAG_NO_PSEUDO_DMA ? "NO_PSEUDO_DMA " : "",
462 hostdata->flags & FLAG_TOSHIBA_DELAY ? "TOSHIBA_DELAY " : "", 462 hostdata->flags & FLAG_TOSHIBA_DELAY ? "TOSHIBA_DELAY " : "",
463#ifdef AUTOPROBE_IRQ 463#ifdef AUTOPROBE_IRQ
@@ -1480,11 +1480,11 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
1480 * before the setting of DMA mode to after transfer of the last byte. 1480 * before the setting of DMA mode to after transfer of the last byte.
1481 */ 1481 */
1482 1482
1483 if (hostdata->flags & FLAG_NO_DMA_FIXUP) 1483 if (hostdata->flags & FLAG_DMA_FIXUP)
1484 NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY);
1485 else
1484 NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY | 1486 NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY |
1485 MR_ENABLE_EOP_INTR); 1487 MR_ENABLE_EOP_INTR);
1486 else
1487 NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY);
1488 1488
1489 dprintk(NDEBUG_DMA, "scsi%d : mode reg = 0x%X\n", instance->host_no, NCR5380_read(MODE_REG)); 1489 dprintk(NDEBUG_DMA, "scsi%d : mode reg = 0x%X\n", instance->host_no, NCR5380_read(MODE_REG));
1490 1490
@@ -1540,8 +1540,8 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
1540 1540
1541 if (p & SR_IO) { 1541 if (p & SR_IO) {
1542 foo = NCR5380_pread(instance, d, 1542 foo = NCR5380_pread(instance, d,
1543 hostdata->flags & FLAG_NO_DMA_FIXUP ? c : c - 1); 1543 hostdata->flags & FLAG_DMA_FIXUP ? c - 1 : c);
1544 if (!foo && !(hostdata->flags & FLAG_NO_DMA_FIXUP)) { 1544 if (!foo && (hostdata->flags & FLAG_DMA_FIXUP)) {
1545 /* 1545 /*
1546 * The workaround was to transfer fewer bytes than we 1546 * The workaround was to transfer fewer bytes than we
1547 * intended to with the pseudo-DMA read function, wait for 1547 * intended to with the pseudo-DMA read function, wait for
@@ -1571,7 +1571,7 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
1571 } 1571 }
1572 } else { 1572 } else {
1573 foo = NCR5380_pwrite(instance, d, c); 1573 foo = NCR5380_pwrite(instance, d, c);
1574 if (!foo && !(hostdata->flags & FLAG_NO_DMA_FIXUP)) { 1574 if (!foo && (hostdata->flags & FLAG_DMA_FIXUP)) {
1575 /* 1575 /*
1576 * Wait for the last byte to be sent. If REQ is being asserted for 1576 * Wait for the last byte to be sent. If REQ is being asserted for
1577 * the byte we're interested, we'll ACK it and it will go false. 1577 * the byte we're interested, we'll ACK it and it will go false.
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index 0b03ba25bd66..7b488a082462 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -220,7 +220,7 @@
220#define NO_IRQ 0 220#define NO_IRQ 0
221#endif 221#endif
222 222
223#define FLAG_NO_DMA_FIXUP 1 /* No DMA errata workarounds */ 223#define FLAG_DMA_FIXUP 1 /* Use DMA errata workarounds */
224#define FLAG_NO_PSEUDO_DMA 8 /* Inhibit DMA */ 224#define FLAG_NO_PSEUDO_DMA 8 /* Inhibit DMA */
225#define FLAG_LATE_DMA_SETUP 32 /* Setup NCR before DMA H/W */ 225#define FLAG_LATE_DMA_SETUP 32 /* Setup NCR before DMA H/W */
226#define FLAG_TAGGED_QUEUING 64 /* as X3T9.2 spelled it */ 226#define FLAG_TAGGED_QUEUING 64 /* as X3T9.2 spelled it */
diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c
index 221f18c5df93..76b2d3364d9f 100644
--- a/drivers/scsi/arm/cumana_1.c
+++ b/drivers/scsi/arm/cumana_1.c
@@ -239,7 +239,7 @@ static int cumanascsi1_probe(struct expansion_card *ec,
239 239
240 host->irq = ec->irq; 240 host->irq = ec->irq;
241 241
242 ret = NCR5380_init(host, 0); 242 ret = NCR5380_init(host, FLAG_DMA_FIXUP);
243 if (ret) 243 if (ret)
244 goto out_unmap; 244 goto out_unmap;
245 245
diff --git a/drivers/scsi/arm/oak.c b/drivers/scsi/arm/oak.c
index 1fab1d1896b1..8d8426535e6d 100644
--- a/drivers/scsi/arm/oak.c
+++ b/drivers/scsi/arm/oak.c
@@ -143,7 +143,7 @@ static int oakscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
143 host->irq = NO_IRQ; 143 host->irq = NO_IRQ;
144 host->n_io_port = 255; 144 host->n_io_port = 255;
145 145
146 ret = NCR5380_init(host, 0); 146 ret = NCR5380_init(host, FLAG_DMA_FIXUP);
147 if (ret) 147 if (ret)
148 goto out_unmap; 148 goto out_unmap;
149 149
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c
index 6c736b071cf4..30919f42759a 100644
--- a/drivers/scsi/dtc.c
+++ b/drivers/scsi/dtc.c
@@ -229,7 +229,7 @@ found:
229 instance->base = addr; 229 instance->base = addr;
230 ((struct NCR5380_hostdata *)(instance)->hostdata)->base = base; 230 ((struct NCR5380_hostdata *)(instance)->hostdata)->base = base;
231 231
232 if (NCR5380_init(instance, FLAG_NO_DMA_FIXUP)) 232 if (NCR5380_init(instance, 0))
233 goto out_unregister; 233 goto out_unregister;
234 234
235 NCR5380_maybe_reset_bus(instance); 235 NCR5380_maybe_reset_bus(instance);
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index b8fc26d9231d..aaeb6b6b4b16 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -348,23 +348,17 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
348 flags = 0; 348 flags = 0;
349 switch (overrides[current_override].board) { 349 switch (overrides[current_override].board) {
350 case BOARD_NCR5380: 350 case BOARD_NCR5380:
351 flags = FLAG_NO_PSEUDO_DMA; 351 flags = FLAG_NO_PSEUDO_DMA | FLAG_DMA_FIXUP;
352 break;
353 case BOARD_NCR53C400:
354 flags = FLAG_NO_DMA_FIXUP;
355 break; 352 break;
356 case BOARD_NCR53C400A: 353 case BOARD_NCR53C400A:
357 flags = FLAG_NO_DMA_FIXUP;
358 ports = ncr_53c400a_ports; 354 ports = ncr_53c400a_ports;
359 magic = ncr_53c400a_magic; 355 magic = ncr_53c400a_magic;
360 break; 356 break;
361 case BOARD_HP_C2502: 357 case BOARD_HP_C2502:
362 flags = FLAG_NO_DMA_FIXUP;
363 ports = ncr_53c400a_ports; 358 ports = ncr_53c400a_ports;
364 magic = hp_c2502_magic; 359 magic = hp_c2502_magic;
365 break; 360 break;
366 case BOARD_DTC3181E: 361 case BOARD_DTC3181E:
367 flags = FLAG_NO_DMA_FIXUP;
368 ports = dtc_3181e_ports; 362 ports = dtc_3181e_ports;
369 magic = ncr_53c400a_magic; 363 magic = ncr_53c400a_magic;
370 break; 364 break;
diff --git a/drivers/scsi/pas16.c b/drivers/scsi/pas16.c
index 512037e27783..7589fea01186 100644
--- a/drivers/scsi/pas16.c
+++ b/drivers/scsi/pas16.c
@@ -377,7 +377,7 @@ static int __init pas16_detect(struct scsi_host_template *tpnt)
377 377
378 instance->io_port = io_port; 378 instance->io_port = io_port;
379 379
380 if (NCR5380_init(instance, 0)) 380 if (NCR5380_init(instance, FLAG_DMA_FIXUP))
381 goto out_unregister; 381 goto out_unregister;
382 382
383 NCR5380_maybe_reset_bus(instance); 383 NCR5380_maybe_reset_bus(instance);
diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c
index 4615fda60dbd..6cb8bdd2f4e6 100644
--- a/drivers/scsi/t128.c
+++ b/drivers/scsi/t128.c
@@ -210,7 +210,7 @@ found:
210 instance->base = base; 210 instance->base = base;
211 ((struct NCR5380_hostdata *)instance->hostdata)->base = p; 211 ((struct NCR5380_hostdata *)instance->hostdata)->base = p;
212 212
213 if (NCR5380_init(instance, 0)) 213 if (NCR5380_init(instance, FLAG_DMA_FIXUP))
214 goto out_unregister; 214 goto out_unregister;
215 215
216 NCR5380_maybe_reset_bus(instance); 216 NCR5380_maybe_reset_bus(instance);