瀏覽代碼

rockchip: i2c: move register write out of inner loop

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>
John Keeping 8 年之前
父節點
當前提交
551288bd8b
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      drivers/i2c/rk_i2c.c

+ 2 - 2
drivers/i2c/rk_i2c.c

@@ -277,9 +277,9 @@ static int rk_i2c_write(struct rk_i2c *i2c, uchar chip, uint reg, uint r_len,
 				} else {
 				} else {
 					txdata |= (*pbuf++)<<(j * 8);
 					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);
 		writel(I2C_CON_EN | I2C_CON_MOD(I2C_MODE_TX), &regs->con);