linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Ruppert <christian.ruppert-ux6zf3SgZrrQT0dZR+AlfA@public.gmane.org>
To: Shinya Kuribayashi <skuribay-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
Cc: mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	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, 16 Jul 2013 13:16:18 +0200	[thread overview]
Message-ID: <20130716111616.GA25835@ab42.lan> (raw)
In-Reply-To: <51E0E76B.1040304-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>

On Sat, Jul 13, 2013 at 02:36:43PM +0900, Shinya Kuribayashi wrote:
> Hi,
> 
> Now I've had a look at the whole discussion.
> 
> Basically, DW I2C core provides a good enough (and quite direct) way
> to control tHIGH and tLOW timing specs, *HCNT and *LCNT registers.
> 
> But from my experience (with a slightly old version of DW I2C core
> around 2005, version 1.06a or so), DW I2C core was apparently lacking
> in an appropriate hardware mechanism to meet tHD;STA timing spec.  We
> then found that we could meet tHD;STA by increasing *HCNT values, so
> that's what currently we have in i2c-designware.c  I know with that
> workaround applied, tHIGH is to be configured with a larger value
> than necessary, but we have no choice.  For I2C bus systems, we must
> meet every timing constraint strictly as required.  If DW I2C core
> cannot meet tHD;STA without the sacrifice of tHIGH, and I would call
> it a hardware bug.

I agree. However, tHD;STA [min] is defined to the same value as tHIGH
[min] for all modes in the I2C specification. Do I understand you
correctly that the SCL_HCNT parameters control at the same time tHIGH
and tHD;STA?

Concerning SDA_HOLD_TIME, we have done a few measurements in our lab and
it looks like the delay between the falling edge clock of the start
condition and the rising edge of the first data bit of the start byte is
controlled by this parameter. I conclude that in the drawing below (1)
is controlled by SCL_HCNT whereas (2) is controlled by SDA_HOLD_TIME.

     _________
scl           \__________ ...
     ___           ______
sda     \_________/       ...

        |-----|---|
          (1)  (2)

> On Wed, Jul 10, 2013 at 06:56:35PM +0200, Christian Ruppert wrote:
> >>If I understand the above, it leaves Tf and Tr to be PCB specific and then
> >>these values are passed to the core driver from platform data, right?
> >
> >That would be the idea: Calculate Th' and Tl' in function of the desired
> >clock frequency and duty cycle and then adapt these values using
> >measured transition times.
> 
> I think this would be a good solution.
> 
> On 7/8/13 10:42 PM, Christian Ruppert wrote:
> >Anyway, the HCNT, LCNT and SDA hold time values we get from ACPI SSCN/FMCN
> >methods are measured by our HW guys on a certain board and they have
> >verified that using those we meet all the I2C timing specs.
> >
> >In order to take advantage of those we need some way to pass those values
> >to the i2c designware core. I have two suggestions:
> >
> >   - Use the method outlined in this patch and let the interface driver
> >     override *CNT values.
> 
> With *HCNT and *LCNT registers, we can control tHIGH, tLOW, tHD;STA
> quite accurately.  On the other hand, what we can't control with DW
> I2C core is tr and tf.  I assumed that it could never be longer than
> 300nsec (it's defined as a max. in the I2C specification), so I used
> it for calculation.
> 
> I agree that tr and tf are PCB specific, and it would a good first
> step toward timing optimization to make them configurable through
> platform data.
> 
> Second step is that if current i2c_dw_scl_hcnt and i2c_dw_scl_lcnt
> calculations don't suit with later DW I2C cores, then it would be
> nice for someone who can access to the data book to update formulas,
> or provide alternative formulas and make them selectable depending
> on DW core versions.

I'm not having the impression there is a huge difference between the
different generations of DW blocks. Probably we can find one formula
that suits all blocks. We just have to be careful (in doubt rather
conservative) with the transition times. This seems to be currently
the case and if I understand Mika correctly, his objective is to remove
some of this conservatism.

> It always helps us to have a way to calculate *HCNT and *LCNT values
> automatically.  As said above, DW I2C core can control tHIGH, tLOW,
> tHD;STA, etc. quite _accurate_, if HCNT/LCNT values were calculated
> with proper formulas.  It also helps hardware people as well to
> provide reference HCNT/LCNT values.
> 
> And as a third step, if we want to use optimized HCNT/LCNT values
> which can not be obtained from proper formulas + user-requested
> tf/tr, or if we want to use HCNT/LCNT settings verified by vendors
> or provided from hardware team, then I'm fine with having a way to
> _override_ HCNT/LCNT values.  Such direct way might be useful.

I agree. Probably it is best to have both, a default method based on
formulas and timing parameters (the formulas are quite simple anyway)
which works with device tree and such and a second method based on
register values which works with mechanisms like ACPI.

Christian

  parent reply	other threads:[~2013-07-16 11:16 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
     [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 [this message]
     [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=20130716111616.GA25835@ab42.lan \
    --to=christian.ruppert-ux6zf3sgzrrqt0dzr+alfa@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=skuribay-e+AXbWqSrlAAvxtiuMwx3w@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).