From: Tejun Heo <htejun@gmail.com>
To: jgarzik@pobox.com, linux-ide@vger.kernel.org
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 4/5] ahci: use ata_wait_register()
Date: Fri, 7 Apr 2006 17:02:47 +0900 [thread overview]
Message-ID: <11443969671111-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <11443969673485-git-send-email-htejun@gmail.com>
Replace ahci_poll_register() with ata_wait_register().
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
drivers/scsi/ahci.c | 31 ++++++-------------------------
1 files changed, 6 insertions(+), 25 deletions(-)
67e414ded95efe60ef70993a1b6502c3d56a30f6
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 8f06375..241ed5d 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -517,24 +517,6 @@ static void ahci_fill_cmd_slot(struct ah
pp->cmd_slot[0].tbl_addr_hi = cpu_to_le32((pp->cmd_tbl_dma >> 16) >> 16);
}
-static int ahci_poll_register(void __iomem *reg, u32 mask, u32 val,
- unsigned long interval_msec,
- unsigned long timeout_msec)
-{
- unsigned long timeout;
- u32 tmp;
-
- timeout = jiffies + (timeout_msec * HZ) / 1000;
- do {
- tmp = readl(reg);
- if ((tmp & mask) == val)
- return 0;
- msleep(interval_msec);
- } while (time_before(jiffies, timeout));
-
- return -1;
-}
-
static int ahci_softreset(struct ata_port *ap, unsigned int *class)
{
struct ahci_host_priv *hpriv = ap->host_set->private_data;
@@ -544,6 +526,7 @@ static int ahci_softreset(struct ata_por
const u32 cmd_fis_len = 5; /* five dwords */
const char *reason = NULL;
struct ata_taskfile tf;
+ u32 tmp;
u8 *fis;
int rc;
@@ -565,8 +548,6 @@ static int ahci_softreset(struct ata_por
/* check BUSY/DRQ, perform Command List Override if necessary */
ahci_tf_read(ap, &tf);
if (tf.command & (ATA_BUSY | ATA_DRQ)) {
- u32 tmp;
-
if (!(hpriv->cap & HOST_CAP_CLO)) {
rc = -EIO;
reason = "port busy but no CLO";
@@ -576,10 +557,10 @@ static int ahci_softreset(struct ata_por
tmp = readl(port_mmio + PORT_CMD);
tmp |= PORT_CMD_CLO;
writel(tmp, port_mmio + PORT_CMD);
- readl(port_mmio + PORT_CMD); /* flush */
- if (ahci_poll_register(port_mmio + PORT_CMD, PORT_CMD_CLO, 0x0,
- 1, 500)) {
+ tmp = ata_wait_register(port_mmio + PORT_CMD,
+ PORT_CMD_CLO, PORT_CMD_CLO, 1, 500);
+ if (tmp & PORT_CMD_CLO) {
rc = -EIO;
reason = "CLO failed";
goto fail_restart;
@@ -600,9 +581,9 @@ static int ahci_softreset(struct ata_por
fis[1] &= ~(1 << 7); /* turn off Command FIS bit */
writel(1, port_mmio + PORT_CMD_ISSUE);
- readl(port_mmio + PORT_CMD_ISSUE); /* flush */
- if (ahci_poll_register(port_mmio + PORT_CMD_ISSUE, 0x1, 0x0, 1, 500)) {
+ tmp = ata_wait_register(port_mmio + PORT_CMD_ISSUE, 0x1, 0x1, 1, 500);
+ if (tmp & 0x1) {
rc = -EIO;
reason = "1st FIS failed";
goto fail;
--
1.2.4
next prev parent reply other threads:[~2006-04-07 8:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-07 8:02 [PATCHSET] libata: implement and use ata_wait_register() Tejun Heo
2006-04-07 8:02 ` [PATCH 1/5] sata_sil24: fix timeout calculation in sil24_softreset Tejun Heo
2006-04-07 8:02 ` Tejun Heo [this message]
2006-04-07 8:02 ` [PATCH 2/5] sata_sil24: better error message from softreset Tejun Heo
2006-04-07 8:02 ` [PATCH 5/5] sata_sil24: use ata_wait_register() Tejun Heo
2006-04-07 8:02 ` [PATCH 3/5] libata: implement ata_wait_register() Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2006-04-11 13:22 [PATCHSET 2/9] implement and use ata_wait_register (repost) Tejun Heo
2006-04-11 13:22 ` [PATCH 4/5] ahci: use ata_wait_register() 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=11443969671111-git-send-email-htejun@gmail.com \
--to=htejun@gmail.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).