From: Linus Torvalds <torvalds@osdl.org>
To: Jaco Kroon <jaco@kroon.co.za>
Cc: sebekpi@poczta.onet.pl, Vojtech Pavlik <vojtech@suse.cz>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Subject: Re: i8042 access timings
Date: Thu, 27 Jan 2005 10:09:24 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.58.0501270948280.2362@ppc970.osdl.org> (raw)
In-Reply-To: <41F888CB.8090601@kroon.co.za>
On Thu, 27 Jan 2005, Jaco Kroon wrote:
>
> Which indicates (as far as my understanding goes) that the command times
> out, as such the param value stays the same (ready for re-use in the
> second command). The second commands succeeds but does not return one
> of the expected (0x00, 0xff, 0xfa) values, instead it returns the value
> as expected by the first command (0xa5). The last value on both lines
> is the return value. From the second snippet:
No, I think the 0x5a you see is the 0x5a that is _still_ there, because we
never got any reply at all from the i8042_command(I8042_CMD_AUX_LOOP)
case, nor did the I8042_CMD_AUX_TEST thing do anything at all.
I have a suspicion: these commands are also one of the few ones that write
a data byte to the data port immediately after writing the command byte to
the status port.
It so happens that if the hardware is slow to reach to the command byte,
we might read the status word _before_ the hardware has had time to even
say "ok, my input port is now full". We have a "udelay()" there in
i8042_wait_write(), but we have it _after_ we've done the
i8042_read_status(), so effectively the i8042_read_status() happens
immediately after the i8042_write_command().
So what _might_ happen is that we write the command, and then
i8042_wait_write() thinks that there is space to write the data
immediately, and writes the data, but now the data got lost because the
buffer was busy.
The IO delay should be _before_ the read of the status, not after it.
So how about adding an extra "udelay(50)" to either the top of
i8042_wait_write(), or to the bottom of "i8042_write_command()"? Does that
make any difference?
(50 usec is probably overkill, and an alternative is to just make the
write_data/write_command inline functions in i8042-io.h use the
"inb_p/outb_p" versions that put a serializing IO instruction in between,
which should give you a nice 1us delay even on modern hardware.)
Linus
next prev parent reply other threads:[~2005-01-27 18:11 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200501260040.46288.sebekpi@poczta.onet.pl>
2005-01-27 6:23 ` Jaco Kroon
2005-01-27 10:25 ` Vojtech Pavlik
2005-01-27 11:12 ` Sebastian Piechocki
2005-01-27 11:31 ` Vojtech Pavlik
2005-01-27 17:33 ` Jaco Kroon
2005-01-27 18:09 ` Linus Torvalds [this message]
2005-01-27 20:29 ` Andries Brouwer
2005-01-27 20:41 ` Dmitry Torokhov
2005-01-27 23:11 ` Andries Brouwer
2005-01-28 13:17 ` Vojtech Pavlik
2005-01-28 14:20 ` Jaco Kroon
2005-01-28 18:39 ` Vojtech Pavlik
2005-01-29 19:59 ` Jaco Kroon
2005-01-29 23:21 ` Dmitry Torokhov
2005-01-29 20:02 ` Randy.Dunlap
2005-01-27 20:51 ` Jaco Kroon
2005-01-27 21:17 ` Linus Torvalds
2005-01-27 22:12 ` Jaco Kroon
2005-01-27 22:36 ` Linus Torvalds
2005-01-27 23:40 ` Dmitry Torokhov
2005-01-28 5:52 ` Jaco Kroon
2005-02-04 19:54 ` Bukie Mabayoje
2005-01-28 11:04 ` Vojtech Pavlik
2005-01-27 20:23 ` Andries Brouwer
2005-01-25 7:41 Dmitry Torokhov
2005-01-25 10:51 ` Andries Brouwer
2005-01-25 19:17 ` Dmitry Torokhov
2005-01-25 19:25 ` Vojtech Pavlik
2005-01-25 19:41 ` Dmitry Torokhov
2005-01-25 19:46 ` Andries Brouwer
2005-01-25 20:37 ` Lee Revell
2005-01-27 15:14 ` Alan Cox
2005-01-27 16:24 ` Vojtech Pavlik
2005-01-27 16:34 ` Bill Rugolsky Jr.
2005-01-27 16:37 ` Vojtech Pavlik
2005-02-13 0:16 ` Bill Rugolsky Jr.
2005-02-13 8:22 ` Vojtech Pavlik
2005-02-13 16:17 ` Bill Rugolsky Jr.
2005-01-27 17:45 ` Andries Brouwer
2005-01-28 14:55 ` Vojtech Pavlik
2005-01-25 12:44 ` Alan Cox
2005-01-25 12:44 ` Alan Cox
2005-01-26 15:43 ` Vojtech Pavlik
2005-01-26 16:36 ` Dmitry Torokhov
2005-01-26 17:05 ` linux-os
2005-01-26 18:30 ` Dmitry Torokhov
2005-01-27 10:19 ` Vojtech Pavlik
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=Pine.LNX.4.58.0501270948280.2362@ppc970.osdl.org \
--to=torvalds@osdl.org \
--cc=akpm@osdl.org \
--cc=jaco@kroon.co.za \
--cc=linux-kernel@vger.kernel.org \
--cc=sebekpi@poczta.onet.pl \
--cc=vojtech@suse.cz \
/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
all inboxes | Powered by JetHome®