summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Keeping <john@metanate.com>2016-08-18 20:08:42 +0100
committerHeiko Schocher <hs@denx.de>2016-09-13 06:57:27 +0200
commit21d4b7d4e1786a2ccbcc5b304cf714e3778e6183 (patch)
treec98bcb4eccd0b0ca2554f7ae9dbe9dd842135e09
parent551288bd8ba5db8f7553a9b7e4420fd005767b88 (diff)
downloadu-boot-21d4b7d4e1786a2ccbcc5b304cf714e3778e6183.tar.gz
u-boot-21d4b7d4e1786a2ccbcc5b304cf714e3778e6183.tar.xz
u-boot-21d4b7d4e1786a2ccbcc5b304cf714e3778e6183.zip
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: John Keeping <john@metanate.com> Acked-by: Simon Glass <sjg@chromium.org>
-rw-r--r--drivers/i2c/rk_i2c.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/rk_i2c.c b/drivers/i2c/rk_i2c.c
index a4c0032fd8..7c701cbed0 100644
--- a/drivers/i2c/rk_i2c.c
+++ b/drivers/i2c/rk_i2c.c
@@ -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 {