]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
rockchip: i2c: fix >32 byte writes
authorJohn Keeping <john@metanate.com>
Thu, 18 Aug 2016 19:08:42 +0000 (20:08 +0100)
committerHeiko Schocher <hs@denx.de>
Tue, 13 Sep 2016 04:57:27 +0000 (06:57 +0200)
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>
drivers/i2c/rk_i2c.c

index a4c0032fd8dce24251272cddb9a07170f77772a8..7c701cbed0a981d7c41b6c4fb1fc99735b9757c5 100644 (file)
@@ -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 {