aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAsai Thambi S P <asamymuthupa@micron.com>2012-05-29 21:41:23 -0400
committerJens Axboe <axboe@kernel.dk>2012-05-31 02:36:55 -0400
commit2df7aa96e75c4447e8bae0fd03b8c386c36ece40 (patch)
tree29499c7a0884e6ff7a18b30c027c1762af742120
parent6bb688c048c9625030fc911dc93d49bcd15feb1f (diff)
mtip32xx: Set custom timeouts for PIO commands
This change sets custom timeouts depending on PIO command. Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c55
1 files changed, 28 insertions, 27 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 0809e259b223..4b057a7312d7 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -2002,6 +2002,32 @@ static unsigned int implicit_sector(unsigned char command,
2002 return rv; 2002 return rv;
2003} 2003}
2004 2004
2005static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout)
2006{
2007 switch (fis->command) {
2008 case ATA_CMD_DOWNLOAD_MICRO:
2009 *timeout = 120000; /* 2 minutes */
2010 break;
2011 case ATA_CMD_SEC_ERASE_UNIT:
2012 case 0xFC:
2013 *timeout = 240000; /* 4 minutes */
2014 break;
2015 case ATA_CMD_STANDBYNOW1:
2016 *timeout = 10000; /* 10 seconds */
2017 break;
2018 case 0xF7:
2019 case 0xFA:
2020 *timeout = 60000; /* 60 seconds */
2021 break;
2022 case ATA_CMD_SMART:
2023 *timeout = 15000; /* 15 seconds */
2024 break;
2025 default:
2026 *timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS;
2027 break;
2028 }
2029}
2030
2005/* 2031/*
2006 * Executes a taskfile 2032 * Executes a taskfile
2007 * See ide_taskfile_ioctl() for derivation 2033 * See ide_taskfile_ioctl() for derivation
@@ -2022,7 +2048,7 @@ static int exec_drive_taskfile(struct driver_data *dd,
2022 unsigned int taskin = 0; 2048 unsigned int taskin = 0;
2023 unsigned int taskout = 0; 2049 unsigned int taskout = 0;
2024 u8 nsect = 0; 2050 u8 nsect = 0;
2025 unsigned int timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS; 2051 unsigned int timeout;
2026 unsigned int force_single_sector; 2052 unsigned int force_single_sector;
2027 unsigned int transfer_size; 2053 unsigned int transfer_size;
2028 unsigned long task_file_data; 2054 unsigned long task_file_data;
@@ -2152,32 +2178,7 @@ static int exec_drive_taskfile(struct driver_data *dd,
2152 fis.lba_hi, 2178 fis.lba_hi,
2153 fis.device); 2179 fis.device);
2154 2180
2155 switch (fis.command) { 2181 mtip_set_timeout(&fis, &timeout);
2156 case ATA_CMD_DOWNLOAD_MICRO:
2157 /* Change timeout for Download Microcode to 2 minutes */
2158 timeout = 120000;
2159 break;
2160 case ATA_CMD_SEC_ERASE_UNIT:
2161 /* Change timeout for Security Erase Unit to 4 minutes.*/
2162 timeout = 240000;
2163 break;
2164 case ATA_CMD_STANDBYNOW1:
2165 /* Change timeout for standby immediate to 10 seconds.*/
2166 timeout = 10000;
2167 break;
2168 case 0xF7:
2169 case 0xFA:
2170 /* Change timeout for vendor unique command to 10 secs */
2171 timeout = 10000;
2172 break;
2173 case ATA_CMD_SMART:
2174 /* Change timeout for vendor unique command to 15 secs */
2175 timeout = 15000;
2176 break;
2177 default:
2178 timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS;
2179 break;
2180 }
2181 2182
2182 /* Determine the correct transfer size.*/ 2183 /* Determine the correct transfer size.*/
2183 if (force_single_sector) 2184 if (force_single_sector)