All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Rubinstein <felixru-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: Linux I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: Intel ICHx bus driver
Date: Tue, 2 Mar 2010 14:53:41 +0200	[thread overview]
Message-ID: <af0693f01003020453m7ca6891bjca4833c7fa45f44d@mail.gmail.com> (raw)
In-Reply-To: <20100228211949.3297a0ff-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>

Hi Jean,

On Sun, Feb 28, 2010 at 10:19 PM, Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org> wrote:
>
> On Sun, 28 Feb 2010 15:45:38 +0200, Felix Rubinstein wrote:
> > On Sun, Feb 28, 2010 at 1:08 PM, Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org> wrote:
> > > On Wed, 24 Feb 2010 01:21:51 +0200, Felix Rubinstein wrote:
> > > > But hey, I think I've found an issue here.
> > > > Let's delve into the i801 driver code for a moment please.
> > > >
> > > > in i801_transaction:
> > > > ...
> > > > /* We will always wait for a fraction of a second! */
> > > >          do {
> > > >                  msleep(1);
> > > >                  status = inb_p(SMBHSTSTS);
> > > >          } while ((status & SMBHSTSTS_HOST_BUSY) && (timeout++ < MAX_TIMEOUT));
> > > > ...
> > > >
> > > > The data sheet states for HST_STS reg for HOST_BUSY bit:
> > > > 1 = Indicates that the ICH9 is running a command from the host interface. No SMB
> > > > registers should be accessed while this bit is set, except the BLOCK DATA BYTE
> > > > Register. The BLOCK DATA BYTE Register can be accessed when this bit is set only
> > > > when the SMB_CMD bits in the Host Control Register are programmed for Block
> > > > command or I2C Read command. This is necessary in order to check the
> > > > DONE_STS bit.
> > > >
> > > > Remember my case? I'm issuing plain I2C multi byte (straight I2C with
> > > > arbitrary length) transaction, in ICH9 words SMB_CMD is set to Block
> > > > command. Since E32B is enabled, DONE_STS is irrelevant for us in this
> > > > case.
> > >
> > > This is correct, assuming you mean I2C block writes and not reads. I2C
> > > block reads are always done in byte-by-byte mode (E32B not set).
> > What I mean was that HOST_BUSY bit is relevant during the transaction
> > in case E32B is _not_ set (since DONE_STS is irrelevant once E32B is
> > set).
> > >
> > > > As I understand, in this case we should relay on interrupts and
> > > > not on polling, as both: E32B and Block (write) command are enabled.
> > > >
> > > > That is why in my case I'm seeing timeout > MAX_TIMEOUT.
> > >
> > > I fail to see any relation between using interrupts and transaction
> > > types. The i2c-i801 driver does not use interrupts at all at the
> > > moment, it is always polling.
> > Meaning we cannot relay on HOST_BUSY bit when we _both_ issue Block
> > transaction and E32B is set. Since we cannot relay on it, the only
> > option left is interrupts.
>
> Please point me to the part of the datasheet which says this.

Well, this part is quite vague and it's my interpretation however data
sheet states that during polling for HOST_BUSY bit, other registers
could be accesses iff we're executing Block transaction (my case) ...
and I quote: "This is necessary in order to check the DONE_STS bit."
But on the other hand DONE_STS bit, once again quoting : "... has no
meaning for block transfers when the 32-byte buffer is enabled."
In my case I fail to issue I2C write Block transaction iff E32B is
enabled and succeed if it's disabled.

One more thing which popped up recently.
If I work with E32B disabled, I paid attention that msleep(1) in
i801_block_transaction_byte_by_byte makes the write transaction too
long in the scope, i.e. bytes frequency is too long and they are too
far apart which makes them harder to be read. I think they should be
closer together, like this one.

                /* We will always wait for a fraction of a second! */
                timeout = 0;
                do {
-                       msleep(1);
+                      udelay(100);
                        status = inb_p(SMBHSTSTS);
                }
                while ((!(status & SMBHSTSTS_BYTE_DONE))
                          && (timeout++ < MAX_TIMEOUT));

or something like this.Even if it will timeout for a few times,
MAX_TIMEOUT will take care of the rest. In my case it hasn't even
once. All this, of course, not just for scope :)

Thanks,
Felix R.

>
> > What I'm trying to say is that we cannot relay (and in my case I get
> > transaction timeout if E32B is set) on HOST_BUSY bit when E32B is
> > enabled.
>
> And I think you are wrong. The HOST_BUSY bit is perfectly valid for
> block transactions under E32B. It wears off at the end of the block
> transaction, as it does for every other transaction. I can't think of
> any reason why we couldn't use it.
>
> > BTW, I've posted my code in the previous email posted on the list.
>
> I've seen this and will comment on it as my time permits.
>
> --
> Jean Delvare
> http://khali.linux-fr.org/wishlist.html

  parent reply	other threads:[~2010-03-02 12:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27 17:56 Intel ICHx bus driver Felix Rubinstein
     [not found] ` <af0693f01001270956h781f2832r928364574d3406aa-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-28  7:59   ` Jean Delvare
     [not found]     ` <20100128085904.4e202de1-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-01-28  9:32       ` Felix Rubinstein
     [not found]         ` <af0693f01001280132l4002af0fgf3137fa27ce8555e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-28  9:53           ` Jean Delvare
     [not found]             ` <20100128105340.41aecf64-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-01-28 12:46               ` Felix Rubinstein
     [not found]                 ` <af0693f01001280446u66923c70ld707d10b9fcee068-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-28 13:29                   ` Jean Delvare
     [not found]             ` <af0693f01002182310i6678e4b5h80feb14b24b37742@mail.gmail.com>
     [not found]               ` <af0693f01002182310i6678e4b5h80feb14b24b37742-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-19  9:58                 ` Jean Delvare
     [not found]                   ` <20100219105841.2bd8b16c-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-02-22 16:12                     ` Felix Rubinstein
     [not found]                       ` <af0693f01002220812n5a6060cejc00d1ebbd7b9424d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-22 21:58                         ` Jean Delvare
     [not found]                           ` <af0693f01002231521q4f99eb63ocd607670625fadfa@mail.gmail.com>
     [not found]                             ` <af0693f01002231521q4f99eb63ocd607670625fadfa-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-24 12:01                               ` Felix Rubinstein
     [not found]                                 ` <af0693f01002240401g1aeaf840ld06a156a06be9dbf-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-02 21:22                                   ` Jean Delvare
     [not found]                                     ` <20100302222203.1eb67c3a-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-03-03 16:36                                       ` Felix Rubinstein
2010-03-03 16:59                                       ` Jean Delvare
2010-02-28 11:08                               ` Jean Delvare
     [not found]                                 ` <20100228120817.275ef279-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-02-28 13:45                                   ` Felix Rubinstein
     [not found]                                     ` <af0693f01002280545n622b1c41v1f8c104e57fb51b6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-28 20:19                                       ` Jean Delvare
     [not found]                                         ` <20100228211949.3297a0ff-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-03-02 12:53                                           ` Felix Rubinstein [this message]
     [not found]                                             ` <af0693f01003020453m7ca6891bjca4833c7fa45f44d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-12 13:19                                               ` Jean Delvare
     [not found]                                                 ` <20100312141901.04299a55-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-03-12 16:24                                                   ` Jean Delvare
     [not found]                                                     ` <20100312172421.5b4907e6-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-03-15  9:43                                                       ` Felix Rubinstein
     [not found]                                                         ` <af0693f01003150243u4d4d76e7t71b37ecd452896ea-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-15 10:06                                                           ` Jean Delvare
     [not found]                                                             ` <20100315110645.1df3e4f0-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-03-15 11:12                                                               ` Felix Rubinstein
     [not found]                                                                 ` <af0693f01003150412p5823d8e0j678b035b1c7cc4bb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-15 11:46                                                                   ` Jean Delvare
     [not found]                                                                     ` <20100315124648.6dafae21-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-03-15 13:12                                                                       ` Felix Rubinstein

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=af0693f01003020453m7ca6891bjca4833c7fa45f44d@mail.gmail.com \
    --to=felixru-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 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.