diff options
author | Tejun Heo <htejun@gmail.com> | 2007-07-16 01:29:38 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-07-20 08:02:10 -0400 |
commit | 2cbb79ebbd4be07041368da5379a64f89f8ad518 (patch) | |
tree | 239d63fca15c2c3abd9f9ef5130a43f6289d0ad1 /drivers/ata/ahci.c | |
parent | 9977126c4b65c1396b665f7a0eeb8c7dede336f9 (diff) |
ahci: use deadline instead of fixed timeout for 1st FIS for SRST
Use deadline instead of fixed timeout for 1st FIS for SRST to improve
robustness of SRST.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r-- | drivers/ata/ahci.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 61c5b6e68de4..0451600bdcc6 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -976,6 +976,7 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class, | |||
976 | void __iomem *port_mmio = ahci_port_base(ap); | 976 | void __iomem *port_mmio = ahci_port_base(ap); |
977 | const u32 cmd_fis_len = 5; /* five dwords */ | 977 | const u32 cmd_fis_len = 5; /* five dwords */ |
978 | const char *reason = NULL; | 978 | const char *reason = NULL; |
979 | unsigned long now, msecs; | ||
979 | struct ata_taskfile tf; | 980 | struct ata_taskfile tf; |
980 | u32 tmp; | 981 | u32 tmp; |
981 | u8 *fis; | 982 | u8 *fis; |
@@ -1016,6 +1017,11 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class, | |||
1016 | fis = pp->cmd_tbl; | 1017 | fis = pp->cmd_tbl; |
1017 | 1018 | ||
1018 | /* issue the first D2H Register FIS */ | 1019 | /* issue the first D2H Register FIS */ |
1020 | msecs = 0; | ||
1021 | now = jiffies; | ||
1022 | if (time_after(now, deadline)) | ||
1023 | msecs = jiffies_to_msecs(deadline - now); | ||
1024 | |||
1019 | ahci_fill_cmd_slot(pp, 0, | 1025 | ahci_fill_cmd_slot(pp, 0, |
1020 | cmd_fis_len | AHCI_CMD_RESET | AHCI_CMD_CLR_BUSY); | 1026 | cmd_fis_len | AHCI_CMD_RESET | AHCI_CMD_CLR_BUSY); |
1021 | 1027 | ||
@@ -1024,7 +1030,7 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class, | |||
1024 | 1030 | ||
1025 | writel(1, port_mmio + PORT_CMD_ISSUE); | 1031 | writel(1, port_mmio + PORT_CMD_ISSUE); |
1026 | 1032 | ||
1027 | tmp = ata_wait_register(port_mmio + PORT_CMD_ISSUE, 0x1, 0x1, 1, 500); | 1033 | tmp = ata_wait_register(port_mmio + PORT_CMD_ISSUE, 0x1, 0x1, 1, msecs); |
1028 | if (tmp & 0x1) { | 1034 | if (tmp & 0x1) { |
1029 | rc = -EIO; | 1035 | rc = -EIO; |
1030 | reason = "1st FIS failed"; | 1036 | reason = "1st FIS failed"; |