aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-sff.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/libata-sff.c')
-rw-r--r--drivers/ata/libata-sff.c49
1 files changed, 9 insertions, 40 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 78912c5011ad..0b97e84d3af6 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1921,50 +1921,19 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
1921int sata_sff_hardreset(struct ata_link *link, unsigned int *class, 1921int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
1922 unsigned long deadline) 1922 unsigned long deadline)
1923{ 1923{
1924 struct ata_port *ap = link->ap; 1924 struct ata_eh_context *ehc = &link->eh_context;
1925 const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context); 1925 const unsigned long *timing = sata_ehc_deb_timing(ehc);
1926 bool online;
1926 int rc; 1927 int rc;
1927 1928
1928 DPRINTK("ENTER\n"); 1929 rc = sata_link_hardreset(link, timing, deadline, &online,
1929 1930 ata_sff_check_ready);
1930 /* do hardreset */ 1931 *class = ATA_DEV_NONE;
1931 rc = sata_link_hardreset(link, timing, deadline); 1932 if (online)
1932 if (rc) { 1933 *class = ata_sff_dev_classify(link->device, 1, NULL);
1933 ata_link_printk(link, KERN_ERR,
1934 "COMRESET failed (errno=%d)\n", rc);
1935 return rc;
1936 }
1937
1938 /* TODO: phy layer with polling, timeouts, etc. */
1939 if (ata_link_offline(link)) {
1940 *class = ATA_DEV_NONE;
1941 DPRINTK("EXIT, link offline\n");
1942 return 0;
1943 }
1944
1945 /* If PMP is supported, we have to do follow-up SRST. Note
1946 * that some PMPs don't send D2H Reg FIS after hardreset at
1947 * all if the first port is empty. Wait for it just for a
1948 * second and request follow-up SRST.
1949 */
1950 if (ap->flags & ATA_FLAG_PMP) {
1951 ata_sff_wait_after_reset(link, 1, jiffies + HZ);
1952 return -EAGAIN;
1953 }
1954
1955 /* wait for the link to become online */
1956 rc = ata_sff_wait_after_reset(link, 1, deadline);
1957 /* link occupied, -ENODEV too is an error */
1958 if (rc) {
1959 ata_link_printk(link, KERN_ERR,
1960 "COMRESET failed (errno=%d)\n", rc);
1961 return rc;
1962 }
1963
1964 *class = ata_sff_dev_classify(link->device, 1, NULL);
1965 1934
1966 DPRINTK("EXIT, class=%u\n", *class); 1935 DPRINTK("EXIT, class=%u\n", *class);
1967 return 0; 1936 return rc;
1968} 1937}
1969 1938
1970/** 1939/**