Skip to content

Commit ea5ea84

Browse files
Wolfram SangAndi Shyti
authored andcommitted
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: 3b77001 ("i2c: rcar: handle RXDMA HW behaviour on Gen3") Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Andi Shyti <[email protected]>
1 parent fea6b5e commit ea5ea84

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/i2c/busses/i2c-rcar.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,10 @@ static int rcar_i2c_do_reset(struct rcar_i2c_priv *priv)
883883
{
884884
int ret;
885885

886+
/* Don't reset if a slave instance is currently running */
887+
if (priv->slave)
888+
return -EISCONN;
889+
886890
ret = reset_control_reset(priv->rstc);
887891
if (ret)
888892
return ret;
@@ -1175,6 +1179,7 @@ static int rcar_i2c_probe(struct platform_device *pdev)
11751179
if (of_property_read_bool(dev->of_node, "smbus"))
11761180
priv->flags |= ID_P_HOST_NOTIFY;
11771181

1182+
/* R-Car Gen3+ needs a reset before every transfer */
11781183
if (priv->devtype >= I2C_RCAR_GEN3) {
11791184
priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
11801185
if (IS_ERR(priv->rstc)) {
@@ -1185,6 +1190,9 @@ static int rcar_i2c_probe(struct platform_device *pdev)
11851190
ret = reset_control_status(priv->rstc);
11861191
if (ret < 0)
11871192
goto out_pm_put;
1193+
1194+
/* hard reset disturbs HostNotify local target, so disable it */
1195+
priv->flags &= ~ID_P_HOST_NOTIFY;
11881196
}
11891197

11901198
ret = platform_get_irq(pdev, 0);

0 commit comments

Comments
 (0)