Skip to content

Commit 0e864b5

Browse files
Wolfram Sangwsakernel
authored andcommitted
i2c: rcar: reset controller is mandatory for Gen3+
Initially, we only needed a reset controller to make sure RXDMA works at least once per transfer. Meanwhile, documentation has been updated. It now says that a reset has to be performed prior every transaction, even if it is non-DMA. So, make the reset controller a requirement instead of being optional. And bail out if resetting fails. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent f707d6b commit 0e864b5

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

drivers/i2c/busses/i2c-rcar.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -838,12 +838,10 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
838838

839839
/* Gen3 needs a reset before allowing RXDMA once */
840840
if (priv->devtype == I2C_RCAR_GEN3) {
841-
priv->flags |= ID_P_NO_RXDMA;
842-
if (!IS_ERR(priv->rstc)) {
843-
ret = rcar_i2c_do_reset(priv);
844-
if (ret == 0)
845-
priv->flags &= ~ID_P_NO_RXDMA;
846-
}
841+
priv->flags &= ~ID_P_NO_RXDMA;
842+
ret = rcar_i2c_do_reset(priv);
843+
if (ret)
844+
goto out;
847845
}
848846

849847
rcar_i2c_init(priv);
@@ -1094,15 +1092,6 @@ static int rcar_i2c_probe(struct platform_device *pdev)
10941092
irqhandler = rcar_i2c_gen2_irq;
10951093
}
10961094

1097-
if (priv->devtype == I2C_RCAR_GEN3) {
1098-
priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
1099-
if (!IS_ERR(priv->rstc)) {
1100-
ret = reset_control_status(priv->rstc);
1101-
if (ret < 0)
1102-
priv->rstc = ERR_PTR(-ENOTSUPP);
1103-
}
1104-
}
1105-
11061095
/* Stay always active when multi-master to keep arbitration working */
11071096
if (of_property_read_bool(dev->of_node, "multi-master"))
11081097
priv->flags |= ID_P_PM_BLOCKED;
@@ -1112,6 +1101,16 @@ static int rcar_i2c_probe(struct platform_device *pdev)
11121101
if (of_property_read_bool(dev->of_node, "smbus"))
11131102
priv->flags |= ID_P_HOST_NOTIFY;
11141103

1104+
if (priv->devtype == I2C_RCAR_GEN3) {
1105+
priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
1106+
if (IS_ERR(priv->rstc))
1107+
goto out_pm_put;
1108+
1109+
ret = reset_control_status(priv->rstc);
1110+
if (ret < 0)
1111+
goto out_pm_put;
1112+
}
1113+
11151114
ret = platform_get_irq(pdev, 0);
11161115
if (ret < 0)
11171116
goto out_pm_put;

0 commit comments

Comments
 (0)