summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-06-12 14:55:33 -0400
committerTom Rini <trini@konsulko.com>2023-06-12 14:55:33 -0400
commit260d4962e06c0a7d2713523c131416a3f70d7f2c (patch)
tree14b9d414810e97f1ffdfdaf099db57a5bbf45a79 /drivers/i2c
parent5b589e139620214f26eb83c9fb7bbd62b5f8fc1d (diff)
parent19b77d3d23966a0d6dbb3c86187765f11100fb6f (diff)
downloadu-boot-260d4962e06c0a7d2713523c131416a3f70d7f2c.tar.gz
u-boot-260d4962e06c0a7d2713523c131416a3f70d7f2c.tar.bz2
u-boot-260d4962e06c0a7d2713523c131416a3f70d7f2c.zip
Merge tag v2023.07-rc4 into next
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/i2c-cdns.c9
-rw-r--r--drivers/i2c/rk_i2c.c7
-rw-r--r--drivers/i2c/tegra_i2c.c4
3 files changed, 11 insertions, 9 deletions
diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c
index c1672ca18e..935b2ac637 100644
--- a/drivers/i2c/i2c-cdns.c
+++ b/drivers/i2c/i2c-cdns.c
@@ -444,7 +444,7 @@ static int cdns_i2c_xfer(struct udevice *dev, struct i2c_msg *msg,
debug("i2c_xfer: %d messages\n", nmsgs);
for (u8 retry = 0; retry < CDNS_I2C_ARB_LOST_MAX_RETRIES &&
- nmsgs > 0; nmsgs--, msg++) {
+ nmsgs > 0;) {
debug("i2c_xfer: chip=0x%x, len=0x%x\n", msg->addr, msg->len);
if (msg->flags & I2C_M_RD) {
ret = cdns_i2c_read_data(i2c_bus, msg->addr, msg->buf,
@@ -461,7 +461,8 @@ static int cdns_i2c_xfer(struct udevice *dev, struct i2c_msg *msg,
retry);
continue;
}
-
+ nmsgs--;
+ msg++;
if (ret) {
debug("i2c_write: error sending\n");
return -EREMOTEIO;
@@ -479,9 +480,9 @@ static int cdns_i2c_of_to_plat(struct udevice *dev)
struct clk clk;
int ret;
- i2c_bus->regs = (struct cdns_i2c_regs *)dev_read_addr(dev);
+ i2c_bus->regs = dev_read_addr_ptr(dev);
if (!i2c_bus->regs)
- return -ENOMEM;
+ return -EINVAL;
if (pdata)
i2c_bus->quirks = pdata->quirks;
diff --git a/drivers/i2c/rk_i2c.c b/drivers/i2c/rk_i2c.c
index f8fac45b6c..9927af94a8 100644
--- a/drivers/i2c/rk_i2c.c
+++ b/drivers/i2c/rk_i2c.c
@@ -342,7 +342,7 @@ static int rockchip_i2c_xfer(struct udevice *bus, struct i2c_msg *msg,
int nmsgs)
{
struct rk_i2c *i2c = dev_get_priv(bus);
- int ret;
+ int ret = 0;
debug("i2c_xfer: %d messages\n", nmsgs);
for (; nmsgs > 0; nmsgs--, msg++) {
@@ -356,14 +356,15 @@ static int rockchip_i2c_xfer(struct udevice *bus, struct i2c_msg *msg,
}
if (ret) {
debug("i2c_write: error sending\n");
- return -EREMOTEIO;
+ ret = -EREMOTEIO;
+ break;
}
}
rk_i2c_send_stop_bit(i2c);
rk_i2c_disable(i2c);
- return 0;
+ return ret;
}
int rockchip_i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c
index 2394e9d0fb..5864a1ad5b 100644
--- a/drivers/i2c/tegra_i2c.c
+++ b/drivers/i2c/tegra_i2c.c
@@ -364,8 +364,8 @@ static int tegra_i2c_probe(struct udevice *dev)
i2c_bus->id = dev_seq(dev);
i2c_bus->type = dev_get_driver_data(dev);
- i2c_bus->regs = (struct i2c_ctlr *)dev_read_addr(dev);
- if ((ulong)i2c_bus->regs == FDT_ADDR_T_NONE) {
+ i2c_bus->regs = dev_read_addr_ptr(dev);
+ if (!i2c_bus->regs) {
debug("%s: Cannot get regs address\n", __func__);
return -EINVAL;
}