summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorPeter Swain <pswain@cavium.com>2016-04-25 16:33:33 +0200
committerWolfram Sang <wsa@the-dreams.de>2016-04-25 23:33:16 +0200
commit30c24b25142a9171d38e8074758b3a370906fc7d (patch)
treeaed646b04d769d4c1f7f79c2defbf9892120469b /drivers/i2c
parentc981e34eee146fe560c46704396342ff979346d7 (diff)
downloadlinux-30c24b25142a9171d38e8074758b3a370906fc7d.tar.gz
linux-30c24b25142a9171d38e8074758b3a370906fc7d.tar.bz2
linux-30c24b25142a9171d38e8074758b3a370906fc7d.zip
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: Peter Swain <pswain@cavium.com> Signed-off-by: Jan Glauber <jglauber@cavium.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-octeon.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
index f83f6b8892b5..08ca66505ce2 100644
--- a/drivers/i2c/busses/i2c-octeon.c
+++ b/drivers/i2c/busses/i2c-octeon.c
@@ -103,6 +103,12 @@ struct octeon_i2c {
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
* @i2c: The struct octeon_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)
{
- __raw_writeq(data, i2c->twsi_base + TWSI_INT);
- __raw_readq(i2c->twsi_base + TWSI_INT);
+ octeon_i2c_writeq_flush(data, i2c->twsi_base + TWSI_INT);
}
/**