]> git.sur5r.net Git - u-boot/commitdiff
rockchip: i2c: move register write out of inner loop
authorJohn Keeping <john@metanate.com>
Thu, 18 Aug 2016 19:08:41 +0000 (20:08 +0100)
committerHeiko Schocher <hs@denx.de>
Tue, 13 Sep 2016 04:57:16 +0000 (06:57 +0200)
There is no point in writing intermediate values to the txdata
registers.

Also add padding to the debug logging to make it easier to read when
there are leading zeroes.

Signed-off-by: John Keeping <john@metanate.com>
Acked-by: Simon Glass <sjg@chromium.org>
drivers/i2c/rk_i2c.c

index 2597970bb00b68abb2a99cb173658e4fe5e10ffc..a4c0032fd8dce24251272cddb9a07170f77772a8 100644 (file)
@@ -277,9 +277,9 @@ static int rk_i2c_write(struct rk_i2c *i2c, uchar chip, uint reg, uint r_len,
                                } else {
                                        txdata |= (*pbuf++)<<(j * 8);
                                }
-                               writel(txdata, &regs->txdata[i]);
                        }
-                       debug("I2c Write TXDATA[%d] = 0x%x\n", i, txdata);
+                       writel(txdata, &regs->txdata[i]);
+                       debug("I2c Write TXDATA[%d] = 0x%08x\n", i, txdata);
                }
 
                writel(I2C_CON_EN | I2C_CON_MOD(I2C_MODE_TX), &regs->con);