Commit 0b57436f authored by Wolfram Sang's avatar Wolfram Sang Committed by Wolfram Sang

i2c: rcar: check bus state before reinitializing

We should check the bus state before reinitializing the IP core.
Otherwise, the internal bus busy state which also tracks multi-master
activity is lost.

Credits go to the Renesas BSP team for suggesting this change.
Reported-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Fixes: ae481cc1 ("i2c: rcar: fix resume by always initializing registers before transfer")
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 39129f28
...@@ -779,6 +779,11 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, ...@@ -779,6 +779,11 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
pm_runtime_get_sync(dev); pm_runtime_get_sync(dev);
/* Check bus state before init otherwise bus busy info will be lost */
ret = rcar_i2c_bus_barrier(priv);
if (ret < 0)
goto out;
/* Gen3 needs a reset before allowing RXDMA once */ /* Gen3 needs a reset before allowing RXDMA once */
if (priv->devtype == I2C_RCAR_GEN3) { if (priv->devtype == I2C_RCAR_GEN3) {
priv->flags |= ID_P_NO_RXDMA; priv->flags |= ID_P_NO_RXDMA;
...@@ -791,10 +796,6 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, ...@@ -791,10 +796,6 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
rcar_i2c_init(priv); rcar_i2c_init(priv);
ret = rcar_i2c_bus_barrier(priv);
if (ret < 0)
goto out;
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
rcar_i2c_request_dma(priv, msgs + i); rcar_i2c_request_dma(priv, msgs + i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment