From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: linux-renesas-soc@vger.kernel.org
Cc: Andi Shyti <andi.shyti@kernel.org>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: rcar: ensure Gen3+ reset does not disturb local targets
Date: Thu, 11 Jul 2024 23:17:43 +0200 [thread overview]
Message-ID: <ZpBL90Ko-B9oxCLK@shikoro> (raw)
In-Reply-To: <20240711083043.8334-2-wsa+renesas@sang-engineering.com>
[-- Attachment #1: Type: text/plain, Size: 1886 bytes --]
On Thu, Jul 11, 2024 at 10:30:44AM +0200, Wolfram Sang wrote:
> R-Car Gen3+ needs a reset before every controller transfer. That erases
> configuration of a potentially in parallel running local target
> instance. To avoid this disruption, avoid controller transfers if a
> local target is running. Also, disable SMBusHostNotify because it
> requires being a controller and local target at the same time.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Fixes: 3b770017b03a ("i2c: rcar: handle RXDMA HW behaviour on Gen3")
> ---
> drivers/i2c/busses/i2c-rcar.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 8f2ede534f30..29cbeda59f3e 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -884,6 +884,10 @@ static int rcar_i2c_do_reset(struct rcar_i2c_priv *priv)
> {
> int ret;
>
> + /* Don't reset if a slave instance is currently running */
> + if (priv->slave)
> + return -EISCONN;
> +
> ret = reset_control_reset(priv->rstc);
> if (ret)
> return ret;
> @@ -1176,6 +1180,7 @@ static int rcar_i2c_probe(struct platform_device *pdev)
> if (of_property_read_bool(dev->of_node, "smbus"))
> priv->flags |= ID_P_HOST_NOTIFY;
>
> + /* R-Car Gen3+ needs a reset before every transfer */
> if (priv->devtype >= I2C_RCAR_GEN3) {
> priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> if (IS_ERR(priv->rstc)) {
> @@ -1186,6 +1191,9 @@ static int rcar_i2c_probe(struct platform_device *pdev)
> ret = reset_control_status(priv->rstc);
> if (ret < 0)
> goto out_pm_put;
> +
> + /* hard reset disturbs HostNotify local target, so disable it */
> + priv->flags &= ~ID_P_HOST_NOTIFY;
> }
>
> ret = platform_get_irq(pdev, 0);
> --
> 2.43.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-07-11 21:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 8:30 [PATCH] i2c: rcar: ensure Gen3+ reset does not disturb local targets Wolfram Sang
2024-07-11 21:17 ` Wolfram Sang [this message]
2024-07-11 23:48 ` 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=ZpBL90Ko-B9oxCLK@shikoro \
--to=wsa+renesas@sang-engineering.com \
--cc=andi.shyti@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.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