From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D889519DF53; Tue, 16 Jul 2024 15:53:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721145220; cv=none; b=aoYIjacL8RQp2srCvmFO86LNrmQAxyrSJnQ6aux8Nt9JFyx2zalt9RCwbfHpwSAbN3IajnMVQEWlb2oW890mSxo5SZK90e1hQJ32EXKBR9kEMjQOCjHhvhoOB9TF6Mia3q/FPD8DHBCZR+18Bz/QJk6VpEuXNebLScYE+xZWmRI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721145220; c=relaxed/simple; bh=5OEWI+lWrkj60mohXT9YSx7N4HMMXxGU0PapMLzwvSE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AJ4BZm0eAH2sntg2vw8ViIhDKUmwTpZDAnS1FVdvaL/FJzHhBbz/V15GpFQcbv6u/YBfoTQPzdYSc2vt9gfbEVB544BShK/D9rwHtTv/jYUvHa099yvTeGCpuMfobhNPDA0vLgMxwgskky665Nn1MvlgqZ+wS4CHU1ZkJJGxTbI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ExLl7AF5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ExLl7AF5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5350BC116B1; Tue, 16 Jul 2024 15:53:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1721145220; bh=5OEWI+lWrkj60mohXT9YSx7N4HMMXxGU0PapMLzwvSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ExLl7AF52+2xZDqSBbOHDQOM9Xe3etxkpmXC+ppKhjEaeCF1zDt1GOiBAUeXn3c9I ZTOyq8i5S/75W1C51D1tBCslC4ML3/PpDc8s2dLQa+AXbFM7ZVF+MLCXHSONplvq3/ X588zhqfoFzn9l8FnatzZWg4pTN11yVZWg40UMDw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wolfram Sang , Andi Shyti , Sasha Levin Subject: [PATCH 6.9 138/143] i2c: rcar: ensure Gen3+ reset does not disturb local targets Date: Tue, 16 Jul 2024 17:32:14 +0200 Message-ID: <20240716152801.303660194@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240716152755.980289992@linuxfoundation.org> References: <20240716152755.980289992@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wolfram Sang [ Upstream commit ea5ea84c9d3570dc06e8fc5ee2273eaa584aa3ac ] 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. Fixes: 3b770017b03a ("i2c: rcar: handle RXDMA HW behaviour on Gen3") Signed-off-by: Wolfram Sang Signed-off-by: Andi Shyti Signed-off-by: Sasha Levin --- 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 f0724c8e4b219..185a5d60f1019 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -883,6 +883,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; @@ -1175,6 +1179,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)) { @@ -1185,6 +1190,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