Commit a44da38f authored by Asai Thambi S P's avatar Asai Thambi S P Committed by Jiri Slaby

mtip32xx: Increase timeout for STANDBY IMMEDIATE command

commit 670a6414 upstream.

Increased timeout for STANDBY IMMEDIATE command to 2 minutes.
Signed-off-by: default avatarSelvan Mani <smani@micron.com>
Signed-off-by: default avatarAsai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 0522e924
...@@ -1493,6 +1493,37 @@ static inline void ata_swap_string(u16 *buf, unsigned int len) ...@@ -1493,6 +1493,37 @@ static inline void ata_swap_string(u16 *buf, unsigned int len)
be16_to_cpus(&buf[i]); be16_to_cpus(&buf[i]);
} }
static void mtip_set_timeout(struct driver_data *dd,
struct host_to_dev_fis *fis,
unsigned int *timeout, u8 erasemode)
{
switch (fis->command) {
case ATA_CMD_DOWNLOAD_MICRO:
*timeout = 120000; /* 2 minutes */
break;
case ATA_CMD_SEC_ERASE_UNIT:
case 0xFC:
if (erasemode)
*timeout = ((*(dd->port->identify + 90) * 2) * 60000);
else
*timeout = ((*(dd->port->identify + 89) * 2) * 60000);
break;
case ATA_CMD_STANDBYNOW1:
*timeout = 120000; /* 2 minutes */
break;
case 0xF7:
case 0xFA:
*timeout = 60000; /* 60 seconds */
break;
case ATA_CMD_SMART:
*timeout = 15000; /* 15 seconds */
break;
default:
*timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS;
break;
}
}
/* /*
* Request the device identity information. * Request the device identity information.
* *
...@@ -1602,6 +1633,7 @@ static int mtip_standby_immediate(struct mtip_port *port) ...@@ -1602,6 +1633,7 @@ static int mtip_standby_immediate(struct mtip_port *port)
int rv; int rv;
struct host_to_dev_fis fis; struct host_to_dev_fis fis;
unsigned long start; unsigned long start;
unsigned int timeout;
/* Build the FIS. */ /* Build the FIS. */
memset(&fis, 0, sizeof(struct host_to_dev_fis)); memset(&fis, 0, sizeof(struct host_to_dev_fis));
...@@ -1609,6 +1641,8 @@ static int mtip_standby_immediate(struct mtip_port *port) ...@@ -1609,6 +1641,8 @@ static int mtip_standby_immediate(struct mtip_port *port)
fis.opts = 1 << 7; fis.opts = 1 << 7;
fis.command = ATA_CMD_STANDBYNOW1; fis.command = ATA_CMD_STANDBYNOW1;
mtip_set_timeout(port->dd, &fis, &timeout, 0);
start = jiffies; start = jiffies;
rv = mtip_exec_internal_command(port, rv = mtip_exec_internal_command(port,
&fis, &fis,
...@@ -1617,7 +1651,7 @@ static int mtip_standby_immediate(struct mtip_port *port) ...@@ -1617,7 +1651,7 @@ static int mtip_standby_immediate(struct mtip_port *port)
0, 0,
0, 0,
GFP_ATOMIC, GFP_ATOMIC,
15000); timeout);
dbg_printk(MTIP_DRV_NAME "Time taken to complete standby cmd: %d ms\n", dbg_printk(MTIP_DRV_NAME "Time taken to complete standby cmd: %d ms\n",
jiffies_to_msecs(jiffies - start)); jiffies_to_msecs(jiffies - start));
if (rv) if (rv)
...@@ -2156,36 +2190,6 @@ static unsigned int implicit_sector(unsigned char command, ...@@ -2156,36 +2190,6 @@ static unsigned int implicit_sector(unsigned char command,
} }
return rv; return rv;
} }
static void mtip_set_timeout(struct driver_data *dd,
struct host_to_dev_fis *fis,
unsigned int *timeout, u8 erasemode)
{
switch (fis->command) {
case ATA_CMD_DOWNLOAD_MICRO:
*timeout = 120000; /* 2 minutes */
break;
case ATA_CMD_SEC_ERASE_UNIT:
case 0xFC:
if (erasemode)
*timeout = ((*(dd->port->identify + 90) * 2) * 60000);
else
*timeout = ((*(dd->port->identify + 89) * 2) * 60000);
break;
case ATA_CMD_STANDBYNOW1:
*timeout = 120000; /* 2 minutes */
break;
case 0xF7:
case 0xFA:
*timeout = 60000; /* 60 seconds */
break;
case ATA_CMD_SMART:
*timeout = 15000; /* 15 seconds */
break;
default:
*timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS;
break;
}
}
/* /*
* Executes a taskfile * Executes a taskfile
......
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