All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert Lee <albertcc@tw.ibm.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Linux IDE <linux-ide@vger.kernel.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>, Tejun Heo <htejun@gmail.com>,
	Mark Lord <mlord@pobox.com>,
	matthieu castet <castet.matthieu@free.fr>,
	Tobias Powalowski <t.powa@gmx.de>
Subject: [PATCH] libata: waits up to 10 microseconds for early irq problem
Date: Tue, 28 Nov 2006 14:52:28 +0800	[thread overview]
Message-ID: <456BDCAC.4060609@tw.ibm.com> (raw)
In-Reply-To: <455F790C.2030509@garzik.org>

Some devices raise irq early before clearing the BSY.
This patch waits up to 10 microseconds to workaround the early irq problem.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
---
In additional to the pata_via SET FEATURES XFER problem reported by Matthieu,
we also see the early irq problem with ICH4 + AOpen CD-936E on READ under PIO mode 4.

The following is a port of the pata_via_fix to the libata core.
Patch against 2.6.19-rc6. For your review, thanks.


--- linux-2.6.19-rc6/include/linux/libata.h	2006-11-28 11:14:52.000000000 +0800
+++ linux-2.6.19-rc6-early_irq/include/linux/libata.h	2006-11-28 13:31:07.565194648 +0800
@@ -1039,6 +1039,30 @@ static inline void ata_pause(struct ata_
 	ndelay(400);
 }
 
+/**
+ *	ata_busy_wait_alt - Wait for a port alt status register
+ *	@ap: Port to wait for.
+ *
+ *	Waits up to max microseconds for the selected bits in the port's
+ *	alt status register to be cleared.
+ *	Returns final value of alt status register.
+ *
+ *	LOCKING:
+ *	Inherited from caller.
+ */
+static inline u8 ata_busy_wait_alt(struct ata_port *ap, unsigned int bits,
+				   unsigned int max)
+{
+	u8 status = ata_altstatus(ap);
+
+	while ((status & bits) && (max > 0)) {
+		udelay(1);
+		status = ata_altstatus(ap);
+		max--;
+	};
+
+	return status;
+}
 
 /**
  *	ata_busy_wait - Wait for a port status register
--- linux-2.6.19-rc6/drivers/ata/libata-core.c	2006-11-28 11:14:38.000000000 +0800
+++ linux-2.6.19-rc6-early_irq/drivers/ata/libata-core.c	2006-11-28 13:31:31.275590120 +0800
@@ -4828,8 +4828,10 @@ inline unsigned int ata_host_intr (struc
 		goto idle_irq;
 	}
 
-	/* check altstatus */
-	status = ata_altstatus(ap);
+	/* check altstatus.
+	 * Waits up to 10 microseconds for early irq.
+	 */
+	status = ata_busy_wait_alt(ap, ATA_BUSY, 10);
 	if (status & ATA_BUSY)
 		goto idle_irq;
 



  parent reply	other threads:[~2006-11-28  6:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200611180759.34622.t.powa@gmx.de>
     [not found] ` <20061118002357.564dbb9d.akpm@osdl.org>
2006-11-18 21:20   ` possibility to merge via_pata fixes to .19 stable series? Jeff Garzik
2006-11-18 22:43     ` Alan
2006-11-19  3:07       ` Andrew Morton
2006-11-19  5:34         ` Tejun Heo
2006-11-19  6:02           ` Andrew Morton
2006-11-28  6:52     ` Albert Lee [this message]
2006-11-28 10:25       ` [PATCH] libata: waits up to 10 microseconds for early irq problem Alan
2006-11-28 10:27         ` Tejun Heo
2006-11-28 10:46           ` Alan
2006-11-28 14:00             ` Mark Lord
2006-11-28 14:12               ` Alan
2006-11-28 14:16                 ` Mark Lord
2006-11-28 11:32           ` Albert Lee
2006-11-28 14:17       ` Albert Lee
2006-11-28 14:42         ` Mark Lord
2006-11-28 19:13           ` Jeff Garzik
2006-11-30  9:43             ` [PATCH] libata: blacklist " Albert Lee
2006-11-30 11:29               ` Alan
2006-11-30 20:37               ` Mark Lord
2006-11-30 20:45               ` Mark Lord

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=456BDCAC.4060609@tw.ibm.com \
    --to=albertcc@tw.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=albertl@mail.com \
    --cc=castet.matthieu@free.fr \
    --cc=htejun@gmail.com \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=mlord@pobox.com \
    --cc=t.powa@gmx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.