Skip to content

Commit eb01597

Browse files
Wolfram Sangwsakernel
authored andcommitted
i2c: rcar: always clear ICSAR to avoid side effects
On R-Car Gen2, we get a timeout when reading from the address set in ICSAR, even though the slave interface is disabled. Clearing it fixes this situation. Note that Gen3 is not affected. To reproduce: bind and undbind an I2C slave on some bus, run 'i2cdetect' on that bus. Fixes: de20d18 ("i2c: rcar: add slave support") Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 436d176 commit eb01597

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/i2c/busses/i2c-rcar.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@ static int rcar_unreg_slave(struct i2c_client *slave)
868868
/* disable irqs and ensure none is running before clearing ptr */
869869
rcar_i2c_write(priv, ICSIER, 0);
870870
rcar_i2c_write(priv, ICSCR, 0);
871+
rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */
871872

872873
synchronize_irq(priv->irq);
873874
priv->slave = NULL;
@@ -969,6 +970,8 @@ static int rcar_i2c_probe(struct platform_device *pdev)
969970
if (ret < 0)
970971
goto out_pm_put;
971972

973+
rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */
974+
972975
if (priv->devtype == I2C_RCAR_GEN3) {
973976
priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
974977
if (!IS_ERR(priv->rstc)) {

0 commit comments

Comments
 (0)