summaryrefslogtreecommitdiff
path: root/drivers/scsi/atari_scsi.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2014-11-12 16:12:14 +1100
committerChristoph Hellwig <hch@lst.de>2014-11-20 09:11:16 +0100
commitef1081cbf05b22d3d0e05b267a5559a8cd8e8d4a (patch)
tree327b642eab6b4d83d5cc268e78a1fb62bfa097ff /drivers/scsi/atari_scsi.c
parentf527590278f1b823ba979a234241d09ed2c436b4 (diff)
atari_NCR5380: Refactor Falcon special cases
Make the atari_NCR5380.c core driver usable by sun3_scsi, mac_scsi and others by moving some of the Falcon-specific code out of the core driver: !IS_A_TT, atari_read_overruns and falcon_dont_release. Replace these with hostdata variables and flags. FLAG_CHECK_LAST_BYTE_SENT is unused in atari_NCR5380.c so don't set it. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Reviewed-by: Hannes Reinecke <hare@suse.de> Tested-by: Michael Schmitz <schmitzmic@gmail.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/atari_scsi.c')
-rw-r--r--drivers/scsi/atari_scsi.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index 78324e056d4c..70c662f9fee4 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -196,8 +196,6 @@ static char *atari_dma_orig_addr;
/* mask for address bits that can't be used with the ST-DMA */
static unsigned long atari_dma_stram_mask;
#define STRAM_ADDR(a) (((a) & atari_dma_stram_mask) == 0)
-/* number of bytes to cut from a transfer to handle NCR overruns */
-static int atari_read_overruns;
#endif
static int setup_can_queue = -1;
@@ -446,8 +444,6 @@ static void atari_scsi_fetch_restbytes(void)
#endif /* REAL_DMA */
-static int falcon_dont_release = 0;
-
/* This function releases the lock on the DMA chip if there is no
* connected command and the disconnected queue is empty.
*/
@@ -464,7 +460,7 @@ static void falcon_release_lock_if_possible(struct NCR5380_hostdata *hostdata)
if (!hostdata->disconnected_queue &&
!hostdata->issue_queue &&
!hostdata->connected &&
- !falcon_dont_release &&
+ !hostdata->retain_dma_intr &&
stdma_is_locked_by(scsi_falcon_intr))
stdma_release();
@@ -846,6 +842,7 @@ static int __init atari_scsi_probe(struct platform_device *pdev)
struct Scsi_Host *instance;
int error;
struct resource *irq;
+ int host_flags = 0;
irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!irq)
@@ -942,7 +939,9 @@ static int __init atari_scsi_probe(struct platform_device *pdev)
instance->irq = irq->start;
- NCR5380_init(instance, 0);
+ host_flags |= IS_A_TT() ? 0 : FLAG_LATE_DMA_SETUP;
+
+ NCR5380_init(instance, host_flags);
if (IS_A_TT()) {
error = request_irq(instance->irq, scsi_tt_intr, 0,
@@ -965,12 +964,16 @@ static int __init atari_scsi_probe(struct platform_device *pdev)
*
* In principle it should be sufficient to do max. 1 byte with
* PIO, but there is another problem on the Medusa with the DMA
- * rest data register. So 'atari_read_overruns' is currently set
+ * rest data register. So read_overruns is currently set
* to 4 to avoid having transfers that aren't a multiple of 4.
* If the rest data bug is fixed, this can be lowered to 1.
*/
- if (MACH_IS_MEDUSA)
- atari_read_overruns = 4;
+ if (MACH_IS_MEDUSA) {
+ struct NCR5380_hostdata *hostdata =
+ shost_priv(instance);
+
+ hostdata->read_overruns = 4;
+ }
#endif
} else {
/* Nothing to do for the interrupt: the ST-DMA is initialized