Commit 21d4b7d4 authored by John Keeping's avatar John Keeping Committed by Heiko Schocher

rockchip: i2c: fix >32 byte writes

The special handling of the chip address and register address must only
happen before we send the data buffer, otherwise we will end up
inserting both of these every 32 bytes.
Signed-off-by: default avatarJohn Keeping <john@metanate.com>
Acked-by: default avatarSimon Glass <sjg@chromium.org>
parent 551288bd
......@@ -269,9 +269,9 @@ 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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment