linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Christian Ruppert
	<christian.ruppert-ux6zf3SgZrrQT0dZR+AlfA@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/2] i2c-designware: make *CNT values configurable
Date: Tue, 9 Jul 2013 11:44:02 +0300	[thread overview]
Message-ID: <20130709084402.GF4898@intel.com> (raw)
In-Reply-To: <20130708134216.GB6402-7oYq3qWSd+k@public.gmane.org>

On Mon, Jul 08, 2013 at 03:42:17PM +0200, Christian Ruppert wrote:
> On Mon, Jul 08, 2013 at 02:45:26PM +0300, Mika Westerberg wrote:
> > The DesignWare I2C controller has high count (HCNT) and low count (LCNT)
> > registers for each of the I2C speed modes (standard and fast). These
> > registers are programmed based on the input clock speed in the driver.
> > 
> > However, that is not always the most accurate way. For example on Intel
> > BayTrail we have 100MHz input clock and calculated *CNT values result as
> > measured by one of our team:
> > 
> >  Standard mode: 100.25kHz
> >  Fast mode    : 315.41kHZ
> > 
> > The fast mode speed is over 20% lower than what is expected.
> 
> We have observed similar issues and I am wondering if this effect is due
> to the overly-pessimistic formulas in i2c_dw_scl_lcnt and
> i2c_dw_scl_hcnt. The comments in these functions are a bit confusing and
> I don't pretend having fully understood what the intention is. I'm
> having the impression that defining the arguments tf in function of the
> hardware would be the "correct" way to achieve better clock accuracy.

Well, that's not the only timing parameter specified in the I2C spec. We
also have tr among other things (even though the dw driver doesn't use it).

> > It might be
> > that there are things like strenght of the pull-up resistors, bus
> > capacitance etc. that are very platform specific and have an effect on the
> > clock signal.
> 
> I believe tf is supposed to model these things. I just haven't clearly
> understood how. In my understanding, transition times should be
> subtracted rather than added to cycle times or am I getting something
> fundamentally wrong here?

I'm not sure, honestly :-) I believe tf is the same tf that is in the I2C
spec, meaning fall time of both SCL and SDA signals and the spec measures
one clock cycle to be from end of the first tf to the end of the second
(fig. 27 in the I2C spec). If I'm reading it right then it means adding
instead of substracting.

Do you have any suggestions how we could use tf here? At least on Intel
hardware we have an ACPI method that returns directly the optimum *CNT
values.

  parent reply	other threads:[~2013-07-09  8:44 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-08 11:45 [PATCH 1/2] i2c-designware: make *CNT values configurable Mika Westerberg
     [not found] ` <1373283927-21677-1-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2013-07-08 11:45   ` [PATCH 2/2] i2c-designware: configure *CNT values from ACPI Mika Westerberg
     [not found]     ` <1373283927-21677-2-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2013-07-10 13:01       ` Mika Westerberg
2013-07-08 13:42   ` [PATCH 1/2] i2c-designware: make *CNT values configurable Christian Ruppert
     [not found]     ` <20130708134216.GB6402-7oYq3qWSd+k@public.gmane.org>
2013-07-09  8:44       ` Mika Westerberg [this message]
     [not found]         ` <20130709084402.GF4898-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-07-09 16:19           ` Christian Ruppert
     [not found]             ` <20130709161927.GC30236-7oYq3qWSd+k@public.gmane.org>
2013-07-10 10:52               ` Mika Westerberg
     [not found]                 ` <20130710105215.GY4898-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-07-10 16:56                   ` Christian Ruppert
     [not found]                     ` <20130710165634.GA30693-7oYq3qWSd+k@public.gmane.org>
2013-07-11  7:36                       ` Mika Westerberg
2013-07-11 10:13                         ` Mika Westerberg
     [not found]                           ` <20130711101330.GP4898-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-07-12  7:56                             ` Shinya Kuribayashi
     [not found]                               ` <51DFB6C1.4040001-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2013-07-12  8:51                                 ` Mika Westerberg
     [not found]                                   ` <20130712085140.GY4898-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-07-13  5:36                                     ` Shinya Kuribayashi
     [not found]                                       ` <51E0E76B.1040304-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2013-07-16 11:16                                         ` Christian Ruppert
     [not found]                                           ` <20130716111616.GA25835-7oYq3qWSd+k@public.gmane.org>
2013-07-17 14:39                                             ` Shinya Kuribayashi
     [not found]                                               ` <51E6ACBE.7000509-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2013-07-22 13:17                                                 ` Christian Ruppert
     [not found]                                                   ` <20130722131706.GA24081-7oYq3qWSd+k@public.gmane.org>
2013-07-24 14:31                                                     ` Shinya Kuribayashi
     [not found]                                                       ` <51EFE550.1000507-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2013-08-05  9:31                                                         ` Christian Ruppert
     [not found]                                                           ` <20130805093126.GE20936-7oYq3qWSd+k@public.gmane.org>
2013-08-05 10:02                                                             ` Wolfram Sang
2013-08-12  7:48                                                               ` Christian Ruppert
     [not found]                                                                 ` <20130812074800.GA23792-7oYq3qWSd+k@public.gmane.org>
2013-08-12 11:09                                                                   ` Wolfram Sang
2013-08-16  2:15                                                             ` Shinya Kuribayashi
2013-08-19 11:36                                                               ` Mika Westerberg
     [not found]                                                                 ` <20130819113604.GN4898-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-08-19 12:22                                                                   ` Shinya Kuribayashi
2013-08-21 14:39                                                               ` Christian Ruppert
     [not found]                                                                 ` <20130821143915.GA3046-7oYq3qWSd+k@public.gmane.org>
2013-08-24  4:58                                                                   ` Shinya Kuribayashi
     [not found]                                                                     ` <52183D87.40703-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2013-08-28 15:34                                                                       ` Christian Ruppert
2013-10-08 15:00                                                                         ` [PATCH 1/2] i2c designware make SCL and SDA falling time configurable Romain Baeriswyl
2013-10-09  7:55                                                                           ` Mika Westerberg
2013-10-10  0:54                                                                             ` Ryan Mallon
     [not found]                                                                               ` <5255FAB5.7080803-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-10-13 11:36                                                                                 ` Shinya Kuribayashi
     [not found]                                                                                   ` <525A85D6.3090608-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2014-01-16 19:43                                                                                     ` Wolfram Sang
2014-01-20 16:43                                                                                       ` [PATCH v2 " Romain Baeriswyl
     [not found]                                                                                         ` <1390236223-22584-1-git-send-email-romainba-ux6zf3SgZrrQT0dZR+AlfA@public.gmane.org>
2014-03-09  8:20                                                                                           ` Wolfram Sang
     [not found]                                                                         ` <20130828153429.GB7066-7oYq3qWSd+k@public.gmane.org>
2013-10-08 15:00                                                                           ` [PATCH 2/2] i2c designware add support of I2C standard mode Romain Baeriswyl
2013-10-09  7:56                                                                             ` Mika Westerberg
     [not found]                                                                               ` <20131009075632.GR3521-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-10-13 11:46                                                                                 ` Shinya Kuribayashi
2014-01-16 19:33                                                                             ` Wolfram Sang
2014-01-20 16:45                                                                               ` [PATCH v2 " Romain Baeriswyl
     [not found]                                                                                 ` <1390236338-21407-1-git-send-email-romainba-ux6zf3SgZrrQT0dZR+AlfA@public.gmane.org>
2014-03-09  8:07                                                                                   ` Wolfram Sang
2013-08-19  6:39                                             ` [PATCH 1/2] i2c-designware: make *CNT values configurable Mika Westerberg

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=20130709084402.GF4898@intel.com \
    --to=mika.westerberg-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=christian.ruppert-ux6zf3SgZrrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).