mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: wsa@kernel.org,
	Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] i2c: algo-pca: Add 0x78 as SCL stuck low status
Date: Thu, 2 Jul 2020 13:04:30 +0300	[thread overview]
Message-ID: <20200702100430.GR3703480@smile.fi.intel.com> (raw)
In-Reply-To: <20200701223912.30864-1-chris.packham@alliedtelesis.co.nz>

On Thu, Jul 02, 2020 at 10:39:11AM +1200, Chris Packham wrote:
> The PCA9665 datasheet says that I2CSTA = 78h indicates that SCL is stuck
> low, this differs to the PCA9564 which uses 90h for this indication.
> Treat either 0x78 or 0x90 as an indication that the SCL line is stuck.
> 
> Based on looking through the PCA9564 and PCA9665 datasheets this should
> be safe for both chips. The PCA9564 should not return 0x78 for any valid
> state and the PCA9665 should not return 0x90.

For me as well looks better this way.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
> Changes in v2:
> - Note which status corresponds to which chip
> - Move patch commentary to commit message
> 
>  drivers/i2c/algos/i2c-algo-pca.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
> index 7f10312d1b88..388978775be0 100644
> --- a/drivers/i2c/algos/i2c-algo-pca.c
> +++ b/drivers/i2c/algos/i2c-algo-pca.c
> @@ -314,7 +314,8 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
>  			DEB2("BUS ERROR - SDA Stuck low\n");
>  			pca_reset(adap);
>  			goto out;
> -		case 0x90: /* Bus error - SCL stuck low */
> +		case 0x78: /* Bus error - SCL stuck low (PCA9665) */
> +		case 0x90: /* Bus error - SCL stuck low (PCA9564) */
>  			DEB2("BUS ERROR - SCL Stuck low\n");
>  			pca_reset(adap);
>  			goto out;
> -- 
> 2.27.0
> 

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2020-07-02 10:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01 22:39 Chris Packham
2020-07-02 10:04 ` Andy Shevchenko [this message]
2020-07-04  6:03 ` Wolfram Sang

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=20200702100430.GR3703480@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.tomlinson@alliedtelesis.co.nz \
    --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

all inboxes | Powered by JetHome®