diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2024-07-11 10:30:44 +0200 |
---|---|---|
committer | Andi Shyti <andi.shyti@kernel.org> | 2024-07-12 01:45:08 +0200 |
commit | ea5ea84c9d3570dc06e8fc5ee2273eaa584aa3ac (patch) | |
tree | fd5590810e74eb37dd6f87736ab4475c431bf968 /drivers | |
parent | i2c: rcar: clear NO_RXDMA flag after resetting (diff) | |
download | linux-ea5ea84c9d3570dc06e8fc5ee2273eaa584aa3ac.tar.xz linux-ea5ea84c9d3570dc06e8fc5ee2273eaa584aa3ac.zip |
i2c: rcar: ensure Gen3+ reset does not disturb local targets
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 <wsa+renesas@sang-engineering.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/i2c-rcar.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index f0724c8e4b21..185a5d60f101 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); |