Skip to content

Commit 2b523c4

Browse files
Wolfram Sangwsakernel
authored andcommitted
i2c: rcar: introduce Gen4 devices
So far, we treated Gen4 as Gen3. But we are soon adding FM+ as a Gen4 specific feature, so prepare the code for the new devtype. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent e19e1ab commit 2b523c4

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

drivers/i2c/busses/i2c-rcar.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ enum rcar_i2c_type {
132132
I2C_RCAR_GEN1,
133133
I2C_RCAR_GEN2,
134134
I2C_RCAR_GEN3,
135+
I2C_RCAR_GEN4,
135136
};
136137

137138
struct rcar_i2c_priv {
@@ -431,8 +432,8 @@ static void rcar_i2c_cleanup_dma(struct rcar_i2c_priv *priv, bool terminate)
431432
dma_unmap_single(chan->device->dev, sg_dma_address(&priv->sg),
432433
sg_dma_len(&priv->sg), priv->dma_direction);
433434

434-
/* Gen3 can only do one RXDMA per transfer and we just completed it */
435-
if (priv->devtype == I2C_RCAR_GEN3 &&
435+
/* Gen3+ can only do one RXDMA per transfer and we just completed it */
436+
if (priv->devtype >= I2C_RCAR_GEN3 &&
436437
priv->dma_direction == DMA_FROM_DEVICE)
437438
priv->flags |= ID_P_NO_RXDMA;
438439

@@ -886,8 +887,8 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
886887
if (ret < 0)
887888
goto out;
888889

889-
/* Gen3 needs a reset before allowing RXDMA once */
890-
if (priv->devtype == I2C_RCAR_GEN3) {
890+
/* Gen3+ needs a reset. That also allows RXDMA once */
891+
if (priv->devtype >= I2C_RCAR_GEN3) {
891892
priv->flags &= ~ID_P_NO_RXDMA;
892893
ret = rcar_i2c_do_reset(priv);
893894
if (ret)
@@ -1075,7 +1076,7 @@ static const struct of_device_id rcar_i2c_dt_ids[] = {
10751076
{ .compatible = "renesas,rcar-gen1-i2c", .data = (void *)I2C_RCAR_GEN1 },
10761077
{ .compatible = "renesas,rcar-gen2-i2c", .data = (void *)I2C_RCAR_GEN2 },
10771078
{ .compatible = "renesas,rcar-gen3-i2c", .data = (void *)I2C_RCAR_GEN3 },
1078-
{ .compatible = "renesas,rcar-gen4-i2c", .data = (void *)I2C_RCAR_GEN3 },
1079+
{ .compatible = "renesas,rcar-gen4-i2c", .data = (void *)I2C_RCAR_GEN4 },
10791080
{},
10801081
};
10811082
MODULE_DEVICE_TABLE(of, rcar_i2c_dt_ids);
@@ -1151,7 +1152,7 @@ static int rcar_i2c_probe(struct platform_device *pdev)
11511152
if (of_property_read_bool(dev->of_node, "smbus"))
11521153
priv->flags |= ID_P_HOST_NOTIFY;
11531154

1154-
if (priv->devtype == I2C_RCAR_GEN3) {
1155+
if (priv->devtype >= I2C_RCAR_GEN3) {
11551156
priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
11561157
if (IS_ERR(priv->rstc)) {
11571158
ret = PTR_ERR(priv->rstc);

0 commit comments

Comments
 (0)