linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Glauber <jan.glauber@caviumnetworks.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
	David Daney <ddaney@caviumnetworks.com>,
	David Daney <david.daney@cavium.com>
Subject: Re: [PATCH v4 05/14] i2c-octeon: Enable high-level controller and improve on bus contention
Date: Thu, 31 Mar 2016 12:24:33 +0200	[thread overview]
Message-ID: <20160331102433.GB31112@hardcore> (raw)
In-Reply-To: <20160323203215.GF19849@katana>

On Wed, Mar 23, 2016 at 09:32:15PM +0100, Wolfram Sang wrote:
> On Fri, Mar 18, 2016 at 09:46:30AM +0100, Jan Glauber wrote:
> > From: David Daney <david.daney@cavium.com>
> > 
> > Use High Level Controller when possible.
> 
> Can you give me a one line description what this Controller is? I'd
> assume it can do simple write-then-read messages with less setup?

Of course, I'll add this to the patch description too.

The HLC can read/write up to 8 bytes and is completely optional. The most
important difference of the HLC is that it only requires one interrupt for
a transfer (up to 8 bytes) where the low-level read/write requires 2
interrupts plus one interrupt per transferred byte. Since the interrupts
are costly using the HLC improves the performance. Also, the HLC provides
improved error handling.

> > i2c-octeon was reacting badly to bus contention: when in
> > direct-access mode (for transfers > 8 bytes, which cannot use the
> > high-level controller) some !ACK or arbitration-loss states were
> > not causing the current transfer to be aborted, and the bus released.
> 
> So, what does this patch do? Enable HLC for transfers < 8 byte? And for
> all other transfers we still suffer from the same problem?

I think the patch description was misleading, which is my fault because
I merged several incremental patches into one.

The HLC is used when possible (up to 8 bytes). For bigger transfers
the handling is improved and special treatment is done for the first
and last part of a transfer.

> Such information should be here, too. It helps reviewing when I already
> have the big picture.
> 
> > There's one place in i2c protocol that !ACK is an acceptable
> > response: in the final byte of a read cycle.  In this case the
> > destination is not saying that the transfer failed, just that it
> > doesn't want more data.
> 
> Ehrm, no? For reads, the MASTER is saying it doesn't need any more data.
> And an I2C eeprom can legally NACK a write, e.g. when it is still
> processing the previous write. Also, NACK is a valid response after the
> address phase, meaning there is no device listening.
> 
> Does the implementation cover the above cases?
> 
> > This enables correct behavior of ACK on final byte of non-final read
> > msgs too.
> 
> The patch is huge and very hard to review. Maybe it needs to be split
> up. Brainstorming example: a) move functions like octeon_i2c_set_clock()
> upwards, b) change them if needed, c) implement HLC functions, d) add
> switching logic to use HLC or non-HLC functions...

I was reluctant to split the patch because of the high risk of breaking
the bi-sectability, but your proposal makes sense. I've seperated the
error handling changes from the HLC feature now (plus seperate
patches for the moved functions).

Thanks,
Jan

> But first we need to be clear on the big picture view.
> 
> Thanks,
> 
>    Wolfram
> 

  reply	other threads:[~2016-03-31 10:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-18  8:46 [PATCH v4 00/14] i2c-octeon and i2c-thunderx drivers Jan Glauber
2016-03-18  8:46 ` [PATCH v4 01/14] i2c-octeon: Cleanup i2c-octeon driver Jan Glauber
2016-03-23 19:51   ` Wolfram Sang
2016-03-18  8:46 ` [PATCH v4 02/14] i2c-octeon: Cleanup resource allocation code Jan Glauber
2016-03-23 19:52   ` Wolfram Sang
2016-03-18  8:46 ` [PATCH v4 03/14] i2c-octeon: Change adapter timeout and retry default values Jan Glauber
2016-03-23 19:55   ` Wolfram Sang
2016-03-31 10:13     ` Jan Glauber
2016-03-18  8:46 ` [PATCH v4 04/14] i2c-octeon: Support I2C_M_RECV_LEN Jan Glauber
2016-03-23 19:52   ` Wolfram Sang
2016-03-18  8:46 ` [PATCH v4 05/14] i2c-octeon: Enable high-level controller and improve on bus contention Jan Glauber
2016-03-23 20:32   ` Wolfram Sang
2016-03-31 10:24     ` Jan Glauber [this message]
2016-03-18  8:46 ` [PATCH v4 06/14] dt-bindings: i2c: Add Octeon cn78xx TWSI Jan Glauber
2016-03-18  8:46 ` [PATCH v4 07/14] i2c-octeon: Add support for cn78xx chips Jan Glauber
2016-03-18  8:46 ` [PATCH v4 08/14] i2c-octeon: Flush TWSI writes with readback Jan Glauber
2016-03-18  8:46 ` [PATCH v4 09/14] i2c-octeon: Faster operation when IFLG signals late Jan Glauber
2016-03-18  8:46 ` [PATCH v4 10/14] i2c-octeon: Add workaround for broken irqs on CN3860 Jan Glauber
2016-03-18  8:46 ` [PATCH v4 11/14] i2c-octeon: Rename driver to prepare for split Jan Glauber
2016-03-18 17:11   ` David Daney
2016-03-18  8:46 ` [PATCH v4 12/14] i2c-octeon: Split the driver into two parts Jan Glauber
2016-03-18  8:46 ` [PATCH v4 13/14] i2c-thunderx: Add i2c driver for ThunderX SOC Jan Glauber
2016-03-18  8:46 ` [PATCH v4 14/14] i2c-thunderx: Add smbus alert support Jan Glauber

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=20160331102433.GB31112@hardcore \
    --to=jan.glauber@caviumnetworks.com \
    --cc=david.daney@cavium.com \
    --cc=ddaney@caviumnetworks.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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).