linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
To: Michael Wu <michael.wu@vatics.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Wolfram Sang <wsa@kernel.org>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Morgan Chang <morgan.chang@vatics.com>
Subject: Re: [PATCH 2/2] i2c: designware: slave should do WRITE_REQUESTED before WRITE_RECEIVED
Date: Fri, 30 Oct 2020 16:46:02 +0200	[thread overview]
Message-ID: <85c6cb3f-2eeb-07c7-0a53-a502b45c91a5@linux.intel.com> (raw)
In-Reply-To: <20201030080420.28016-3-michael.wu@vatics.com>

On 10/30/20 10:04 AM, Michael Wu wrote:
> Sometimes we would get the following flow when doing an i2cset:
> 
> 0x1 STATUS SLAVE_ACTIVITY=0x1 : RAW_INTR_STAT=0x514 : INTR_STAT=0x4
> I2C_SLAVE_WRITE_RECEIVED
> 0x1 STATUS SLAVE_ACTIVITY=0x0 : RAW_INTR_STAT=0x714 : INTR_STAT=0x204
> I2C_SLAVE_WRITE_REQUESTED
> I2C_SLAVE_WRITE_RECEIVED
> 
> Documentation/i2c/slave-interface.rst says that I2C_SLAVE_WRITE_REQUESTED,
> which is mandatory, should be sent while the data did not arrive yet. It
> means in a write-request I2C_SLAVE_WRITE_REQUESTED should be reported
> before any I2C_SLAVE_WRITE_RECEIVED.
> 
> By the way, I2C_SLAVE_STOP didn't be reported in the above case because
> DW_IC_INTR_STAT was not 0x200.
> 
> dev->status can be used to record the current state, especially Designware
> I2C controller has no interrupts to identify a write-request. This patch
> makes not only I2C_SLAVE_WRITE_REQUESTED been reported first when
> IC_INTR_RX_FULL is rising and dev->status isn't STATUS_WRITE_IN_PROGRESS
> but also I2C_SLAVE_STOP been reported when a STOP condition is received.
> 
> Signed-off-by: Michael Wu <michael.wu@vatics.com>
> ---
>   drivers/i2c/busses/i2c-designware-slave.c | 45 +++++++++--------------
>   1 file changed, 18 insertions(+), 27 deletions(-)
> 
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

  reply	other threads:[~2020-10-30 14:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30  8:04 [PATCH 0/2] Designware I2C slave confusing IC_INTR_STOP_DET handle Michael Wu
2020-10-30  8:04 ` [PATCH 1/2] i2c: designware: call i2c_dw_read_clear_intrbits_slave() once Michael Wu
2020-10-30  8:04 ` [PATCH 2/2] i2c: designware: slave should do WRITE_REQUESTED before WRITE_RECEIVED Michael Wu
2020-10-30 14:46   ` Jarkko Nikula [this message]
2020-11-03 21:03   ` Wolfram Sang
2020-11-04 10:17     ` Michael.Wu
2020-11-04 10:35       ` Wolfram Sang
2020-11-04 10:51         ` Michael.Wu
2020-11-05  9:13       ` Jarkko Nikula
  -- strict thread matches above, loose matches on Subject: below --
2020-10-16  6:04 [PATCH 1/2] i2c: designware: call i2c_dw_read_clear_intrbits_slave() once Michael Wu
2020-10-16  6:04 ` [PATCH 2/2] i2c: designware: slave should do WRITE_REQUESTED before WRITE_RECEIVED Michael Wu

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=85c6cb3f-2eeb-07c7-0a53-a502b45c91a5@linux.intel.com \
    --to=jarkko.nikula@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.wu@vatics.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=morgan.chang@vatics.com \
    --cc=wsa@kernel.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).