linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: jgarzik@pobox.com, Carlos.Pardo@siliconimage.com,
	linux-ide@vger.kernel.org
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 8/8] sata_sil24: reimplement hardreset
Date: Wed, 5 Apr 2006 22:29:02 +0900	[thread overview]
Message-ID: <11442437423316-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <11442437413563-git-send-email-htejun@gmail.com>

Reimplement hardreset according to the datasheet.  The old hardreset
didn't reset controller status and the controller might not be ready
after reset.  Also, as SStatus is a bit slow to reflect PHY status
after reset, sata_std_hardrset() doesn't wait long enough before
proceeding.

Note that as we're not depending on SStatus, we can't depend on DET==1
condition to wait for link, so use shorter timeout for no device case.

Signed-off-by: Tejun Heo <htejun@gmail.com>

---

 drivers/scsi/sata_sil24.c |   38 +++++++++++++++++++++++++++++++++++---
 1 files changed, 35 insertions(+), 3 deletions(-)

6d59c820f497b5af4db2532dcafab195759b7d28
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index 3d8047e..b468cca 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -518,10 +518,42 @@ static int sil24_softreset(struct ata_po
 
 static int sil24_hardreset(struct ata_port *ap, unsigned int *class)
 {
-	unsigned int dummy_class;
+	void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr;
+	const char *reason;
+	int tout_msec, rc;
+
+	/* sil24 does the right thing (tm) without any protection */
+	ata_set_sata_spd(ap);
+
+	tout_msec = 100;
+	if (sata_dev_present(ap))
+		tout_msec = 5000;
+
+	writel(PORT_CS_DEV_RST, port + PORT_CTRL_STAT);
+	rc = sil24_poll_register(port + PORT_CTRL_STAT,
+				 PORT_CS_DEV_RST, 0, 10, tout_msec);
+
+	if (rc) {
+		if (!sata_dev_present(ap))
+			return 0;
+		reason = "link not ready";
+		goto err;
+	}
+
+	if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) {
+		reason = "device not ready";
+		goto err;
+	}
+
+	/* SStatus is a bit sluggish (reports 0) on sil24, wait for it */
+	sil24_poll_register(port + PORT_SSTATUS, 0xf, 0x0, 10, 100);
+
+	/* no classification, just return */
+	return 0;
 
-	/* sil24 doesn't report device signature after hard reset */
-	return sata_std_hardreset(ap, &dummy_class);
+ err:
+	printk(KERN_ERR "ata%u: hardreset failed (%s)\n", ap->id, reason);
+	return -EIO;
 }
 
 static int sil24_probe_reset(struct ata_port *ap, unsigned int *classes)
-- 
1.2.4



  parent reply	other threads:[~2006-04-05 13:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-05 13:29 [PATCHSET] sata_sil24: fixes, errata workaround and reset updates Tejun Heo
2006-04-05 13:29 ` [PATCH 1/8] libata: export ata_set_sata_spd() Tejun Heo
2006-04-05 13:29 ` [PATCH 4/8] libata: separate out sil24_poll_register() Tejun Heo
2006-04-06 16:42   ` Jeff Garzik
2006-04-06 16:48     ` Tejun Heo
2006-04-06 16:56       ` Jeff Garzik
2006-04-05 13:29 ` [PATCH 3/8] sata_sil24: implement loss of completion interrupt on PCI-X errta fix Tejun Heo
2006-04-06 16:48   ` Jeff Garzik
2006-04-05 13:29 ` [PATCH 5/8] sata_sil24: enable 64bit Tejun Heo
2006-04-06 16:46   ` Jeff Garzik
2006-04-06 16:55     ` Tejun Heo
2006-04-05 13:29 ` [PATCH 6/8] sata_sil24: put port into known state before softresetting Tejun Heo
2006-04-05 13:29 ` Tejun Heo [this message]
2006-04-06 16:44   ` [PATCH 8/8] sata_sil24: reimplement hardreset Jeff Garzik
2006-04-06 16:53     ` Tejun Heo
2006-04-06 16:54       ` Jeff Garzik
2006-04-05 13:29 ` [PATCH 2/8] sata_sil24: fix on-memory structure byteorder Tejun Heo
2006-04-06 16:46   ` Jeff Garzik
2006-04-06 16:56     ` Tejun Heo
2006-04-05 13:29 ` [PATCH 7/8] sata_sil24: kill 10ms sleep in softreset Tejun Heo
2006-04-06  8:20 ` [PATCHSET] sata_sil24: fixes, errata workaround and reset updates Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11442437423316-git-send-email-htejun@gmail.com \
    --to=htejun@gmail.com \
    --cc=Carlos.Pardo@siliconimage.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).