Skip to content

Commit

Permalink
i2c: rcar: check bus state before reinitializing
Browse files Browse the repository at this point in the history
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: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Fixes: ae481cc ("i2c: rcar: fix resume by always initializing registers before transfer")
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
  • Loading branch information
Wolfram Sang authored and Wolfram Sang committed Nov 27, 2018
1 parent 39129f2 commit 0b57436
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/i2c/busses/i2c-rcar.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,11 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,

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 */
if (priv->devtype == I2C_RCAR_GEN3) {
priv->flags |= ID_P_NO_RXDMA;
Expand All @@ -791,10 +796,6 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,

rcar_i2c_init(priv);

ret = rcar_i2c_bus_barrier(priv);
if (ret < 0)
goto out;

for (i = 0; i < num; i++)
rcar_i2c_request_dma(priv, msgs + i);

Expand Down

0 comments on commit 0b57436

Please sign in to comment.