aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/ahci.c4
-rw-r--r--drivers/ata/libata-sff.c6
-rw-r--r--include/linux/libata.h15
3 files changed, 17 insertions, 8 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 8cace9aa9c03..97f83fb2ee2e 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1267,9 +1267,7 @@ static int ahci_check_ready(struct ata_link *link)
1267 void __iomem *port_mmio = ahci_port_base(link->ap); 1267 void __iomem *port_mmio = ahci_port_base(link->ap);
1268 u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF; 1268 u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
1269 1269
1270 if (!(status & ATA_BUSY)) 1270 return ata_check_ready(status);
1271 return 1;
1272 return 0;
1273} 1271}
1274 1272
1275static int ahci_softreset(struct ata_link *link, unsigned int *class, 1273static int ahci_softreset(struct ata_link *link, unsigned int *class,
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 2ec65a8fda79..3c2d2289f85e 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -314,11 +314,7 @@ static int ata_sff_check_ready(struct ata_link *link)
314{ 314{
315 u8 status = link->ap->ops->sff_check_status(link->ap); 315 u8 status = link->ap->ops->sff_check_status(link->ap);
316 316
317 if (!(status & ATA_BUSY)) 317 return ata_check_ready(status);
318 return 1;
319 if (status == 0xff)
320 return -ENODEV;
321 return 0;
322} 318}
323 319
324/** 320/**
diff --git a/include/linux/libata.h b/include/linux/libata.h
index d1dfe872ee30..95e6159b44cf 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1381,6 +1381,21 @@ static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
1381 return *(struct ata_port **)&host->hostdata[0]; 1381 return *(struct ata_port **)&host->hostdata[0];
1382} 1382}
1383 1383
1384static inline int ata_check_ready(u8 status)
1385{
1386 /* Some controllers report 0x77 or 0x7f during intermediate
1387 * not-ready stages.
1388 */
1389 if (status == 0x77 || status == 0x7f)
1390 return 0;
1391
1392 /* 0xff indicates either no device or device not ready */
1393 if (status == 0xff)
1394 return -ENODEV;
1395
1396 return !(status & ATA_BUSY);
1397}
1398
1384 1399
1385/************************************************************************** 1400/**************************************************************************
1386 * PMP - drivers/ata/libata-pmp.c 1401 * PMP - drivers/ata/libata-pmp.c