From 86a73b0905430c0a637280d33afa498b366f4d23 Mon Sep 17 00:00:00 2001 From: Lad Prabhakar Date: Wed, 30 Sep 2020 13:24:12 +0100 Subject: i2c: rcar_i2c: Fix i2c read/write errors commit 7c8f821e5dde ("i2c: rcar_i2c: Set the slave address from rcar_i2c_xfer") blindly called rcar_i2c_set_addr() with read argument always set to 1 during xfer which introduced read/write errors, whereas earlier rcar_i2c_read_common() called rcar_i2c_set_addr() with read set to 1 and rcar_i2c_write_common() called rcar_i2c_set_addr() with read set 0. Fixes: 7c8f821e5dde ("i2c: rcar_i2c: Set the slave address from rcar_i2c_xfer") Signed-off-by: Lad Prabhakar Reviewed-by: Marek Vasut Reviewed-by: Heiko Schocher --- drivers/i2c/rcar_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/rcar_i2c.c b/drivers/i2c/rcar_i2c.c index 4267bbfa5a..663c342cd8 100644 --- a/drivers/i2c/rcar_i2c.c +++ b/drivers/i2c/rcar_i2c.c @@ -211,7 +211,7 @@ static int rcar_i2c_xfer(struct udevice *dev, struct i2c_msg *msg, int nmsgs) int ret; for (; nmsgs > 0; nmsgs--, msg++) { - ret = rcar_i2c_set_addr(dev, msg->addr, 1); + ret = rcar_i2c_set_addr(dev, msg->addr, !!(msg->flags & I2C_M_RD)); if (ret) return ret; -- cgit