Commit 30c24b25 authored by Peter Swain's avatar Peter Swain Committed by Wolfram Sang

i2c: octeon: Add flush writeq helper function

Add helper function that reads back a value after writing to
make sure the write is finished and use it in octeon_i2c_write_int().
Signed-off-by: default avatarPeter Swain <pswain@cavium.com>
Signed-off-by: default avatarJan Glauber <jglauber@cavium.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent c981e34e
...@@ -103,6 +103,12 @@ struct octeon_i2c { ...@@ -103,6 +103,12 @@ struct octeon_i2c {
struct device *dev; struct device *dev;
}; };
static void octeon_i2c_writeq_flush(u64 val, void __iomem *addr)
{
__raw_writeq(val, addr);
__raw_readq(addr); /* wait for write to land */
}
/** /**
* octeon_i2c_reg_write - write an I2C core register * octeon_i2c_reg_write - write an I2C core register
* @i2c: The struct octeon_i2c * @i2c: The struct octeon_i2c
...@@ -172,8 +178,7 @@ static u64 octeon_i2c_read_int(struct octeon_i2c *i2c) ...@@ -172,8 +178,7 @@ static u64 octeon_i2c_read_int(struct octeon_i2c *i2c)
*/ */
static void octeon_i2c_write_int(struct octeon_i2c *i2c, u64 data) static void octeon_i2c_write_int(struct octeon_i2c *i2c, u64 data)
{ {
__raw_writeq(data, i2c->twsi_base + TWSI_INT); octeon_i2c_writeq_flush(data, i2c->twsi_base + TWSI_INT);
__raw_readq(i2c->twsi_base + TWSI_INT);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment