aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Le Moal <damien.lemoal@hgst.com>2016-04-04 12:17:09 -0400
committerTejun Heo <tj@kernel.org>2016-04-04 12:17:09 -0400
commit974e0a4537f556867483f493c7f67ccdcb7fc504 (patch)
tree44ec7451b86d0778c7a2b4b4a7ba5eb558f6bf39
parentd991c872ac7ffaacc4df93efbfbcb4189cee6440 (diff)
libata-core: Allow longer timeout for drive spinup from PUIS
When spinning up a drive from powered on standby mode (PUIS), SETFEATURES_SPINUP is executed with the default timeout used for any SETFEATURES subcommand, that is 5+10 seconds. The total 15s is too short for some drives to complete spinup (e.g. drives with a large indirection table stored on media), resulting in ata_dev_read_id to fail twice on the execution of SETFEATURES_SPINUP. For this feature, allow a larger default timeout of 30 seconds. However, in the same spirit as with the timeout of other feature subcommands, do not ignore ata_probe_timeout if it is set). Signed-off-by: Damien Le Moal <damien.lemoal@hgst.com> Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--drivers/ata/libata-core.c6
-rw-r--r--include/linux/ata.h3
2 files changed, 7 insertions, 2 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 55e257c268dd..7b21021dbf7d 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4528,6 +4528,7 @@ unsigned int ata_dev_set_feature(struct ata_device *dev, u8 enable, u8 feature)
4528{ 4528{
4529 struct ata_taskfile tf; 4529 struct ata_taskfile tf;
4530 unsigned int err_mask; 4530 unsigned int err_mask;
4531 unsigned long timeout = 0;
4531 4532
4532 /* set up set-features taskfile */ 4533 /* set up set-features taskfile */
4533 DPRINTK("set features - SATA features\n"); 4534 DPRINTK("set features - SATA features\n");
@@ -4539,7 +4540,10 @@ unsigned int ata_dev_set_feature(struct ata_device *dev, u8 enable, u8 feature)
4539 tf.protocol = ATA_PROT_NODATA; 4540 tf.protocol = ATA_PROT_NODATA;
4540 tf.nsect = feature; 4541 tf.nsect = feature;
4541 4542
4542 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); 4543 if (enable == SETFEATURES_SPINUP)
4544 timeout = ata_probe_timeout ?
4545 ata_probe_timeout * 1000 : SETFEATURES_SPINUP_TIMEOUT;
4546 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, timeout);
4543 4547
4544 DPRINTK("EXIT, err_mask=%x\n", err_mask); 4548 DPRINTK("EXIT, err_mask=%x\n", err_mask);
4545 return err_mask; 4549 return err_mask;
diff --git a/include/linux/ata.h b/include/linux/ata.h
index c1a2f345cbe6..f310ec0f072e 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -371,7 +371,8 @@ enum {
371 SETFEATURES_AAM_ON = 0x42, 371 SETFEATURES_AAM_ON = 0x42,
372 SETFEATURES_AAM_OFF = 0xC2, 372 SETFEATURES_AAM_OFF = 0xC2,
373 373
374 SETFEATURES_SPINUP = 0x07, /* Spin-up drive */ 374 SETFEATURES_SPINUP = 0x07, /* Spin-up drive */
375 SETFEATURES_SPINUP_TIMEOUT = 30000, /* 30s timeout for drive spin-up from PUIS */
375 376
376 SETFEATURES_SATA_ENABLE = 0x10, /* Enable use of SATA feature */ 377 SETFEATURES_SATA_ENABLE = 0x10, /* Enable use of SATA feature */
377 SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */ 378 SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */