diff options
author | Asai Thambi S P <asamymuthupa@micron.com> | 2014-04-16 23:27:54 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-04-22 21:46:21 -0400 |
commit | 670a641420a3d9586eebe7429dfeec4e7ed447aa (patch) | |
tree | 93df45be230a9648cd2aa35eed084cb4b0e79ce7 /drivers/block/mtip32xx | |
parent | 24cddb83b4ae3a601f807e96cde9bf24fb90e5f5 (diff) |
mtip32xx: Increase timeout for STANDBY IMMEDIATE command
Increased timeout for STANDBY IMMEDIATE command to 2 minutes.
Signed-off-by: Selvan Mani <smani@micron.com>
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Cc: stable@kernel.org
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block/mtip32xx')
-rw-r--r-- | drivers/block/mtip32xx/mtip32xx.c | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 59c5abe32f06..51628eb6f445 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -1529,6 +1529,37 @@ static inline void ata_swap_string(u16 *buf, unsigned int len) | |||
1529 | be16_to_cpus(&buf[i]); | 1529 | be16_to_cpus(&buf[i]); |
1530 | } | 1530 | } |
1531 | 1531 | ||
1532 | static void mtip_set_timeout(struct driver_data *dd, | ||
1533 | struct host_to_dev_fis *fis, | ||
1534 | unsigned int *timeout, u8 erasemode) | ||
1535 | { | ||
1536 | switch (fis->command) { | ||
1537 | case ATA_CMD_DOWNLOAD_MICRO: | ||
1538 | *timeout = 120000; /* 2 minutes */ | ||
1539 | break; | ||
1540 | case ATA_CMD_SEC_ERASE_UNIT: | ||
1541 | case 0xFC: | ||
1542 | if (erasemode) | ||
1543 | *timeout = ((*(dd->port->identify + 90) * 2) * 60000); | ||
1544 | else | ||
1545 | *timeout = ((*(dd->port->identify + 89) * 2) * 60000); | ||
1546 | break; | ||
1547 | case ATA_CMD_STANDBYNOW1: | ||
1548 | *timeout = 120000; /* 2 minutes */ | ||
1549 | break; | ||
1550 | case 0xF7: | ||
1551 | case 0xFA: | ||
1552 | *timeout = 60000; /* 60 seconds */ | ||
1553 | break; | ||
1554 | case ATA_CMD_SMART: | ||
1555 | *timeout = 15000; /* 15 seconds */ | ||
1556 | break; | ||
1557 | default: | ||
1558 | *timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS; | ||
1559 | break; | ||
1560 | } | ||
1561 | } | ||
1562 | |||
1532 | /* | 1563 | /* |
1533 | * Request the device identity information. | 1564 | * Request the device identity information. |
1534 | * | 1565 | * |
@@ -1644,6 +1675,7 @@ static int mtip_standby_immediate(struct mtip_port *port) | |||
1644 | int rv; | 1675 | int rv; |
1645 | struct host_to_dev_fis fis; | 1676 | struct host_to_dev_fis fis; |
1646 | unsigned long start; | 1677 | unsigned long start; |
1678 | unsigned int timeout; | ||
1647 | 1679 | ||
1648 | /* Build the FIS. */ | 1680 | /* Build the FIS. */ |
1649 | memset(&fis, 0, sizeof(struct host_to_dev_fis)); | 1681 | memset(&fis, 0, sizeof(struct host_to_dev_fis)); |
@@ -1651,6 +1683,8 @@ static int mtip_standby_immediate(struct mtip_port *port) | |||
1651 | fis.opts = 1 << 7; | 1683 | fis.opts = 1 << 7; |
1652 | fis.command = ATA_CMD_STANDBYNOW1; | 1684 | fis.command = ATA_CMD_STANDBYNOW1; |
1653 | 1685 | ||
1686 | mtip_set_timeout(port->dd, &fis, &timeout, 0); | ||
1687 | |||
1654 | start = jiffies; | 1688 | start = jiffies; |
1655 | rv = mtip_exec_internal_command(port, | 1689 | rv = mtip_exec_internal_command(port, |
1656 | &fis, | 1690 | &fis, |
@@ -1659,7 +1693,7 @@ static int mtip_standby_immediate(struct mtip_port *port) | |||
1659 | 0, | 1693 | 0, |
1660 | 0, | 1694 | 0, |
1661 | GFP_ATOMIC, | 1695 | GFP_ATOMIC, |
1662 | 15000); | 1696 | timeout); |
1663 | dbg_printk(MTIP_DRV_NAME "Time taken to complete standby cmd: %d ms\n", | 1697 | dbg_printk(MTIP_DRV_NAME "Time taken to complete standby cmd: %d ms\n", |
1664 | jiffies_to_msecs(jiffies - start)); | 1698 | jiffies_to_msecs(jiffies - start)); |
1665 | if (rv) | 1699 | if (rv) |
@@ -2202,36 +2236,6 @@ static unsigned int implicit_sector(unsigned char command, | |||
2202 | } | 2236 | } |
2203 | return rv; | 2237 | return rv; |
2204 | } | 2238 | } |
2205 | static void mtip_set_timeout(struct driver_data *dd, | ||
2206 | struct host_to_dev_fis *fis, | ||
2207 | unsigned int *timeout, u8 erasemode) | ||
2208 | { | ||
2209 | switch (fis->command) { | ||
2210 | case ATA_CMD_DOWNLOAD_MICRO: | ||
2211 | *timeout = 120000; /* 2 minutes */ | ||
2212 | break; | ||
2213 | case ATA_CMD_SEC_ERASE_UNIT: | ||
2214 | case 0xFC: | ||
2215 | if (erasemode) | ||
2216 | *timeout = ((*(dd->port->identify + 90) * 2) * 60000); | ||
2217 | else | ||
2218 | *timeout = ((*(dd->port->identify + 89) * 2) * 60000); | ||
2219 | break; | ||
2220 | case ATA_CMD_STANDBYNOW1: | ||
2221 | *timeout = 120000; /* 2 minutes */ | ||
2222 | break; | ||
2223 | case 0xF7: | ||
2224 | case 0xFA: | ||
2225 | *timeout = 60000; /* 60 seconds */ | ||
2226 | break; | ||
2227 | case ATA_CMD_SMART: | ||
2228 | *timeout = 15000; /* 15 seconds */ | ||
2229 | break; | ||
2230 | default: | ||
2231 | *timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS; | ||
2232 | break; | ||
2233 | } | ||
2234 | } | ||
2235 | 2239 | ||
2236 | /* | 2240 | /* |
2237 | * Executes a taskfile | 2241 | * Executes a taskfile |