aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2016-03-23 06:10:12 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-04-11 16:57:09 -0400
commite4dec6806aceca768b74c1c6402e6d31ecf3c960 (patch)
tree97e7286f3af77f0ddef34974163964c5db64bd6c /drivers/scsi
parent7e9ec8d9cc18a85e8a4c28aef9136867b46aba42 (diff)
ncr5380: Remove REAL_DMA and REAL_DMA_POLL macros
For the NCR5380.c core driver, these macros are never used. If REAL_DMA were to be defined, compilation would fail. For the atari_NCR5380.c core driver, REAL_DMA is always defined. Hence these macros are pointless. 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>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/NCR5380.c218
-rw-r--r--drivers/scsi/NCR5380.h112
-rw-r--r--drivers/scsi/atari_NCR5380.c62
-rw-r--r--drivers/scsi/atari_scsi.c32
-rw-r--r--drivers/scsi/sun3_scsi.c13
5 files changed, 22 insertions, 415 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 98840bed05cb..826b63d1aa84 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -35,18 +35,10 @@
35 * code so that everything does the same thing that's done at the 35 * code so that everything does the same thing that's done at the
36 * end of a pseudo-DMA read operation. 36 * end of a pseudo-DMA read operation.
37 * 37 *
38 * 2. Fix REAL_DMA (interrupt driven, polled works fine) -
39 * basically, transfer size needs to be reduced by one
40 * and the last byte read as is done with PSEUDO_DMA.
41 *
42 * 4. Test SCSI-II tagged queueing (I have no devices which support 38 * 4. Test SCSI-II tagged queueing (I have no devices which support
43 * tagged queueing) 39 * tagged queueing)
44 */ 40 */
45 41
46#ifndef notyet
47#undef REAL_DMA
48#endif
49
50#ifdef BOARD_REQUIRES_NO_DELAY 42#ifdef BOARD_REQUIRES_NO_DELAY
51#define io_recovery_delay(x) 43#define io_recovery_delay(x)
52#else 44#else
@@ -131,12 +123,6 @@
131 * 123 *
132 * PSEUDO_DMA - if defined, PSEUDO DMA is used during the data transfer phases. 124 * PSEUDO_DMA - if defined, PSEUDO DMA is used during the data transfer phases.
133 * 125 *
134 * REAL_DMA - if defined, REAL DMA is used during the data transfer phases.
135 *
136 * REAL_DMA_POLL - if defined, REAL DMA is used but the driver doesn't
137 * rely on phase mismatch and EOP interrupts to determine end
138 * of phase.
139 *
140 * These macros MUST be defined : 126 * These macros MUST be defined :
141 * 127 *
142 * NCR5380_read(register) - read from the specified register 128 * NCR5380_read(register) - read from the specified register
@@ -147,15 +133,9 @@
147 * specific implementation of the NCR5380 133 * specific implementation of the NCR5380
148 * 134 *
149 * Either real DMA *or* pseudo DMA may be implemented 135 * Either real DMA *or* pseudo DMA may be implemented
150 * REAL functions :
151 * NCR5380_REAL_DMA should be defined if real DMA is to be used.
152 * Note that the DMA setup functions should return the number of bytes 136 * Note that the DMA setup functions should return the number of bytes
153 * that they were able to program the controller for. 137 * that they were able to program the controller for.
154 * 138 *
155 * Also note that generic i386/PC versions of these macros are
156 * available as NCR5380_i386_dma_write_setup,
157 * NCR5380_i386_dma_read_setup, and NCR5380_i386_dma_residual.
158 *
159 * NCR5380_dma_write_setup(instance, src, count) - initialize 139 * NCR5380_dma_write_setup(instance, src, count) - initialize
160 * NCR5380_dma_read_setup(instance, dst, count) - initialize 140 * NCR5380_dma_read_setup(instance, dst, count) - initialize
161 * NCR5380_dma_residual(instance); - residual count 141 * NCR5380_dma_residual(instance); - residual count
@@ -486,12 +466,6 @@ static void prepare_info(struct Scsi_Host *instance)
486#ifdef DIFFERENTIAL 466#ifdef DIFFERENTIAL
487 "DIFFERENTIAL " 467 "DIFFERENTIAL "
488#endif 468#endif
489#ifdef REAL_DMA
490 "REAL_DMA "
491#endif
492#ifdef REAL_DMA_POLL
493 "REAL_DMA_POLL "
494#endif
495#ifdef PARITY 469#ifdef PARITY
496 "PARITY " 470 "PARITY "
497#endif 471#endif
@@ -551,9 +525,8 @@ static int NCR5380_init(struct Scsi_Host *instance, int flags)
551 hostdata->id_higher_mask |= i; 525 hostdata->id_higher_mask |= i;
552 for (i = 0; i < 8; ++i) 526 for (i = 0; i < 8; ++i)
553 hostdata->busy[i] = 0; 527 hostdata->busy[i] = 0;
554#ifdef REAL_DMA 528 hostdata->dma_len = 0;
555 hostdata->dmalen = 0; 529
556#endif
557 spin_lock_init(&hostdata->lock); 530 spin_lock_init(&hostdata->lock);
558 hostdata->connected = NULL; 531 hostdata->connected = NULL;
559 hostdata->sensing = NULL; 532 hostdata->sensing = NULL;
@@ -850,11 +823,7 @@ static void NCR5380_main(struct work_struct *work)
850 requeue_cmd(instance, cmd); 823 requeue_cmd(instance, cmd);
851 } 824 }
852 } 825 }
853 if (hostdata->connected 826 if (hostdata->connected && !hostdata->dma_len) {
854#ifdef REAL_DMA
855 && !hostdata->dmalen
856#endif
857 ) {
858 dsprintk(NDEBUG_MAIN, instance, "main: performing information transfer\n"); 827 dsprintk(NDEBUG_MAIN, instance, "main: performing information transfer\n");
859 NCR5380_information_transfer(instance); 828 NCR5380_information_transfer(instance);
860 done = 0; 829 done = 0;
@@ -919,34 +888,6 @@ static irqreturn_t NCR5380_intr(int irq, void *dev_id)
919 dsprintk(NDEBUG_INTR, instance, "IRQ %d, BASR 0x%02x, SR 0x%02x, MR 0x%02x\n", 888 dsprintk(NDEBUG_INTR, instance, "IRQ %d, BASR 0x%02x, SR 0x%02x, MR 0x%02x\n",
920 irq, basr, sr, mr); 889 irq, basr, sr, mr);
921 890
922#if defined(REAL_DMA)
923 if ((mr & MR_DMA_MODE) || (mr & MR_MONITOR_BSY)) {
924 /* Probably End of DMA, Phase Mismatch or Loss of BSY.
925 * We ack IRQ after clearing Mode Register. Workarounds
926 * for End of DMA errata need to happen in DMA Mode.
927 */
928
929 dsprintk(NDEBUG_INTR, instance, "interrupt in DMA mode\n");
930
931 int transferred;
932
933 if (!hostdata->connected)
934 panic("scsi%d : DMA interrupt with no connected cmd\n",
935 instance->hostno);
936
937 transferred = hostdata->dmalen - NCR5380_dma_residual(instance);
938 hostdata->connected->SCp.this_residual -= transferred;
939 hostdata->connected->SCp.ptr += transferred;
940 hostdata->dmalen = 0;
941
942 /* FIXME: we need to poll briefly then defer a workqueue task ! */
943 NCR5380_poll_politely(hostdata, BUS_AND_STATUS_REG, BASR_ACK, 0, 2 * HZ);
944
945 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
946 NCR5380_write(MODE_REG, MR_BASE);
947 NCR5380_read(RESET_PARITY_INTERRUPT_REG);
948 } else
949#endif /* REAL_DMA */
950 if ((NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_mask) && 891 if ((NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_mask) &&
951 (sr & (SR_SEL | SR_IO | SR_BSY | SR_RST)) == (SR_SEL | SR_IO)) { 892 (sr & (SR_SEL | SR_IO | SR_BSY | SR_RST)) == (SR_SEL | SR_IO)) {
952 /* Probably reselected */ 893 /* Probably reselected */
@@ -1495,7 +1436,7 @@ timeout:
1495 return -1; 1436 return -1;
1496} 1437}
1497 1438
1498#if defined(REAL_DMA) || defined(PSEUDO_DMA) || defined (REAL_DMA_POLL) 1439#if defined(PSEUDO_DMA)
1499/* 1440/*
1500 * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance, 1441 * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance,
1501 * unsigned char *phase, int *count, unsigned char **data) 1442 * unsigned char *phase, int *count, unsigned char **data)
@@ -1525,34 +1466,14 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
1525 register unsigned char *d = *data; 1466 register unsigned char *d = *data;
1526 unsigned char tmp; 1467 unsigned char tmp;
1527 int foo; 1468 int foo;
1528#if defined(REAL_DMA_POLL)
1529 int cnt, toPIO;
1530 unsigned char saved_data = 0, overrun = 0, residue;
1531#endif
1532 1469
1533 if ((tmp = (NCR5380_read(STATUS_REG) & PHASE_MASK)) != p) { 1470 if ((tmp = (NCR5380_read(STATUS_REG) & PHASE_MASK)) != p) {
1534 *phase = tmp; 1471 *phase = tmp;
1535 return -1; 1472 return -1;
1536 } 1473 }
1537#if defined(REAL_DMA) || defined(REAL_DMA_POLL)
1538 if (p & SR_IO) {
1539 if (!(hostdata->flags & FLAG_NO_DMA_FIXUPS))
1540 c -= 2;
1541 }
1542 hostdata->dma_len = (p & SR_IO) ? NCR5380_dma_read_setup(instance, d, c) : NCR5380_dma_write_setup(instance, d, c);
1543
1544 dsprintk(NDEBUG_DMA, instance, "initializing DMA %s: length %d, address %p\n",
1545 (p & SR_IO) ? "receive" : "send", c, *data);
1546#endif
1547 1474
1548 NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(p)); 1475 NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(p));
1549 1476
1550#ifdef REAL_DMA
1551 NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY |
1552 MR_ENABLE_EOP_INTR);
1553#elif defined(REAL_DMA_POLL)
1554 NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY);
1555#else
1556 /* 1477 /*
1557 * Note : on my sample board, watch-dog timeouts occurred when interrupts 1478 * Note : on my sample board, watch-dog timeouts occurred when interrupts
1558 * were not disabled for the duration of a single DMA transfer, from 1479 * were not disabled for the duration of a single DMA transfer, from
@@ -1564,7 +1485,6 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
1564 MR_ENABLE_EOP_INTR); 1485 MR_ENABLE_EOP_INTR);
1565 else 1486 else
1566 NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY); 1487 NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_MONITOR_BSY);
1567#endif /* def REAL_DMA */
1568 1488
1569 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));
1570 1490
@@ -1584,14 +1504,8 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
1584 io_recovery_delay(1); 1504 io_recovery_delay(1);
1585 } 1505 }
1586 1506
1587#if defined(REAL_DMA_POLL)
1588 do {
1589 tmp = NCR5380_read(BUS_AND_STATUS_REG);
1590 } while ((tmp & BASR_PHASE_MATCH) && !(tmp & (BASR_BUSY_ERROR | BASR_END_DMA_TRANSFER)));
1591
1592/* 1507/*
1593 * At this point, either we've completed DMA, or we have a phase mismatch, 1508 * A note regarding the DMA errata workarounds for early NMOS silicon.
1594 * or we've unexpectedly lost BUSY (which is a real error).
1595 * 1509 *
1596 * For DMA sends, we want to wait until the last byte has been 1510 * For DMA sends, we want to wait until the last byte has been
1597 * transferred out over the bus before we turn off DMA mode. Alas, there 1511 * transferred out over the bus before we turn off DMA mode. Alas, there
@@ -1618,79 +1532,18 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
1618 * properly, or the target switches to MESSAGE IN phase to signal a 1532 * properly, or the target switches to MESSAGE IN phase to signal a
1619 * disconnection (either operation bringing the DMA to a clean halt). 1533 * disconnection (either operation bringing the DMA to a clean halt).
1620 * However, in order to handle scatter-receive, we must work around the 1534 * However, in order to handle scatter-receive, we must work around the
1621 * problem. The chosen fix is to DMA N-2 bytes, then check for the 1535 * problem. The chosen fix is to DMA fewer bytes, then check for the
1622 * condition before taking the NCR5380 out of DMA mode. One or two extra 1536 * condition before taking the NCR5380 out of DMA mode. One or two extra
1623 * bytes are transferred via PIO as necessary to fill out the original 1537 * bytes are transferred via PIO as necessary to fill out the original
1624 * request. 1538 * request.
1625 */ 1539 */
1626 1540
1627 if (p & SR_IO) { 1541 if (p & SR_IO) {
1628 if (!(hostdata->flags & FLAG_NO_DMA_FIXUPS)) {
1629 udelay(10);
1630 if ((NCR5380_read(BUS_AND_STATUS_REG) & (BASR_PHASE_MATCH | BASR_ACK)) ==
1631 (BASR_PHASE_MATCH | BASR_ACK)) {
1632 saved_data = NCR5380_read(INPUT_DATA_REGISTER);
1633 overrun = 1;
1634 }
1635 }
1636 } else {
1637 int limit = 100;
1638 while (((tmp = NCR5380_read(BUS_AND_STATUS_REG)) & BASR_ACK) || (NCR5380_read(STATUS_REG) & SR_REQ)) {
1639 if (!(tmp & BASR_PHASE_MATCH))
1640 break;
1641 if (--limit < 0)
1642 break;
1643 }
1644 }
1645
1646 dsprintk(NDEBUG_DMA, "polled DMA transfer complete, basr 0x%02x, sr 0x%02x\n",
1647 tmp, NCR5380_read(STATUS_REG));
1648
1649 NCR5380_write(MODE_REG, MR_BASE);
1650 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1651
1652 residue = NCR5380_dma_residual(instance);
1653 c -= residue;
1654 *count -= c;
1655 *data += c;
1656 *phase = NCR5380_read(STATUS_REG) & PHASE_MASK;
1657
1658 if (!(hostdata->flags & FLAG_NO_DMA_FIXUPS) &&
1659 *phase == p && (p & SR_IO) && residue == 0) {
1660 if (overrun) {
1661 dprintk(NDEBUG_DMA, "Got an input overrun, using saved byte\n");
1662 **data = saved_data;
1663 *data += 1;
1664 *count -= 1;
1665 cnt = toPIO = 1;
1666 } else {
1667 printk("No overrun??\n");
1668 cnt = toPIO = 2;
1669 }
1670 dprintk(NDEBUG_DMA, "Doing %d-byte PIO to 0x%X\n", cnt, *data);
1671 NCR5380_transfer_pio(instance, phase, &cnt, data);
1672 *count -= toPIO - cnt;
1673 }
1674
1675 dprintk(NDEBUG_DMA, "Return with data ptr = 0x%X, count %d, last 0x%X, next 0x%X\n", *data, *count, *(*data + *count - 1), *(*data + *count));
1676 return 0;
1677
1678#elif defined(REAL_DMA)
1679 return 0;
1680#else /* defined(REAL_DMA_POLL) */
1681 if (p & SR_IO) {
1682 foo = NCR5380_pread(instance, d, 1542 foo = NCR5380_pread(instance, d,
1683 hostdata->flags & FLAG_NO_DMA_FIXUP ? c : c - 1); 1543 hostdata->flags & FLAG_NO_DMA_FIXUP ? c : c - 1);
1684 if (!foo && !(hostdata->flags & FLAG_NO_DMA_FIXUP)) { 1544 if (!foo && !(hostdata->flags & FLAG_NO_DMA_FIXUP)) {
1685 /* 1545 /*
1686 * We can't disable DMA mode after successfully transferring 1546 * The workaround was to transfer fewer bytes than we
1687 * what we plan to be the last byte, since that would open up
1688 * a race condition where if the target asserted REQ before
1689 * we got the DMA mode reset, the NCR5380 would have latched
1690 * an additional byte into the INPUT DATA register and we'd
1691 * have dropped it.
1692 *
1693 * The workaround was to transfer one fewer bytes than we
1694 * intended to with the pseudo-DMA read function, wait for 1547 * intended to with the pseudo-DMA read function, wait for
1695 * the chip to latch the last byte, read it, and then disable 1548 * the chip to latch the last byte, read it, and then disable
1696 * pseudo-DMA mode. 1549 * pseudo-DMA mode.
@@ -1738,9 +1591,8 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
1738 *count = 0; 1591 *count = 0;
1739 *phase = NCR5380_read(STATUS_REG) & PHASE_MASK; 1592 *phase = NCR5380_read(STATUS_REG) & PHASE_MASK;
1740 return foo; 1593 return foo;
1741#endif /* def REAL_DMA */
1742} 1594}
1743#endif /* defined(REAL_DMA) | defined(PSEUDO_DMA) */ 1595#endif /* PSEUDO_DMA */
1744 1596
1745/* 1597/*
1746 * Function : NCR5380_information_transfer (struct Scsi_Host *instance) 1598 * Function : NCR5380_information_transfer (struct Scsi_Host *instance)
@@ -1831,7 +1683,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
1831 * in an unconditional loop. 1683 * in an unconditional loop.
1832 */ 1684 */
1833 1685
1834#if defined(PSEUDO_DMA) || defined(REAL_DMA_POLL) 1686#if defined(PSEUDO_DMA)
1835 transfersize = 0; 1687 transfersize = 0;
1836 if (!cmd->device->borken) 1688 if (!cmd->device->borken)
1837 transfersize = NCR5380_dma_xfer_len(instance, cmd, phase); 1689 transfersize = NCR5380_dma_xfer_len(instance, cmd, phase);
@@ -1855,7 +1707,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
1855 } else 1707 } else
1856 cmd->SCp.this_residual -= transfersize - len; 1708 cmd->SCp.this_residual -= transfersize - len;
1857 } else 1709 } else
1858#endif /* defined(PSEUDO_DMA) || defined(REAL_DMA_POLL) */ 1710#endif /* PSEUDO_DMA */
1859 { 1711 {
1860 /* Break up transfer into 3 ms chunks, 1712 /* Break up transfer into 3 ms chunks,
1861 * presuming 6 accesses per handshake. 1713 * presuming 6 accesses per handshake.
@@ -2202,52 +2054,6 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
2202 scmd_id(tmp), tmp->device->lun, tmp->tag); 2054 scmd_id(tmp), tmp->device->lun, tmp->tag);
2203} 2055}
2204 2056
2205/*
2206 * Function : void NCR5380_dma_complete (struct Scsi_Host *instance)
2207 *
2208 * Purpose : called by interrupt handler when DMA finishes or a phase
2209 * mismatch occurs (which would finish the DMA transfer).
2210 *
2211 * Inputs : instance - this instance of the NCR5380.
2212 *
2213 * Returns : pointer to the scsi_cmnd structure for which the I_T_L
2214 * nexus has been reestablished, on failure NULL is returned.
2215 */
2216
2217#ifdef REAL_DMA
2218static void NCR5380_dma_complete(NCR5380_instance * instance) {
2219 struct NCR5380_hostdata *hostdata = shost_priv(instance);
2220 int transferred;
2221
2222 /*
2223 * XXX this might not be right.
2224 *
2225 * Wait for final byte to transfer, ie wait for ACK to go false.
2226 *
2227 * We should use the Last Byte Sent bit, unfortunately this is
2228 * not available on the 5380/5381 (only the various CMOS chips)
2229 *
2230 * FIXME: timeout, and need to handle long timeout/irq case
2231 */
2232
2233 NCR5380_poll_politely(instance, BUS_AND_STATUS_REG, BASR_ACK, 0, 5*HZ);
2234
2235 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2236
2237 /*
2238 * The only places we should see a phase mismatch and have to send
2239 * data from the same set of pointers will be the data transfer
2240 * phases. So, residual, requested length are only important here.
2241 */
2242
2243 if (!(hostdata->connected->SCp.phase & SR_CD)) {
2244 transferred = instance->dmalen - NCR5380_dma_residual();
2245 hostdata->connected->SCp.this_residual -= transferred;
2246 hostdata->connected->SCp.ptr += transferred;
2247 }
2248}
2249#endif /* def REAL_DMA */
2250
2251/** 2057/**
2252 * list_find_cmd - test for presence of a command in a linked list 2058 * list_find_cmd - test for presence of a command in a linked list
2253 * @haystack: list of commands 2059 * @haystack: list of commands
@@ -2359,9 +2165,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
2359 if (hostdata->connected == cmd) { 2165 if (hostdata->connected == cmd) {
2360 dsprintk(NDEBUG_ABORT, instance, "abort: cmd %p is connected\n", cmd); 2166 dsprintk(NDEBUG_ABORT, instance, "abort: cmd %p is connected\n", cmd);
2361 hostdata->connected = NULL; 2167 hostdata->connected = NULL;
2362#ifdef REAL_DMA
2363 hostdata->dma_len = 0; 2168 hostdata->dma_len = 0;
2364#endif
2365 if (do_abort(instance)) { 2169 if (do_abort(instance)) {
2366 set_host_byte(cmd, DID_ERROR); 2170 set_host_byte(cmd, DID_ERROR);
2367 complete_cmd(instance, cmd); 2171 complete_cmd(instance, cmd);
@@ -2464,9 +2268,7 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
2464 2268
2465 for (i = 0; i < 8; ++i) 2269 for (i = 0; i < 8; ++i)
2466 hostdata->busy[i] = 0; 2270 hostdata->busy[i] = 0;
2467#ifdef REAL_DMA
2468 hostdata->dma_len = 0; 2271 hostdata->dma_len = 0;
2469#endif
2470 2272
2471 queue_work(hostdata->work_q, &hostdata->main_task); 2273 queue_work(hostdata->work_q, &hostdata->main_task);
2472 spin_unlock_irqrestore(&hostdata->lock, flags); 2274 spin_unlock_irqrestore(&hostdata->lock, flags);
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index a79288682a74..0b03ba25bd66 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -239,9 +239,7 @@ struct NCR5380_hostdata {
239 struct Scsi_Host *host; /* Host backpointer */ 239 struct Scsi_Host *host; /* Host backpointer */
240 unsigned char id_mask, id_higher_mask; /* 1 << id, all bits greater */ 240 unsigned char id_mask, id_higher_mask; /* 1 << id, all bits greater */
241 unsigned char busy[8]; /* index = target, bit = lun */ 241 unsigned char busy[8]; /* index = target, bit = lun */
242#if defined(REAL_DMA) || defined(REAL_DMA_POLL)
243 int dma_len; /* requested length of DMA */ 242 int dma_len; /* requested length of DMA */
244#endif
245 unsigned char last_message; /* last message OUT */ 243 unsigned char last_message; /* last message OUT */
246 struct scsi_cmnd *connected; /* currently connected cmnd */ 244 struct scsi_cmnd *connected; /* currently connected cmnd */
247 struct scsi_cmnd *selecting; /* cmnd to be connected */ 245 struct scsi_cmnd *selecting; /* cmnd to be connected */
@@ -319,118 +317,8 @@ static void NCR5380_main(struct work_struct *work);
319static const char *NCR5380_info(struct Scsi_Host *instance); 317static const char *NCR5380_info(struct Scsi_Host *instance);
320static void NCR5380_reselect(struct Scsi_Host *instance); 318static void NCR5380_reselect(struct Scsi_Host *instance);
321static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *, struct scsi_cmnd *); 319static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *, struct scsi_cmnd *);
322#if defined(PSEUDO_DMA) || defined(REAL_DMA) || defined(REAL_DMA_POLL)
323static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data); 320static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);
324#endif
325static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data); 321static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);
326 322
327#if (defined(REAL_DMA) || defined(REAL_DMA_POLL))
328
329#if defined(i386) || defined(__alpha__)
330
331/**
332 * NCR5380_pc_dma_setup - setup ISA DMA
333 * @instance: adapter to set up
334 * @ptr: block to transfer (virtual address)
335 * @count: number of bytes to transfer
336 * @mode: DMA controller mode to use
337 *
338 * Program the DMA controller ready to perform an ISA DMA transfer
339 * on this chip.
340 *
341 * Locks: takes and releases the ISA DMA lock.
342 */
343
344static __inline__ int NCR5380_pc_dma_setup(struct Scsi_Host *instance, unsigned char *ptr, unsigned int count, unsigned char mode)
345{
346 unsigned limit;
347 unsigned long bus_addr = virt_to_bus(ptr);
348 unsigned long flags;
349
350 if (instance->dma_channel <= 3) {
351 if (count > 65536)
352 count = 65536;
353 limit = 65536 - (bus_addr & 0xFFFF);
354 } else {
355 if (count > 65536 * 2)
356 count = 65536 * 2;
357 limit = 65536 * 2 - (bus_addr & 0x1FFFF);
358 }
359
360 if (count > limit)
361 count = limit;
362
363 if ((count & 1) || (bus_addr & 1))
364 panic("scsi%d : attempted unaligned DMA transfer\n", instance->host_no);
365
366 flags=claim_dma_lock();
367 disable_dma(instance->dma_channel);
368 clear_dma_ff(instance->dma_channel);
369 set_dma_addr(instance->dma_channel, bus_addr);
370 set_dma_count(instance->dma_channel, count);
371 set_dma_mode(instance->dma_channel, mode);
372 enable_dma(instance->dma_channel);
373 release_dma_lock(flags);
374
375 return count;
376}
377
378/**
379 * NCR5380_pc_dma_write_setup - setup ISA DMA write
380 * @instance: adapter to set up
381 * @ptr: block to transfer (virtual address)
382 * @count: number of bytes to transfer
383 *
384 * Program the DMA controller ready to perform an ISA DMA write to the
385 * SCSI controller.
386 *
387 * Locks: called routines take and release the ISA DMA lock.
388 */
389
390static __inline__ int NCR5380_pc_dma_write_setup(struct Scsi_Host *instance, unsigned char *src, unsigned int count)
391{
392 return NCR5380_pc_dma_setup(instance, src, count, DMA_MODE_WRITE);
393}
394
395/**
396 * NCR5380_pc_dma_read_setup - setup ISA DMA read
397 * @instance: adapter to set up
398 * @ptr: block to transfer (virtual address)
399 * @count: number of bytes to transfer
400 *
401 * Program the DMA controller ready to perform an ISA DMA read from the
402 * SCSI controller.
403 *
404 * Locks: called routines take and release the ISA DMA lock.
405 */
406
407static __inline__ int NCR5380_pc_dma_read_setup(struct Scsi_Host *instance, unsigned char *src, unsigned int count)
408{
409 return NCR5380_pc_dma_setup(instance, src, count, DMA_MODE_READ);
410}
411
412/**
413 * NCR5380_pc_dma_residual - return bytes left
414 * @instance: adapter
415 *
416 * Reports the number of bytes left over after the DMA was terminated.
417 *
418 * Locks: takes and releases the ISA DMA lock.
419 */
420
421static __inline__ int NCR5380_pc_dma_residual(struct Scsi_Host *instance)
422{
423 unsigned long flags;
424 int tmp;
425
426 flags = claim_dma_lock();
427 clear_dma_ff(instance->dma_channel);
428 tmp = get_dma_residue(instance->dma_channel);
429 release_dma_lock(flags);
430
431 return tmp;
432}
433#endif /* defined(i386) || defined(__alpha__) */
434#endif /* defined(REAL_DMA) */
435#endif /* __KERNEL__ */ 323#endif /* __KERNEL__ */
436#endif /* NCR5380_H */ 324#endif /* NCR5380_H */
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 389825ba5d96..c669098e34e1 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -112,15 +112,9 @@
112 * specific implementation of the NCR5380 112 * specific implementation of the NCR5380
113 * 113 *
114 * Either real DMA *or* pseudo DMA may be implemented 114 * Either real DMA *or* pseudo DMA may be implemented
115 * REAL functions :
116 * NCR5380_REAL_DMA should be defined if real DMA is to be used.
117 * Note that the DMA setup functions should return the number of bytes 115 * Note that the DMA setup functions should return the number of bytes
118 * that they were able to program the controller for. 116 * that they were able to program the controller for.
119 * 117 *
120 * Also note that generic i386/PC versions of these macros are
121 * available as NCR5380_i386_dma_write_setup,
122 * NCR5380_i386_dma_read_setup, and NCR5380_i386_dma_residual.
123 *
124 * NCR5380_dma_write_setup(instance, src, count) - initialize 118 * NCR5380_dma_write_setup(instance, src, count) - initialize
125 * NCR5380_dma_read_setup(instance, dst, count) - initialize 119 * NCR5380_dma_read_setup(instance, dst, count) - initialize
126 * NCR5380_dma_residual(instance); - residual count 120 * NCR5380_dma_residual(instance); - residual count
@@ -586,9 +580,6 @@ static void prepare_info(struct Scsi_Host *instance)
586#ifdef DIFFERENTIAL 580#ifdef DIFFERENTIAL
587 "DIFFERENTIAL " 581 "DIFFERENTIAL "
588#endif 582#endif
589#ifdef REAL_DMA
590 "REAL_DMA "
591#endif
592#ifdef PARITY 583#ifdef PARITY
593 "PARITY " 584 "PARITY "
594#endif 585#endif
@@ -629,9 +620,8 @@ static int __init NCR5380_init(struct Scsi_Host *instance, int flags)
629#ifdef SUPPORT_TAGS 620#ifdef SUPPORT_TAGS
630 init_tags(hostdata); 621 init_tags(hostdata);
631#endif 622#endif
632#if defined (REAL_DMA)
633 hostdata->dma_len = 0; 623 hostdata->dma_len = 0;
634#endif 624
635 spin_lock_init(&hostdata->lock); 625 spin_lock_init(&hostdata->lock);
636 hostdata->connected = NULL; 626 hostdata->connected = NULL;
637 hostdata->sensing = NULL; 627 hostdata->sensing = NULL;
@@ -974,11 +964,7 @@ static void NCR5380_main(struct work_struct *work)
974#endif 964#endif
975 } 965 }
976 } 966 }
977 if (hostdata->connected 967 if (hostdata->connected && !hostdata->dma_len) {
978#ifdef REAL_DMA
979 && !hostdata->dma_len
980#endif
981 ) {
982 dsprintk(NDEBUG_MAIN, instance, "main: performing information transfer\n"); 968 dsprintk(NDEBUG_MAIN, instance, "main: performing information transfer\n");
983 NCR5380_information_transfer(instance); 969 NCR5380_information_transfer(instance);
984 done = 0; 970 done = 0;
@@ -990,7 +976,6 @@ static void NCR5380_main(struct work_struct *work)
990} 976}
991 977
992 978
993#ifdef REAL_DMA
994/* 979/*
995 * Function : void NCR5380_dma_complete (struct Scsi_Host *instance) 980 * Function : void NCR5380_dma_complete (struct Scsi_Host *instance)
996 * 981 *
@@ -1071,7 +1056,6 @@ static void NCR5380_dma_complete(struct Scsi_Host *instance)
1071 } 1056 }
1072 } 1057 }
1073} 1058}
1074#endif /* REAL_DMA */
1075 1059
1076 1060
1077/** 1061/**
@@ -1126,7 +1110,6 @@ static irqreturn_t NCR5380_intr(int irq, void *dev_id)
1126 dsprintk(NDEBUG_INTR, instance, "IRQ %d, BASR 0x%02x, SR 0x%02x, MR 0x%02x\n", 1110 dsprintk(NDEBUG_INTR, instance, "IRQ %d, BASR 0x%02x, SR 0x%02x, MR 0x%02x\n",
1127 irq, basr, sr, mr); 1111 irq, basr, sr, mr);
1128 1112
1129#if defined(REAL_DMA)
1130 if ((mr & MR_DMA_MODE) || (mr & MR_MONITOR_BSY)) { 1113 if ((mr & MR_DMA_MODE) || (mr & MR_MONITOR_BSY)) {
1131 /* Probably End of DMA, Phase Mismatch or Loss of BSY. 1114 /* Probably End of DMA, Phase Mismatch or Loss of BSY.
1132 * We ack IRQ after clearing Mode Register. Workarounds 1115 * We ack IRQ after clearing Mode Register. Workarounds
@@ -1142,9 +1125,7 @@ static irqreturn_t NCR5380_intr(int irq, void *dev_id)
1142 NCR5380_write(MODE_REG, MR_BASE); 1125 NCR5380_write(MODE_REG, MR_BASE);
1143 NCR5380_read(RESET_PARITY_INTERRUPT_REG); 1126 NCR5380_read(RESET_PARITY_INTERRUPT_REG);
1144 } 1127 }
1145 } else 1128 } else if ((NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_mask) &&
1146#endif /* REAL_DMA */
1147 if ((NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_mask) &&
1148 (sr & (SR_SEL | SR_IO | SR_BSY | SR_RST)) == (SR_SEL | SR_IO)) { 1129 (sr & (SR_SEL | SR_IO | SR_BSY | SR_RST)) == (SR_SEL | SR_IO)) {
1149 /* Probably reselected */ 1130 /* Probably reselected */
1150 NCR5380_write(SELECT_ENABLE_REG, 0); 1131 NCR5380_write(SELECT_ENABLE_REG, 0);
@@ -1710,7 +1691,7 @@ timeout:
1710 return -1; 1691 return -1;
1711} 1692}
1712 1693
1713#if defined(REAL_DMA) 1694
1714/* 1695/*
1715 * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance, 1696 * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance,
1716 * unsigned char *phase, int *count, unsigned char **data) 1697 * unsigned char *phase, int *count, unsigned char **data)
@@ -1819,7 +1800,6 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
1819 1800
1820 return 0; 1801 return 0;
1821} 1802}
1822#endif /* defined(REAL_DMA) */
1823 1803
1824/* 1804/*
1825 * Function : NCR5380_information_transfer (struct Scsi_Host *instance) 1805 * Function : NCR5380_information_transfer (struct Scsi_Host *instance)
@@ -1866,7 +1846,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
1866 } 1846 }
1867#if defined(CONFIG_SUN3) 1847#if defined(CONFIG_SUN3)
1868 if (phase == PHASE_CMDOUT) { 1848 if (phase == PHASE_CMDOUT) {
1869#if defined(REAL_DMA)
1870 void *d; 1849 void *d;
1871 unsigned long count; 1850 unsigned long count;
1872 1851
@@ -1885,7 +1864,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
1885 sun3_dma_setup_done = cmd; 1864 sun3_dma_setup_done = cmd;
1886 } 1865 }
1887 } 1866 }
1888#endif
1889#ifdef SUN3_SCSI_VME 1867#ifdef SUN3_SCSI_VME
1890 dregs->csr |= CSR_INTR; 1868 dregs->csr |= CSR_INTR;
1891#endif 1869#endif
@@ -1943,12 +1921,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
1943 * in an unconditional loop. 1921 * in an unconditional loop.
1944 */ 1922 */
1945 1923
1946 /* ++roman: I suggest, this should be
1947 * #if def(REAL_DMA)
1948 * instead of leaving REAL_DMA out.
1949 */
1950
1951#if defined(REAL_DMA)
1952#if !defined(CONFIG_SUN3) 1924#if !defined(CONFIG_SUN3)
1953 transfersize = 0; 1925 transfersize = 0;
1954 if (!cmd->device->borken) 1926 if (!cmd->device->borken)
@@ -1972,21 +1944,9 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
1972 do_abort(instance); 1944 do_abort(instance);
1973 cmd->result = DID_ERROR << 16; 1945 cmd->result = DID_ERROR << 16;
1974 /* XXX - need to source or sink data here, as appropriate */ 1946 /* XXX - need to source or sink data here, as appropriate */
1975 } else { 1947 } else
1976#ifdef REAL_DMA
1977 /* ++roman: When using real DMA,
1978 * information_transfer() should return after
1979 * starting DMA since it has nothing more to
1980 * do.
1981 */
1982 return; 1948 return;
1983#else 1949 } else {
1984 cmd->SCp.this_residual -= transfersize - len;
1985#endif
1986 }
1987 } else
1988#endif /* defined(REAL_DMA) */
1989 {
1990 /* Break up transfer into 3 ms chunks, 1950 /* Break up transfer into 3 ms chunks,
1991 * presuming 6 accesses per handshake. 1951 * presuming 6 accesses per handshake.
1992 */ 1952 */
@@ -1997,7 +1957,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
1997 (unsigned char **)&cmd->SCp.ptr); 1957 (unsigned char **)&cmd->SCp.ptr);
1998 cmd->SCp.this_residual -= transfersize - len; 1958 cmd->SCp.this_residual -= transfersize - len;
1999 } 1959 }
2000#if defined(CONFIG_SUN3) && defined(REAL_DMA) 1960#if defined(CONFIG_SUN3)
2001 /* if we had intended to dma that command clear it */ 1961 /* if we had intended to dma that command clear it */
2002 if (sun3_dma_setup_done == cmd) 1962 if (sun3_dma_setup_done == cmd)
2003 sun3_dma_setup_done = NULL; 1963 sun3_dma_setup_done = NULL;
@@ -2305,7 +2265,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
2305 return; 2265 return;
2306 } 2266 }
2307 2267
2308#if defined(CONFIG_SUN3) && defined(REAL_DMA) 2268#if defined(CONFIG_SUN3)
2309 /* acknowledge toggle to MSGIN */ 2269 /* acknowledge toggle to MSGIN */
2310 NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(PHASE_MSGIN)); 2270 NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(PHASE_MSGIN));
2311 2271
@@ -2392,7 +2352,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
2392 return; 2352 return;
2393 } 2353 }
2394 2354
2395#if defined(CONFIG_SUN3) && defined(REAL_DMA) 2355#if defined(CONFIG_SUN3)
2396 /* engage dma setup for the command we just saw */ 2356 /* engage dma setup for the command we just saw */
2397 { 2357 {
2398 void *d; 2358 void *d;
@@ -2555,9 +2515,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
2555 if (hostdata->connected == cmd) { 2515 if (hostdata->connected == cmd) {
2556 dsprintk(NDEBUG_ABORT, instance, "abort: cmd %p is connected\n", cmd); 2516 dsprintk(NDEBUG_ABORT, instance, "abort: cmd %p is connected\n", cmd);
2557 hostdata->connected = NULL; 2517 hostdata->connected = NULL;
2558#ifdef REAL_DMA
2559 hostdata->dma_len = 0; 2518 hostdata->dma_len = 0;
2560#endif
2561 if (do_abort(instance)) { 2519 if (do_abort(instance)) {
2562 set_host_byte(cmd, DID_ERROR); 2520 set_host_byte(cmd, DID_ERROR);
2563 complete_cmd(instance, cmd); 2521 complete_cmd(instance, cmd);
@@ -2664,9 +2622,7 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
2664#endif 2622#endif
2665 for (i = 0; i < 8; ++i) 2623 for (i = 0; i < 8; ++i)
2666 hostdata->busy[i] = 0; 2624 hostdata->busy[i] = 0;
2667#ifdef REAL_DMA
2668 hostdata->dma_len = 0; 2625 hostdata->dma_len = 0;
2669#endif
2670 2626
2671 queue_work(hostdata->work_q, &hostdata->main_task); 2627 queue_work(hostdata->work_q, &hostdata->main_task);
2672 maybe_release_dma_irq(instance); 2628 maybe_release_dma_irq(instance);
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index 78d1b2963f2c..c68e895e971f 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -85,7 +85,6 @@
85 85
86/* Definitions for the core NCR5380 driver. */ 86/* Definitions for the core NCR5380 driver. */
87 87
88#define REAL_DMA
89#define SUPPORT_TAGS 88#define SUPPORT_TAGS
90#define MAX_TAGS 32 89#define MAX_TAGS 32
91#define DMA_MIN_SIZE 32 90#define DMA_MIN_SIZE 32
@@ -159,14 +158,11 @@ static inline unsigned long SCSI_DMA_GETADR(void)
159 return adr; 158 return adr;
160} 159}
161 160
162#ifdef REAL_DMA
163static void atari_scsi_fetch_restbytes(void); 161static void atari_scsi_fetch_restbytes(void);
164#endif
165 162
166static unsigned char (*atari_scsi_reg_read)(unsigned char reg); 163static unsigned char (*atari_scsi_reg_read)(unsigned char reg);
167static void (*atari_scsi_reg_write)(unsigned char reg, unsigned char value); 164static void (*atari_scsi_reg_write)(unsigned char reg, unsigned char value);
168 165
169#ifdef REAL_DMA
170static unsigned long atari_dma_residual, atari_dma_startaddr; 166static unsigned long atari_dma_residual, atari_dma_startaddr;
171static short atari_dma_active; 167static short atari_dma_active;
172/* pointer to the dribble buffer */ 168/* pointer to the dribble buffer */
@@ -185,7 +181,6 @@ static char *atari_dma_orig_addr;
185/* mask for address bits that can't be used with the ST-DMA */ 181/* mask for address bits that can't be used with the ST-DMA */
186static unsigned long atari_dma_stram_mask; 182static unsigned long atari_dma_stram_mask;
187#define STRAM_ADDR(a) (((a) & atari_dma_stram_mask) == 0) 183#define STRAM_ADDR(a) (((a) & atari_dma_stram_mask) == 0)
188#endif
189 184
190static int setup_can_queue = -1; 185static int setup_can_queue = -1;
191module_param(setup_can_queue, int, 0); 186module_param(setup_can_queue, int, 0);
@@ -201,8 +196,6 @@ static int setup_toshiba_delay = -1;
201module_param(setup_toshiba_delay, int, 0); 196module_param(setup_toshiba_delay, int, 0);
202 197
203 198
204#if defined(REAL_DMA)
205
206static int scsi_dma_is_ignored_buserr(unsigned char dma_stat) 199static int scsi_dma_is_ignored_buserr(unsigned char dma_stat)
207{ 200{
208 int i; 201 int i;
@@ -255,12 +248,9 @@ static void scsi_dma_buserr(int irq, void *dummy)
255} 248}
256#endif 249#endif
257 250
258#endif
259
260 251
261static irqreturn_t scsi_tt_intr(int irq, void *dev) 252static irqreturn_t scsi_tt_intr(int irq, void *dev)
262{ 253{
263#ifdef REAL_DMA
264 struct Scsi_Host *instance = dev; 254 struct Scsi_Host *instance = dev;
265 struct NCR5380_hostdata *hostdata = shost_priv(instance); 255 struct NCR5380_hostdata *hostdata = shost_priv(instance);
266 int dma_stat; 256 int dma_stat;
@@ -342,8 +332,6 @@ static irqreturn_t scsi_tt_intr(int irq, void *dev)
342 tt_scsi_dma.dma_ctrl = 0; 332 tt_scsi_dma.dma_ctrl = 0;
343 } 333 }
344 334
345#endif /* REAL_DMA */
346
347 NCR5380_intr(irq, dev); 335 NCR5380_intr(irq, dev);
348 336
349 return IRQ_HANDLED; 337 return IRQ_HANDLED;
@@ -352,7 +340,6 @@ static irqreturn_t scsi_tt_intr(int irq, void *dev)
352 340
353static irqreturn_t scsi_falcon_intr(int irq, void *dev) 341static irqreturn_t scsi_falcon_intr(int irq, void *dev)
354{ 342{
355#ifdef REAL_DMA
356 struct Scsi_Host *instance = dev; 343 struct Scsi_Host *instance = dev;
357 struct NCR5380_hostdata *hostdata = shost_priv(instance); 344 struct NCR5380_hostdata *hostdata = shost_priv(instance);
358 int dma_stat; 345 int dma_stat;
@@ -405,15 +392,12 @@ static irqreturn_t scsi_falcon_intr(int irq, void *dev)
405 atari_dma_orig_addr = NULL; 392 atari_dma_orig_addr = NULL;
406 } 393 }
407 394
408#endif /* REAL_DMA */
409
410 NCR5380_intr(irq, dev); 395 NCR5380_intr(irq, dev);
411 396
412 return IRQ_HANDLED; 397 return IRQ_HANDLED;
413} 398}
414 399
415 400
416#ifdef REAL_DMA
417static void atari_scsi_fetch_restbytes(void) 401static void atari_scsi_fetch_restbytes(void)
418{ 402{
419 int nr; 403 int nr;
@@ -436,7 +420,6 @@ static void atari_scsi_fetch_restbytes(void)
436 *dst++ = *src++; 420 *dst++ = *src++;
437 } 421 }
438} 422}
439#endif /* REAL_DMA */
440 423
441 424
442/* This function releases the lock on the DMA chip if there is no 425/* This function releases the lock on the DMA chip if there is no
@@ -508,8 +491,6 @@ __setup("atascsi=", atari_scsi_setup);
508#endif /* !MODULE */ 491#endif /* !MODULE */
509 492
510 493
511#if defined(REAL_DMA)
512
513static unsigned long atari_scsi_dma_setup(struct Scsi_Host *instance, 494static unsigned long atari_scsi_dma_setup(struct Scsi_Host *instance,
514 void *data, unsigned long count, 495 void *data, unsigned long count,
515 int dir) 496 int dir)
@@ -703,9 +684,6 @@ static unsigned long atari_dma_xfer_len(unsigned long wanted_len,
703} 684}
704 685
705 686
706#endif /* REAL_DMA */
707
708
709/* NCR5380 register access functions 687/* NCR5380 register access functions
710 * 688 *
711 * There are separate functions for TT and Falcon, because the access 689 * There are separate functions for TT and Falcon, because the access
@@ -745,7 +723,6 @@ static int atari_scsi_bus_reset(struct scsi_cmnd *cmd)
745 723
746 local_irq_save(flags); 724 local_irq_save(flags);
747 725
748#ifdef REAL_DMA
749 /* Abort a maybe active DMA transfer */ 726 /* Abort a maybe active DMA transfer */
750 if (IS_A_TT()) { 727 if (IS_A_TT()) {
751 tt_scsi_dma.dma_ctrl = 0; 728 tt_scsi_dma.dma_ctrl = 0;
@@ -754,7 +731,6 @@ static int atari_scsi_bus_reset(struct scsi_cmnd *cmd)
754 atari_dma_active = 0; 731 atari_dma_active = 0;
755 atari_dma_orig_addr = NULL; 732 atari_dma_orig_addr = NULL;
756 } 733 }
757#endif
758 734
759 rv = NCR5380_bus_reset(cmd); 735 rv = NCR5380_bus_reset(cmd);
760 736
@@ -850,8 +826,6 @@ static int __init atari_scsi_probe(struct platform_device *pdev)
850 } 826 }
851 } 827 }
852 828
853
854#ifdef REAL_DMA
855 /* If running on a Falcon and if there's TT-Ram (i.e., more than one 829 /* If running on a Falcon and if there's TT-Ram (i.e., more than one
856 * memory block, since there's always ST-Ram in a Falcon), then 830 * memory block, since there's always ST-Ram in a Falcon), then
857 * allocate a STRAM_BUFFER_SIZE byte dribble buffer for transfers 831 * allocate a STRAM_BUFFER_SIZE byte dribble buffer for transfers
@@ -867,7 +841,6 @@ static int __init atari_scsi_probe(struct platform_device *pdev)
867 atari_dma_phys_buffer = atari_stram_to_phys(atari_dma_buffer); 841 atari_dma_phys_buffer = atari_stram_to_phys(atari_dma_buffer);
868 atari_dma_orig_addr = 0; 842 atari_dma_orig_addr = 0;
869 } 843 }
870#endif
871 844
872 instance = scsi_host_alloc(&atari_scsi_template, 845 instance = scsi_host_alloc(&atari_scsi_template,
873 sizeof(struct NCR5380_hostdata)); 846 sizeof(struct NCR5380_hostdata));
@@ -897,7 +870,7 @@ static int __init atari_scsi_probe(struct platform_device *pdev)
897 goto fail_irq; 870 goto fail_irq;
898 } 871 }
899 tt_mfp.active_edge |= 0x80; /* SCSI int on L->H */ 872 tt_mfp.active_edge |= 0x80; /* SCSI int on L->H */
900#ifdef REAL_DMA 873
901 tt_scsi_dma.dma_ctrl = 0; 874 tt_scsi_dma.dma_ctrl = 0;
902 atari_dma_residual = 0; 875 atari_dma_residual = 0;
903 876
@@ -919,17 +892,14 @@ static int __init atari_scsi_probe(struct platform_device *pdev)
919 892
920 hostdata->read_overruns = 4; 893 hostdata->read_overruns = 4;
921 } 894 }
922#endif
923 } else { 895 } else {
924 /* Nothing to do for the interrupt: the ST-DMA is initialized 896 /* Nothing to do for the interrupt: the ST-DMA is initialized
925 * already. 897 * already.
926 */ 898 */
927#ifdef REAL_DMA
928 atari_dma_residual = 0; 899 atari_dma_residual = 0;
929 atari_dma_active = 0; 900 atari_dma_active = 0;
930 atari_dma_stram_mask = (ATARIHW_PRESENT(EXTD_DMA) ? 0x00000000 901 atari_dma_stram_mask = (ATARIHW_PRESENT(EXTD_DMA) ? 0x00000000
931 : 0xff000000); 902 : 0xff000000);
932#endif
933 } 903 }
934 904
935 NCR5380_maybe_reset_bus(instance); 905 NCR5380_maybe_reset_bus(instance);
diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c
index b9de487bbd31..5551b1623ed6 100644
--- a/drivers/scsi/sun3_scsi.c
+++ b/drivers/scsi/sun3_scsi.c
@@ -38,7 +38,6 @@
38 38
39/* Definitions for the core NCR5380 driver. */ 39/* Definitions for the core NCR5380 driver. */
40 40
41#define REAL_DMA
42/* #define SUPPORT_TAGS */ 41/* #define SUPPORT_TAGS */
43/* minimum number of bytes to do dma on */ 42/* minimum number of bytes to do dma on */
44#define DMA_MIN_SIZE 129 43#define DMA_MIN_SIZE 129
@@ -527,15 +526,9 @@ static int __init sun3_scsi_probe(struct platform_device *pdev)
527 error = request_irq(instance->irq, scsi_sun3_intr, 0, 526 error = request_irq(instance->irq, scsi_sun3_intr, 0,
528 "NCR5380", instance); 527 "NCR5380", instance);
529 if (error) { 528 if (error) {
530#ifdef REAL_DMA
531 pr_err(PFX "scsi%d: IRQ %d not free, bailing out\n", 529 pr_err(PFX "scsi%d: IRQ %d not free, bailing out\n",
532 instance->host_no, instance->irq); 530 instance->host_no, instance->irq);
533 goto fail_irq; 531 goto fail_irq;
534#else
535 pr_warn(PFX "scsi%d: IRQ %d not free, interrupts disabled\n",
536 instance->host_no, instance->irq);
537 instance->irq = NO_IRQ;
538#endif
539 } 532 }
540 533
541 dregs->csr = 0; 534 dregs->csr = 0;
@@ -565,8 +558,7 @@ static int __init sun3_scsi_probe(struct platform_device *pdev)
565 return 0; 558 return 0;
566 559
567fail_host: 560fail_host:
568 if (instance->irq != NO_IRQ) 561 free_irq(instance->irq, instance);
569 free_irq(instance->irq, instance);
570fail_irq: 562fail_irq:
571 NCR5380_exit(instance); 563 NCR5380_exit(instance);
572fail_init: 564fail_init:
@@ -583,8 +575,7 @@ static int __exit sun3_scsi_remove(struct platform_device *pdev)
583 struct Scsi_Host *instance = platform_get_drvdata(pdev); 575 struct Scsi_Host *instance = platform_get_drvdata(pdev);
584 576
585 scsi_remove_host(instance); 577 scsi_remove_host(instance);
586 if (instance->irq != NO_IRQ) 578 free_irq(instance->irq, instance);
587 free_irq(instance->irq, instance);
588 NCR5380_exit(instance); 579 NCR5380_exit(instance);
589 scsi_host_put(instance); 580 scsi_host_put(instance);
590 if (udc_regs) 581 if (udc_regs)