ncr5380: Dont wait for BUS FREE after disconnect
authorFinn Thain <fthain@telegraphics.com.au>
Sun, 3 Jan 2016 05:05:36 +0000 (16:05 +1100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 7 Jan 2016 02:42:59 +0000 (21:42 -0500)
When there is a queued command and no connected command, NCR5380_select()
is called and arbitration begins. The chip waits for BUS FREE once the
MR_ARBITRATE bit in the mode register is enabled. That means there is
no need to wait for BUS FREE after disconnecting.

There is presently no polling for BUS FREE after sending an ABORT or
other message that might lead to disconnection. It only happens after
COMMAND COMPLETE or DISCONNECT messages, which seems inconsistent.
Remove the polling for !BSY in the COMMAND COMPLETE and DISCONNECT
cases.

BTW, the comments say "avoid nasty timeouts" and perhaps BUS FREE polling
was somehow helpful back in Linux v0.99.14u, when it was introduced.
The relevant timeout is presently 1 second (for bus arbitration).

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/NCR5380.c
drivers/scsi/atari_NCR5380.c

index 97975cb273374f7da03be19d744c43321c77d2a3..a64b298eeb559eed1418b728f96277bf14ea3935 100644 (file)
@@ -1976,9 +1976,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
                                         * arbitration can resume.
                                         */
                                        NCR5380_write(TARGET_COMMAND_REG, 0);
-
-                                       while ((NCR5380_read(STATUS_REG) & SR_BSY) && !hostdata->connected)
-                                               barrier();
                                        return;
                                case MESSAGE_REJECT:
                                        /* Accept message by clearing ACK */
@@ -2011,10 +2008,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 
                                                /* Enable reselect interrupts */
                                                NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
-                                               /* Wait for bus free to avoid nasty timeouts - FIXME timeout !*/
-                                               /* NCR538_poll_politely(instance, STATUS_REG, SR_BSY, 0, 30 * HZ); */
-                                               while ((NCR5380_read(STATUS_REG) & SR_BSY) && !hostdata->connected)
-                                                       barrier();
                                                return;
                                        }
                                        /* 
index a92e4a531d34afa34261259fe6cc030e3a16840b..437e1e59b905f6e986ff6330c49d1c0a0a9da6b3 100644 (file)
@@ -2213,7 +2213,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
                                                  "completed\n", HOSTNO, cmd->device->id, cmd->device->lun);
 
                                        local_irq_save(flags);
-                                       hostdata->retain_dma_intr++;
                                        hostdata->connected = NULL;
 #ifdef SUPPORT_TAGS
                                        cmd_free_tag(cmd);
@@ -2282,8 +2281,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
                                                cmd->scsi_done(cmd);
                                        }
 
-                                       local_irq_restore(flags);
-
                                        NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
                                        /*
                                         * Restore phase bits to 0 so an interrupted selection,
@@ -2291,11 +2288,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
                                         */
                                        NCR5380_write(TARGET_COMMAND_REG, 0);
 
-                                       while ((NCR5380_read(STATUS_REG) & SR_BSY) && !hostdata->connected)
-                                               barrier();
-
-                                       local_irq_save(flags);
-                                       hostdata->retain_dma_intr--;
                                        /* ++roman: For Falcon SCSI, release the lock on the
                                         * ST-DMA here if no other commands are waiting on the
                                         * disconnected queue.
@@ -2349,9 +2341,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
 
                                        /* Enable reselect interrupts */
                                        NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
-                                       /* Wait for bus free to avoid nasty timeouts */
-                                       while ((NCR5380_read(STATUS_REG) & SR_BSY) && !hostdata->connected)
-                                               barrier();
 #ifdef SUN3_SCSI_VME
                                        dregs->csr |= CSR_DMA_ENABLE;
 #endif