aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r--drivers/ata/ahci.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 34c5534ed64c..d9617892fc23 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -874,7 +874,8 @@ static int ahci_clo(struct ata_port *ap)
874 return 0; 874 return 0;
875} 875}
876 876
877static int ahci_softreset(struct ata_port *ap, unsigned int *class) 877static int ahci_softreset(struct ata_port *ap, unsigned int *class,
878 unsigned long deadline)
878{ 879{
879 struct ahci_port_priv *pp = ap->private_data; 880 struct ahci_port_priv *pp = ap->private_data;
880 void __iomem *port_mmio = ahci_port_base(ap); 881 void __iomem *port_mmio = ahci_port_base(ap);
@@ -959,15 +960,13 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class)
959 */ 960 */
960 msleep(150); 961 msleep(150);
961 962
962 *class = ATA_DEV_NONE; 963 rc = ata_wait_ready(ap, deadline);
963 if (ata_port_online(ap)) { 964 /* link occupied, -ENODEV too is an error */
964 if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) { 965 if (rc) {
965 rc = -EIO; 966 reason = "device not ready";
966 reason = "device not ready"; 967 goto fail;
967 goto fail;
968 }
969 *class = ahci_dev_classify(ap);
970 } 968 }
969 *class = ahci_dev_classify(ap);
971 970
972 DPRINTK("EXIT, class=%u\n", *class); 971 DPRINTK("EXIT, class=%u\n", *class);
973 return 0; 972 return 0;
@@ -979,7 +978,8 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class)
979 return rc; 978 return rc;
980} 979}
981 980
982static int ahci_hardreset(struct ata_port *ap, unsigned int *class) 981static int ahci_hardreset(struct ata_port *ap, unsigned int *class,
982 unsigned long deadline)
983{ 983{
984 struct ahci_port_priv *pp = ap->private_data; 984 struct ahci_port_priv *pp = ap->private_data;
985 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; 985 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
@@ -995,7 +995,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class)
995 tf.command = 0x80; 995 tf.command = 0x80;
996 ata_tf_to_fis(&tf, d2h_fis, 0); 996 ata_tf_to_fis(&tf, d2h_fis, 0);
997 997
998 rc = sata_std_hardreset(ap, class); 998 rc = sata_std_hardreset(ap, class, deadline);
999 999
1000 ahci_start_engine(ap); 1000 ahci_start_engine(ap);
1001 1001
@@ -1008,7 +1008,8 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class)
1008 return rc; 1008 return rc;
1009} 1009}
1010 1010
1011static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class) 1011static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class,
1012 unsigned long deadline)
1012{ 1013{
1013 int rc; 1014 int rc;
1014 1015
@@ -1016,7 +1017,8 @@ static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class)
1016 1017
1017 ahci_stop_engine(ap); 1018 ahci_stop_engine(ap);
1018 1019
1019 rc = sata_port_hardreset(ap, sata_ehc_deb_timing(&ap->eh_context)); 1020 rc = sata_port_hardreset(ap, sata_ehc_deb_timing(&ap->eh_context),
1021 deadline);
1020 1022
1021 /* vt8251 needs SError cleared for the port to operate */ 1023 /* vt8251 needs SError cleared for the port to operate */
1022 ahci_scr_write(ap, SCR_ERROR, ahci_scr_read(ap, SCR_ERROR)); 1024 ahci_scr_write(ap, SCR_ERROR, ahci_scr_read(ap, SCR_ERROR));