All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Jaakko Laine <ext-jaakko.laine@vaisala.com>
Cc: shubhrajyoti.datta@gmail.com, linux-i2c@vger.kernel.org,
	michal.simek@xilinx.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 2/2] i2c: xiic: Support forcing single-master in DT
Date: Tue, 25 Aug 2020 15:24:27 +0200	[thread overview]
Message-ID: <20200825132427.GB991@kunai> (raw)
In-Reply-To: <20200820100241.96866-3-ext-jaakko.laine@vaisala.com>

[-- Attachment #1: Type: text/plain, Size: 1992 bytes --]

On Thu, Aug 20, 2020 at 01:02:41PM +0300, Jaakko Laine wrote:
> I2C master operating in multimaster mode can get stuck
> indefinitely if I2C start is detected on bus, but no master
> has a transaction going.
> 
> This is a weakness in I2C standard, which defines no way
> to recover, since all masters are indefinitely disallowed
> from interrupting the currently operating master. A start
> condition can be created for example by an electromagnetic
> discharge applied near physical I2C lines. Or a already
> operating master could get reset immediately after sending
> a start.
> 
> If it is known during device tree creation that only a single
> I2C master will be present on the bus, this deadlock of the
> I2C bus could be avoided in the driver by ignoring the
> bus_is_busy register of the xiic, since bus can never be
> reserved by any other master.

You could even initiate a recovery procedure if it is a device pulling
SDA low.

> This patch adds this support for detecting single-master flag
> in device tree and when provided, improves I2C reliability by
> ignoring the therefore unnecessary xiic bus_is_busy register.
> 
> Error can be reproduced by pulling I2C SDA -line temporarily low
> by shorting it to ground, while linux I2C master is operating on
> it using the xiic driver. The application using the bus will
> start receiving linux error code 16: "Device or resource busy"
> indefinitely:
> 
> kernel: pca953x 0-0020: failed writing register
> app: Error writing file, error: 16
> 
> With multi-master disabled device will instead receive error
> code 5: "I/O error" while SDA is grounded, but recover normal
> operation once short is removed.
> 
> kernel: pca953x 0-0020: failed reading register
> app: Error reading file, error: 5
> 
> Signed-off-by: Jaakko Laine <ext-jaakko.laine@vaisala.com>

Again, looks good to me and matches what we discussed and prepared.
Let's see what Michal et al. think.

Happy hacking!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Wolfram Sang <wsa@the-dreams.de>
To: Jaakko Laine <ext-jaakko.laine@vaisala.com>
Cc: michal.simek@xilinx.com, shubhrajyoti.datta@gmail.com,
	linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org
Subject: Re: [PATCH v2 2/2] i2c: xiic: Support forcing single-master in DT
Date: Tue, 25 Aug 2020 15:24:27 +0200	[thread overview]
Message-ID: <20200825132427.GB991@kunai> (raw)
In-Reply-To: <20200820100241.96866-3-ext-jaakko.laine@vaisala.com>


[-- Attachment #1.1: Type: text/plain, Size: 1992 bytes --]

On Thu, Aug 20, 2020 at 01:02:41PM +0300, Jaakko Laine wrote:
> I2C master operating in multimaster mode can get stuck
> indefinitely if I2C start is detected on bus, but no master
> has a transaction going.
> 
> This is a weakness in I2C standard, which defines no way
> to recover, since all masters are indefinitely disallowed
> from interrupting the currently operating master. A start
> condition can be created for example by an electromagnetic
> discharge applied near physical I2C lines. Or a already
> operating master could get reset immediately after sending
> a start.
> 
> If it is known during device tree creation that only a single
> I2C master will be present on the bus, this deadlock of the
> I2C bus could be avoided in the driver by ignoring the
> bus_is_busy register of the xiic, since bus can never be
> reserved by any other master.

You could even initiate a recovery procedure if it is a device pulling
SDA low.

> This patch adds this support for detecting single-master flag
> in device tree and when provided, improves I2C reliability by
> ignoring the therefore unnecessary xiic bus_is_busy register.
> 
> Error can be reproduced by pulling I2C SDA -line temporarily low
> by shorting it to ground, while linux I2C master is operating on
> it using the xiic driver. The application using the bus will
> start receiving linux error code 16: "Device or resource busy"
> indefinitely:
> 
> kernel: pca953x 0-0020: failed writing register
> app: Error writing file, error: 16
> 
> With multi-master disabled device will instead receive error
> code 5: "I/O error" while SDA is grounded, but recover normal
> operation once short is removed.
> 
> kernel: pca953x 0-0020: failed reading register
> app: Error reading file, error: 5
> 
> Signed-off-by: Jaakko Laine <ext-jaakko.laine@vaisala.com>

Again, looks good to me and matches what we discussed and prepared.
Let's see what Michal et al. think.

Happy hacking!


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-08-25 13:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20 10:02 [PATCH v2 0/2] i2c: xiic: Support forcing single-master in DT Jaakko Laine
2020-08-20 10:02 ` Jaakko Laine
2020-08-20 10:02 ` [PATCH v2 1/2] i2c: xiic: Change code alignment to 1 space only Jaakko Laine
2020-08-20 10:02   ` Jaakko Laine
2020-08-25 13:20   ` wsa
2020-08-25 13:20     ` wsa
2020-08-26 11:22     ` Michal Simek
2020-08-26 11:22       ` Michal Simek
2020-08-20 10:02 ` [PATCH v2 2/2] i2c: xiic: Support forcing single-master in DT Jaakko Laine
2020-08-20 10:02   ` Jaakko Laine
2020-08-25 13:24   ` Wolfram Sang [this message]
2020-08-25 13:24     ` Wolfram Sang
2020-08-26 11:57     ` Laine Jaakko EXT
2020-08-26 11:57       ` Laine Jaakko EXT
2020-08-26 12:05       ` Wolfram Sang
2020-08-26 12:05         ` Wolfram Sang
2020-08-26 11:55   ` Michal Simek
2020-08-26 11:55     ` Michal Simek
2020-08-26 13:03     ` Laine Jaakko EXT
2020-08-26 13:03       ` Laine Jaakko EXT

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=20200825132427.GB991@kunai \
    --to=wsa@the-dreams.de \
    --cc=ext-jaakko.laine@vaisala.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=shubhrajyoti.datta@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.