aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2008-04-07 09:47:19 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-04-17 15:44:22 -0400
commita89611e8489ac24f371c9fd6fef6605b170b16ba (patch)
treeffde56421ee093e92e8c0673eeaca7ecd6b4093a /drivers/ata/ahci.c
parentaa2731ad9ad80ac3fca48bd1c4cf0eceede4810e (diff)
ahci: use ata_wait_after_reset() instead of ata_sff_wait_ready()
Implement ahci_check_ready() and replace ata_sff_wait_after_reset() with ata_wait_after_reset(). As ahci was faking TF access, this change doesn't result in any functional difference. Signed-off-by: Tejun Heo <htejun@gmail.com>
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r--drivers/ata/ahci.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 45a67a9ad8ab..7e251a2cbda5 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1256,6 +1256,16 @@ static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp,
1256 return 0; 1256 return 0;
1257} 1257}
1258 1258
1259static int ahci_check_ready(struct ata_link *link)
1260{
1261 void __iomem *mmio = link->ap->ioaddr.cmd_addr;
1262 u8 status = readl(mmio + PORT_TFDATA) & 0xFF;
1263
1264 if (!(status & ATA_BUSY))
1265 return 1;
1266 return 0;
1267}
1268
1259static int ahci_do_softreset(struct ata_link *link, unsigned int *class, 1269static int ahci_do_softreset(struct ata_link *link, unsigned int *class,
1260 int pmp, unsigned long deadline) 1270 int pmp, unsigned long deadline)
1261{ 1271{
@@ -1303,7 +1313,7 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class,
1303 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); 1313 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0);
1304 1314
1305 /* wait for link to become ready */ 1315 /* wait for link to become ready */
1306 rc = ata_sff_wait_after_reset(link, 1, deadline); 1316 rc = ata_wait_after_reset(link, deadline, ahci_check_ready);
1307 /* link occupied, -ENODEV too is an error */ 1317 /* link occupied, -ENODEV too is an error */
1308 if (rc) { 1318 if (rc) {
1309 reason = "device not ready"; 1319 reason = "device not ready";
@@ -1426,7 +1436,7 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
1426 * have to be reset again. For most cases, this should 1436 * have to be reset again. For most cases, this should
1427 * suffice while making probing snappish enough. 1437 * suffice while making probing snappish enough.
1428 */ 1438 */
1429 rc = ata_sff_wait_after_reset(link, 1, jiffies + 2 * HZ); 1439 rc = ata_wait_after_reset(link, jiffies + 2 * HZ, ahci_check_ready);
1430 if (rc) 1440 if (rc)
1431 ahci_kick_engine(ap, 0); 1441 ahci_kick_engine(ap, 0);
1432 1442