Re: i8042 access timings

From: Bill Rugolsky Jr.
Date: Sat Feb 12 2005 - 19:18:38 EST


On Thu, Jan 27, 2005 at 05:37:14PM +0100, Vojtech Pavlik wrote:
> On Thu, Jan 27, 2005 at 11:34:31AM -0500, Bill Rugolsky Jr. wrote:
> > I have a Digital HiNote collecting dust which had this keyboard problem
> > with the RH 6.x 2.2.x boot disk kernels, IIRC. I can test if you like,
> > but I won't be able to get to it until the weekend.
>
> That'd be very nice indeed.

Sorry for the long delay in replying; the HiNote needed some effort to get
the thing up and running again. [Various bits of hardware are broken;
the power switch, floppy, and CD-ROM are busted/flakey.] I've now got
Fedora Core 3 running on it. I was pleasantly surprised that the 2.6.9
i83265 PCMCIA module loads, and the internal Xircom CEM56 network/modem works.
[Broken with 2.6.10+ though; the fix is probably trivial.]

I wasn't sure exactly what to test. I applied the following patch
to 2.6.11-rc3-bk9, and booted with i8042_debug=1. So far, it works
as expected, and there is nothing of interest in the kernel log.
[Also worked with the FC3 2.6.9 kernel and this patch+DEBUG.]

Now that things are up and running, I will apply any patches that you
would like tested.

Bill Rugolsky

--- linux/drivers/input/serio/i8042.c.udelay-backout 2005-02-12 16:22:48.647851998 -0500
+++ linux/drivers/input/serio/i8042.c 2005-02-12 16:23:39.963997609 -0500
@@ -131,9 +131,10 @@
{
int i = 0;
while ((~i8042_read_status() & I8042_STR_OBF) && (i < I8042_CTL_TIMEOUT)) {
- udelay(50);
+ udelay(I8042_STR_DELAY);
i++;
}
+ if (i > 0) dbg("i8042_wait_read: looped %d times",i);
return -(i == I8042_CTL_TIMEOUT);
}

@@ -141,9 +142,10 @@
{
int i = 0;
while ((i8042_read_status() & I8042_STR_IBF) && (i < I8042_CTL_TIMEOUT)) {
- udelay(50);
+ udelay(I8042_STR_DELAY);
i++;
}
+ if (i > 0) dbg("i8042_wait_write: looped %d times",i);
return -(i == I8042_CTL_TIMEOUT);
}

@@ -161,7 +163,6 @@
spin_lock_irqsave(&i8042_lock, flags);

while ((i8042_read_status() & I8042_STR_OBF) && (i++ < I8042_BUFFER_SIZE)) {
- udelay(50);
data = i8042_read_data();
dbg("%02x <- i8042 (flush, %s)", data,
i8042_read_status() & I8042_STR_AUXDATA ? "aux" : "kbd");
--- linux/drivers/input/serio/i8042.h.udelay-backout 2005-02-12 16:22:48.647851998 -0500
+++ linux/drivers/input/serio/i8042.h 2005-02-12 16:23:39.964997456 -0500
@@ -30,12 +30,18 @@
#endif

/*
- * This is in 50us units, the time we wait for the i8042 to react. This
+ * The time (in us) that we wait for the i8042 to react.
+ */
+
+#define I8042_STR_DELAY 20
+
+/*
+ * This is in units of the time we wait for the i8042 to react. This
* has to be long enough for the i8042 itself to timeout on sending a byte
* to a non-existent mouse.
*/

-#define I8042_CTL_TIMEOUT 10000
+#define I8042_CTL_TIMEOUT 25000

/*
* When the device isn't opened and it's interrupts aren't used, we poll it at
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/