X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fi2c%2Frk_i2c.c;h=76f41f7e85791c82d0192b7770aa27dda6f9d8c7;hb=f7fda5d1c05e6c86cf60cbd16b7258be56477dfc;hp=63b141838b6f14be71e0d38c708681d043ac6276;hpb=09849f4a7779a247be8af5cfae44f7aad30e1222;p=u-boot diff --git a/drivers/i2c/rk_i2c.c b/drivers/i2c/rk_i2c.c index 63b141838b..76f41f7e85 100644 --- a/drivers/i2c/rk_i2c.c +++ b/drivers/i2c/rk_i2c.c @@ -258,7 +258,7 @@ static int rk_i2c_write(struct rk_i2c *i2c, uchar chip, uint reg, uint r_len, while (bytes_remain_len) { if (bytes_remain_len > RK_I2C_FIFO_SIZE) - bytes_xferred = 32; + bytes_xferred = RK_I2C_FIFO_SIZE; else bytes_xferred = bytes_remain_len; words_xferred = DIV_ROUND_UP(bytes_xferred, 4); @@ -269,17 +269,17 @@ static int rk_i2c_write(struct rk_i2c *i2c, uchar chip, uint reg, uint r_len, if ((i * 4 + j) == bytes_xferred) break; - if (i == 0 && j == 0) { + if (i == 0 && j == 0 && pbuf == buf) { txdata |= (chip << 1); - } else if (i == 0 && j <= r_len) { + } else if (i == 0 && j <= r_len && pbuf == buf) { txdata |= (reg & (0xff << ((j - 1) * 8))) << 8; } else { txdata |= (*pbuf++)<<(j * 8); } - writel(txdata, ®s->txdata[i]); } - debug("I2c Write TXDATA[%d] = 0x%x\n", i, txdata); + writel(txdata, ®s->txdata[i]); + debug("I2c Write TXDATA[%d] = 0x%08x\n", i, txdata); } writel(I2C_CON_EN | I2C_CON_MOD(I2C_MODE_TX), ®s->con); @@ -380,7 +380,10 @@ static const struct dm_i2c_ops rockchip_i2c_ops = { }; static const struct udevice_id rockchip_i2c_ids[] = { + { .compatible = "rockchip,rk3066-i2c" }, + { .compatible = "rockchip,rk3188-i2c" }, { .compatible = "rockchip,rk3288-i2c" }, + { .compatible = "rockchip,rk3399-i2c" }, { } };