diff options
author | Zhang Rui <rui.zhang@intel.com> | 2008-07-04 01:32:17 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-14 15:59:33 -0400 |
commit | 24920c8a6358bf5532f1336b990b1c0fe2b599ee (patch) | |
tree | 576c2dcbde9c76e13585ed37208640fbd3dba005 | |
parent | 1e9dbc9291738149577cc488fd441f061815e02e (diff) |
AHCI: speed up resume
During resume, sleep 1 second to wait for the HBA reset
to finish is a waste of time.
According to the AHCI 1.2 spec,
We should poll the HOST_CTL register,
and return error if the host reset is not
finished within 1 second.
Test results show that the HBA reset can be done quickly(in usecs).
And this patch may save nearly 1 second during resume.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r-- | drivers/ata/ahci.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 65d4e968feb4..4ff3f03cf97b 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1142,12 +1142,15 @@ static int ahci_reset_controller(struct ata_host *host) | |||
1142 | readl(mmio + HOST_CTL); /* flush */ | 1142 | readl(mmio + HOST_CTL); /* flush */ |
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | /* reset must complete within 1 second, or | 1145 | /* |
1146 | * to perform host reset, OS should set HOST_RESET | ||
1147 | * and poll until this bit is read to be "0". | ||
1148 | * reset must complete within 1 second, or | ||
1146 | * the hardware should be considered fried. | 1149 | * the hardware should be considered fried. |
1147 | */ | 1150 | */ |
1148 | ssleep(1); | 1151 | tmp = ata_wait_register(mmio + HOST_CTL, HOST_RESET, |
1152 | HOST_RESET, 10, 1000); | ||
1149 | 1153 | ||
1150 | tmp = readl(mmio + HOST_CTL); | ||
1151 | if (tmp & HOST_RESET) { | 1154 | if (tmp & HOST_RESET) { |
1152 | dev_printk(KERN_ERR, host->dev, | 1155 | dev_printk(KERN_ERR, host->dev, |
1153 | "controller reset failed (0x%x)\n", tmp); | 1156 | "controller reset failed (0x%x)\n", tmp); |