Commit 3be1b3ea authored by Finn Thain's avatar Finn Thain Committed by Martin K. Petersen

ncr5380: Simplify bus reset handlers

Make use of do_reset() in the bus reset handler in atari_NCR5380.c. The
version in NCR5380.c already does so. Keep them in sync.
Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Tested-by: default avatarOndrej Zary <linux@rainbow-software.org>
Tested-by: default avatarMichael Schmitz <schmitzmic@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 9c3f0e2b
...@@ -668,7 +668,7 @@ static void prepare_info(struct Scsi_Host *instance) ...@@ -668,7 +668,7 @@ static void prepare_info(struct Scsi_Host *instance)
* Locks: called functions disable irqs * Locks: called functions disable irqs
*/ */
static void NCR5380_print_status(struct Scsi_Host *instance) static void __maybe_unused NCR5380_print_status(struct Scsi_Host *instance)
{ {
NCR5380_dprint(NDEBUG_ANY, instance); NCR5380_dprint(NDEBUG_ANY, instance);
NCR5380_dprint_phase(NDEBUG_ANY, instance); NCR5380_dprint_phase(NDEBUG_ANY, instance);
...@@ -2693,24 +2693,26 @@ static int NCR5380_abort(struct scsi_cmnd *cmd) ...@@ -2693,24 +2693,26 @@ static int NCR5380_abort(struct scsi_cmnd *cmd)
} }
/* /**
* Function : int NCR5380_bus_reset (struct scsi_cmnd *cmd) * NCR5380_bus_reset - reset the SCSI bus
* * @cmd: SCSI command undergoing EH
* Purpose : reset the SCSI bus.
*
* Returns : SUCCESS
* *
* Locks: host lock taken by caller * Returns SUCCESS
*/ */
static int NCR5380_bus_reset(struct scsi_cmnd *cmd) static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
{ {
struct Scsi_Host *instance = cmd->device->host; struct Scsi_Host *instance = cmd->device->host;
spin_lock_irq(instance->host_lock);
#if (NDEBUG & NDEBUG_ANY)
scmd_printk(KERN_INFO, cmd, "performing bus reset\n");
NCR5380_print_status(instance); NCR5380_print_status(instance);
#endif
spin_lock_irq(instance->host_lock);
do_reset(instance); do_reset(instance);
spin_unlock_irq(instance->host_lock); spin_unlock_irq(instance->host_lock);
return SUCCESS; return SUCCESS;
......
...@@ -719,7 +719,7 @@ static void lprint_Scsi_Cmnd(struct scsi_cmnd *cmd) ...@@ -719,7 +719,7 @@ static void lprint_Scsi_Cmnd(struct scsi_cmnd *cmd)
printk("\n"); printk("\n");
} }
static void NCR5380_print_status(struct Scsi_Host *instance) static void __maybe_unused NCR5380_print_status(struct Scsi_Host *instance)
{ {
struct NCR5380_hostdata *hostdata; struct NCR5380_hostdata *hostdata;
struct scsi_cmnd *ptr; struct scsi_cmnd *ptr;
...@@ -2982,13 +2982,11 @@ int NCR5380_abort(struct scsi_cmnd *cmd) ...@@ -2982,13 +2982,11 @@ int NCR5380_abort(struct scsi_cmnd *cmd)
} }
/* /**
* Function : int NCR5380_reset (struct scsi_cmnd *cmd) * NCR5380_bus_reset - reset the SCSI bus
* * @cmd: SCSI command undergoing EH
* Purpose : reset the SCSI bus.
*
* Returns : SUCCESS or FAILURE
* *
* Returns SUCCESS
*/ */
static int NCR5380_bus_reset(struct scsi_cmnd *cmd) static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
...@@ -2998,22 +2996,19 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd) ...@@ -2998,22 +2996,19 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
int i; int i;
unsigned long flags; unsigned long flags;
local_irq_save(flags);
#if (NDEBUG & NDEBUG_ANY)
scmd_printk(KERN_INFO, cmd, "performing bus reset\n");
NCR5380_print_status(instance); NCR5380_print_status(instance);
#endif
do_reset(instance);
/* get in phase */
NCR5380_write(TARGET_COMMAND_REG,
PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG)));
/* assert RST */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST);
udelay(40);
/* reset NCR registers */ /* reset NCR registers */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
NCR5380_write(MODE_REG, MR_BASE); NCR5380_write(MODE_REG, MR_BASE);
NCR5380_write(TARGET_COMMAND_REG, 0); NCR5380_write(TARGET_COMMAND_REG, 0);
NCR5380_write(SELECT_ENABLE_REG, 0); NCR5380_write(SELECT_ENABLE_REG, 0);
/* ++roman: reset interrupt condition! otherwise no interrupts don't get
* through anymore ... */
(void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
/* After the reset, there are no more connected or disconnected commands /* After the reset, there are no more connected or disconnected commands
* and no busy units; so clear the low-level status here to avoid * and no busy units; so clear the low-level status here to avoid
...@@ -3028,7 +3023,6 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd) ...@@ -3028,7 +3023,6 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
if (hostdata->disconnected_queue) if (hostdata->disconnected_queue)
dprintk(NDEBUG_ABORT, "scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd)); dprintk(NDEBUG_ABORT, "scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd));
local_irq_save(flags);
hostdata->issue_queue = NULL; hostdata->issue_queue = NULL;
hostdata->connected = NULL; hostdata->connected = NULL;
hostdata->disconnected_queue = NULL; hostdata->disconnected_queue = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment