From: Wolfram Sang <wsa@the-dreams.de>
To: Sowjanya Komatineni <skomatineni@nvidia.com>
Cc: thierry.reding@gmail.com, jonathanh@nvidia.com,
mkarthik@nvidia.com, smohammed@nvidia.com, talho@nvidia.com,
peda@axentia.se, digetx@gmail.com, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org
Subject: Re: [PATCH V18 2/6] i2c: tegra: add bus clear Master Support
Date: Mon, 11 Feb 2019 13:44:32 +0100 [thread overview]
Message-ID: <20190211124431.kys66uzp5hwa5ret@ninjato> (raw)
In-Reply-To: <1549652382-5476-2-git-send-email-skomatineni@nvidia.com>
[-- Attachment #1: Type: text/plain, Size: 1919 bytes --]
Hi,
On Fri, Feb 08, 2019 at 10:59:38AM -0800, Sowjanya Komatineni wrote:
> Bus clear feature of Tegra I2C controller helps to recover from
> bus hang when I2C master loses the bus arbitration due to the
> slave device holding SDA LOW continuously for some unknown reasons.
>
> Per I2C specification, the device that held the bus LOW should
> release it within 9 clock pulses.
>
> During bus clear operation, Tegra I2C controller sends 9 clock
> pulses and terminates the transaction with STOP condition.
> Upon successful bus clear operation, bus goes to idle state and
> driver retries the transaction.
>
> Acked-by: Thierry Reding <treding@nvidia.com>
> Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
> Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
We have a bus recovery infrastructure in the core. Tying your code into
it should be easy. You probably just need a 'struct
i2c_bus_recovery_info', populate the 'recover_bus' callback with
'tegra_i2c_issue_bus_clear()', and attach this struct to the 'struct
adapter' if the IP core supports bus recovery, otherwise leave it empty.
Then, you can...
> +static int tegra_i2c_issue_bus_clear(struct tegra_i2c_dev *i2c_dev)
> +{
> + int err;
> + unsigned long time_left;
> + u32 reg;
> +
> + if (i2c_dev->hw->supports_bus_clear) {
... remove the if here because the core will check for a valid
i2c_bus_recovery_info...
> @@ -759,6 +818,13 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
> return 0;
>
> tegra_i2c_init(i2c_dev);
> + /* start recovery upon arbitration loss in single master mode */
> + if (i2c_dev->msg_err == I2C_ERR_ARBITRATION_LOST) {
> + if (!i2c_dev->is_multimaster_mode)
> + return tegra_i2c_issue_bus_clear(i2c_dev);
... and use simply i2c_recover_bus() here.
This will help making bus recovery use consistent across drivers.
Thanks,
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-02-11 12:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-08 18:59 [PATCH V18 1/6] i2c: tegra: sort all the include headers alphabetically Sowjanya Komatineni
2019-02-08 18:59 ` [PATCH V18 2/6] i2c: tegra: add bus clear Master Support Sowjanya Komatineni
2019-02-11 12:44 ` Wolfram Sang [this message]
2019-02-11 20:18 ` Sowjanya Komatineni
2019-02-08 18:59 ` [PATCH V18 3/6] i2c: tegra: fix maximum transfer size Sowjanya Komatineni
2019-02-08 18:59 ` [PATCH V18 4/6] i2c: tegra: Add DMA support Sowjanya Komatineni
2019-02-11 12:55 ` Wolfram Sang
2019-02-11 13:22 ` Dmitry Osipenko
2019-02-11 13:28 ` Wolfram Sang
2019-02-11 16:26 ` Sowjanya Komatineni
2019-02-08 18:59 ` [PATCH V18 5/6] i2c: tegra: update transfer timeout Sowjanya Komatineni
2019-02-08 18:59 ` [PATCH V18 6/6] i2c: tegra: add i2c interface timing support Sowjanya Komatineni
2019-02-11 13:03 ` Wolfram Sang
2019-02-11 16:23 ` Sowjanya Komatineni
2019-02-11 12:45 ` [PATCH V18 1/6] i2c: tegra: sort all the include headers alphabetically Wolfram Sang
2019-02-11 13:06 ` 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=20190211124431.kys66uzp5hwa5ret@ninjato \
--to=wsa@the-dreams.de \
--cc=digetx@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mkarthik@nvidia.com \
--cc=peda@axentia.se \
--cc=skomatineni@nvidia.com \
--cc=smohammed@nvidia.com \
--cc=talho@nvidia.com \
--cc=thierry.reding@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 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).