public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: "Liu Kimriver/刘金河" <kimriver.liu@siengine.com>
To: "andi.shyti@kernel.org" <andi.shyti@kernel.org>
Cc: "andriy.shevchenko@linux.intel.com"
	<andriy.shevchenko@linux.intel.com>,
	"mika.westerberg@linux.intel.com"
	<mika.westerberg@linux.intel.com>,
	"jsd@semihalf.com" <jsd@semihalf.com>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jarkko.nikula@linux.intel.com" <jarkko.nikula@linux.intel.com>
Subject: Re: [PATCH v7] i2c: designware: fix master is holding SCL low while ENABLE bit is disabled
Date: Mon, 9 Sep 2024 14:26:30 +0000	[thread overview]
Message-ID: <9B8C909B-AF7A-4F0F-BD75-ED368BE71E28@siengine.com> (raw)


HI andi

Due to a 12 time difference,I had been off work.
I am very sorry that I can't reply email in time. I will reply to your email  immediately after going to work tomorrow.

发自我的 iPhone

>From: Andi Shyti <andi.shyti@kernel.org>
>To: Kimriver Liu <kimriver.liu@siengine.com>
>Cc: jarkko.nikula@linux.intel.com, andriy.shevchenko@linux.intel.com,
	 mika.westerberg@linux.intel.com, jsd@semihalf.com,
	linux-i2c@vger.kernel.org,  linux-kernel@vger.kernel.org
>Subject: Re: [PATCH v7] i2c: designware: fix master is holding SCL low while ENABLE bit is disabled
>Date: Mon, 9 Sep 2024 15:08:25 +0200	[thread overview]
>Message-ID: <traj5uhqbny5yro3hf72k2qpga7ez7cuqv2mesvl73fku2b5xq@uw5dqjdc6mms> (raw)
>In-Reply-To: <20240909015646.2285-1-kimriver.liu@siengine.com>

>Hi Kimriver,

>On Mon, Sep 09, 2024 at 09:56:46AM GMT, Kimriver Liu wrote:
>> It was observed issuing ABORT bit(IC_ENABLE[1]) will not work when
>> IC_ENABLE is already disabled.
>> 
>> Check if ENABLE bit(IC_ENABLE[0]) is disabled when the master is
>> holding SCL low. If ENABLE bit is disabled, the software need
>> enable it before trying to issue ABORT bit. otherwise,
>> the controller ignores any write to ABORT bit.
>> 
>> Signed-off-by: Kimriver Liu <kimriver.liu@siengine.com>

>You forgot:

>Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
  
  Thank you for telling me
  
>> ---
>> V6->V7:
>> 	1. add Subject versioning [PATCH v7]
>> 	2. change fsleep(25) to usleep_range(25, 250)
>> 	3. Add macro definition DW_iC_ENABLE_ENABLE to fix compile errors
>> 	4. base: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=master

>Thanks a lot for following up! :-)

>> V5->V6: restore i2c_dw_is_master_idling() function checking
>> V4->V5: delete master idling checking
>> V3->V4:
>> 	1. update commit messages and add patch version and changelog
>> 	2. move print the error message in i2c_dw_xfer
>> V2->V3: change (!enable) to (!(enable & DW_IC_ENABLE_ENABLE))
>> V1->V2: used standard words in function names and addressed review comments
>> 
>> link to V1:
>> https://lore.kernel.org/lkml/20240904064224.2394-1-kimriver.liu@siengine.com/
>> ---

...

>> --- a/drivers/i2c/busses/i2c-designware-common.c
>> +++ b/drivers/i2c/busses/i2c-designware-common.c
>> @@ -453,6 +453,18 @@ void __i2c_dw_disable(struct dw_i2c_dev *dev)
>>  
>>  	abort_needed = raw_intr_stats & DW_IC_INTR_MST_ON_HOLD;
>>  	if (abort_needed) {
>> +		if (!(enable & DW_IC_ENABLE_ENABLE)) {
>> +			regmap_write(dev->map, DW_IC_ENABLE, DW_IC_ENABLE_ENABLE);
>> +			enable |= DW_IC_ENABLE_ENABLE;
>> +			/*
>> +			 * Need two ic_clk delay when enabling the I2C to ensure ENABLE bit
>> +			 * is already set. Wait 10 times the signaling period of the highest
>> +			 * I2C transfer supported by the driver(for 400KHz this is 25us)
>> +			 * as described in the DesignWare I2C databook.
>> +			 */
>> +			usleep_range(25, 250);

>I think there is a misunderstanding here. Andy asked you to use
>flseep and improve the calculation: "Please, calculate this delay
>based on the actual speed in use (or about to be in use)."[*]

>Andy can you please clarify with Kimriver here?

 if we use 400kHz ,need setting flseep(25);
 if we use 100kHz ,need setting flseep(100);
 Overall, take the maximum value:flseep(100);

> --
> 2.17.1

             reply	other threads:[~2024-09-09 14:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-09 14:26 Liu Kimriver/刘金河 [this message]
2024-09-09 17:36 ` [PATCH v7] i2c: designware: fix master is holding SCL low while ENABLE bit is disabled Andi Shyti
2024-09-10  1:44   ` Liu Kimriver/刘金河
  -- strict thread matches above, loose matches on Subject: below --
2024-09-09  1:56 Kimriver Liu
2024-09-09 13:08 ` Andi Shyti

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=9B8C909B-AF7A-4F0F-BD75-ED368BE71E28@siengine.com \
    --to=kimriver.liu@siengine.com \
    --cc=andi.shyti@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jsd@semihalf.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /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