Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Peter Swain and committed by
Wolfram Sang
30c24b25 c981e34e

+7 -2
+7 -2
drivers/i2c/busses/i2c-octeon.c
··· 103 103 struct device *dev; 104 104 }; 105 105 106 + static void octeon_i2c_writeq_flush(u64 val, void __iomem *addr) 107 + { 108 + __raw_writeq(val, addr); 109 + __raw_readq(addr); /* wait for write to land */ 110 + } 111 + 106 112 /** 107 113 * octeon_i2c_reg_write - write an I2C core register 108 114 * @i2c: The struct octeon_i2c ··· 178 172 */ 179 173 static void octeon_i2c_write_int(struct octeon_i2c *i2c, u64 data) 180 174 { 181 - __raw_writeq(data, i2c->twsi_base + TWSI_INT); 182 - __raw_readq(i2c->twsi_base + TWSI_INT); 175 + octeon_i2c_writeq_flush(data, i2c->twsi_base + TWSI_INT); 183 176 } 184 177 185 178 /**