提交 2aefb1bd 编写于 作者: S Sifan Naeem 提交者: Wolfram Sang

i2c: img-scb: do dummy writes before fifo access

Move scb_wr_rd_fence to before reading from fifo and writing to
fifo to make sure the the first read/write is done after the required
number of cycles.

Fixes: commit 27bce457 ("i2c: img-scb: Add Imagination Technologies I2C SCB driver")
Signed-off-by: NSifan Naeem <sifan.naeem@imgtec.com>
Acked-by: NJames Hogan <james.hogan@imgtec.com>
Reviewed-by: NJames Hartley <james.hartley@imgtec.com>
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
上级 0e59378b
...@@ -534,6 +534,7 @@ static void img_i2c_read_fifo(struct img_i2c *i2c) ...@@ -534,6 +534,7 @@ static void img_i2c_read_fifo(struct img_i2c *i2c)
u32 fifo_status; u32 fifo_status;
u8 data; u8 data;
img_i2c_wr_rd_fence(i2c);
fifo_status = img_i2c_readl(i2c, SCB_FIFO_STATUS_REG); fifo_status = img_i2c_readl(i2c, SCB_FIFO_STATUS_REG);
if (fifo_status & FIFO_READ_EMPTY) if (fifo_status & FIFO_READ_EMPTY)
break; break;
...@@ -542,7 +543,6 @@ static void img_i2c_read_fifo(struct img_i2c *i2c) ...@@ -542,7 +543,6 @@ static void img_i2c_read_fifo(struct img_i2c *i2c)
*i2c->msg.buf = data; *i2c->msg.buf = data;
img_i2c_writel(i2c, SCB_READ_FIFO_REG, 0xff); img_i2c_writel(i2c, SCB_READ_FIFO_REG, 0xff);
img_i2c_wr_rd_fence(i2c);
i2c->msg.len--; i2c->msg.len--;
i2c->msg.buf++; i2c->msg.buf++;
} }
...@@ -554,12 +554,12 @@ static void img_i2c_write_fifo(struct img_i2c *i2c) ...@@ -554,12 +554,12 @@ static void img_i2c_write_fifo(struct img_i2c *i2c)
while (i2c->msg.len) { while (i2c->msg.len) {
u32 fifo_status; u32 fifo_status;
img_i2c_wr_rd_fence(i2c);
fifo_status = img_i2c_readl(i2c, SCB_FIFO_STATUS_REG); fifo_status = img_i2c_readl(i2c, SCB_FIFO_STATUS_REG);
if (fifo_status & FIFO_WRITE_FULL) if (fifo_status & FIFO_WRITE_FULL)
break; break;
img_i2c_writel(i2c, SCB_WRITE_DATA_REG, *i2c->msg.buf); img_i2c_writel(i2c, SCB_WRITE_DATA_REG, *i2c->msg.buf);
img_i2c_wr_rd_fence(i2c);
i2c->msg.len--; i2c->msg.len--;
i2c->msg.buf++; i2c->msg.buf++;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册