All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] SCSI: atp870u: Clean up delays
@ 2010-05-16  2:34 Ben Hutchings
  2010-05-16  2:34 ` [PATCH 2/2] SCSI: atp870u: Remove debug writes to port 0x80 Ben Hutchings
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2010-05-16  2:34 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

Replace udelay(0x800) with mdelay(2).  udelay() is inaccurate for such
large arguments and this may result in a build-time assertion failure;
in particular it fails to build on ARM.  The conversion is not quite
accurate, but neither is the current delay.  (It was originally
implemented by calling inb(0x80) in a loop, which is even less so.)

Replace inb(0x80) with udelay(1).  Use of port 0x80 is x86-specific
and can even hang some newer x86 systems.

Remove the commented-out initial delay in tscam(), which has been
disabled throughout the 2.6.x series.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/scsi/atp870u.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index ab5bdda..80f41ef 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -1047,13 +1047,6 @@ static void tscam(struct Scsi_Host *host)
 		0x38, 0x31, 0x32, 0x2b, 0x34, 0x2d, 0x2e, 0x27
 	};
 
-/*  I can't believe we need this before we've even done anything.  Remove it
- *  and see if anyone bitches.
-	for (i = 0; i < 0x10; i++) {
-		udelay(0xffff);
-	}
- */
-
 	tmport = dev->ioport[0] + 1;
 	outb(0x08, tmport++);
 	outb(0x7f, tmport);
@@ -1138,7 +1131,7 @@ wait_rdyok:
 	outw(val, tmport);
 	val |= 0x0004;		/* msg  */
 	outw(val, tmport);
-	inb(0x80);		/* 2 deskew delay(45ns*2=90ns) */
+	udelay(1);		/* 2 deskew delay(45ns*2=90ns) */
 	val &= 0x007f;		/* no bsy  */
 	outw(val, tmport);
 	mdelay(128);
@@ -1164,15 +1157,15 @@ wait_io:
 	}
 	goto TCM_SYNC;
 wait_io1:
-	inb(0x80);
+	udelay(1);
 	val |= 0x8003;		/* io,cd,db7  */
 	outw(val, tmport);
-	inb(0x80);
+	udelay(1);
 	val &= 0x00bf;		/* no sel     */
 	outw(val, tmport);
 	outb(2, 0x80);
 TCM_SYNC:
-	udelay(0x800);
+	mdelay(2);
 	if ((inb(tmport) & 0x80) == 0x00) {	/* bsy ? */
 		outw(0, tmport--);
 		outb(0, tmport);
-- 
1.7.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] SCSI: atp870u: Remove debug writes to port 0x80
  2010-05-16  2:34 [PATCH 1/2] SCSI: atp870u: Clean up delays Ben Hutchings
@ 2010-05-16  2:34 ` Ben Hutchings
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Hutchings @ 2010-05-16  2:34 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

Use of port 0x80 is x86-specific and can even hang some newer x86 
systems.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/scsi/atp870u.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index 80f41ef..dcefd8b 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -1122,8 +1122,6 @@ wait_rdyok:
 	tmport = dev->ioport[0] + 0x1b;
 	outb(0x02, tmport);
 
-	outb(0, 0x80);
-
 	val = 0x0080;		/* bsy  */
 	tmport = dev->ioport[0] + 0x1c;
 	outw(val, tmport);
@@ -1141,7 +1139,6 @@ wait_nomsg:
 	if ((inb(tmport) & 0x04) != 0) {
 		goto wait_nomsg;
 	}
-	outb(1, 0x80);
 	udelay(100);
 	for (n = 0; n < 0x30000; n++) {
 		if ((inb(tmport) & 0x80) != 0) {	/* bsy ? */
@@ -1163,7 +1160,6 @@ wait_io1:
 	udelay(1);
 	val &= 0x00bf;		/* no sel     */
 	outw(val, tmport);
-	outb(2, 0x80);
 TCM_SYNC:
 	mdelay(2);
 	if ((inb(tmport) & 0x80) == 0x00) {	/* bsy ? */
@@ -1183,18 +1179,15 @@ TCM_SYNC:
 	val &= 0x00ff;		/* synchronization  */
 	val |= 0x3f00;
 	fun_scam(dev, &val);
-	outb(3, 0x80);
 	val &= 0x00ff;		/* isolation        */
 	val |= 0x2000;
 	fun_scam(dev, &val);
-	outb(4, 0x80);
 	i = 8;
 	j = 0;
 TCM_ID:
 	if ((inw(tmport) & 0x2000) == 0) {
 		goto TCM_ID;
 	}
-	outb(5, 0x80);
 	val &= 0x00ff;		/* get ID_STRING */
 	val |= 0x2000;
 	k = fun_scam(dev, &val);
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-16  2:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-16  2:34 [PATCH 1/2] SCSI: atp870u: Clean up delays Ben Hutchings
2010-05-16  2:34 ` [PATCH 2/2] SCSI: atp870u: Remove debug writes to port 0x80 Ben Hutchings

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.