From: Jan Glauber <jglauber@cavium.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
David Daney <ddaney@caviumnetworks.com>,
Peter Swain <pswain@cavium.com>,
Jan Glauber <jglauber@cavium.com>
Subject: [PATCH v3 09/14] i2c-octeon: Flush TWSI writes with readback
Date: Mon, 7 Mar 2016 16:10:52 +0100 [thread overview]
Message-ID: <b12605dbe864ee6302d0c112d2fad11e0b206427.1457362545.git.jglauber@cavium.com> (raw)
In-Reply-To: <cover.1457362545.git.jglauber@cavium.com>
In-Reply-To: <cover.1457362545.git.jglauber@cavium.com>
From: Peter Swain <pswain@cavium.com>
Signed-off-by: Peter Swain <pswain@cavium.com>
Signed-off-by: Jan Glauber <jglauber@cavium.com>
Acked-by: David Daney <ddaney@caviumnetworks.com>
---
drivers/i2c/busses/i2c-octeon.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
index b76ccd5..a8a56a0 100644
--- a/drivers/i2c/busses/i2c-octeon.c
+++ b/drivers/i2c/busses/i2c-octeon.c
@@ -126,6 +126,12 @@ static int timeout = 2;
module_param(timeout, int, 0444);
MODULE_PARM_DESC(timeout, "Low-level device timeout (ms)");
+static void writeqflush(u64 val, void __iomem *addr)
+{
+ __raw_writeq(val, addr);
+ __raw_readq(addr); /* wait for write to land */
+}
+
/**
* octeon_i2c_write_sw - write an I2C core register
* @i2c: The struct octeon_i2c
@@ -186,8 +192,7 @@ static u8 octeon_i2c_read_sw(struct octeon_i2c *i2c, u64 eop_reg)
*/
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);
+ writeqflush(data, i2c->twsi_base + TWSI_INT);
}
/**
@@ -573,10 +578,10 @@ static int octeon_i2c_simple_write(struct octeon_i2c *i2c, struct i2c_msg *msgs)
for (i = 0; i < msgs[0].len - 4 && i < 4; i++, j--)
ext |= (u64) msgs[0].buf[j] << (8 * i);
- __raw_writeq(ext, i2c->twsi_base + SW_TWSI_EXT);
+ writeqflush(ext, i2c->twsi_base + SW_TWSI_EXT);
}
- __raw_writeq(cmd, i2c->twsi_base + SW_TWSI);
+ writeqflush(cmd, i2c->twsi_base + SW_TWSI);
ret = octeon_i2c_hlc_wait(i2c);
if (ret)
@@ -622,7 +627,7 @@ static int octeon_i2c_ia_read(struct octeon_i2c *i2c, struct i2c_msg *msgs)
cmd |= (u64) msgs[0].buf[0] << SW_TWSI_IA_SHIFT;
octeon_i2c_hlc_int_clear(i2c);
- __raw_writeq(cmd, i2c->twsi_base + SW_TWSI);
+ writeqflush(cmd, i2c->twsi_base + SW_TWSI);
ret = octeon_i2c_hlc_wait(i2c);
if (ret)
@@ -682,10 +687,10 @@ static int octeon_i2c_ia_write(struct octeon_i2c *i2c, struct i2c_msg *msgs)
set_ext = true;
}
if (set_ext)
- __raw_writeq(ext, i2c->twsi_base + SW_TWSI_EXT);
+ writeqflush(ext, i2c->twsi_base + SW_TWSI_EXT);
octeon_i2c_hlc_int_clear(i2c);
- __raw_writeq(cmd, i2c->twsi_base + SW_TWSI);
+ writeqflush(cmd, i2c->twsi_base + SW_TWSI);
ret = octeon_i2c_hlc_wait(i2c);
if (ret)
--
1.9.1
next prev parent reply other threads:[~2016-03-07 15:13 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-07 15:10 [PATCH v3 00/14] i2c-octeon and i2c-thunderx drivers Jan Glauber
2016-03-07 15:10 ` [PATCH v3 01/14] i2c-octeon: Cleanup kerneldoc comments Jan Glauber
2016-03-12 15:35 ` Wolfram Sang
2016-03-07 15:10 ` [PATCH v3 02/14] i2c-octeon: Cleanup i2c-octeon driver Jan Glauber
2016-03-12 15:35 ` Wolfram Sang
2016-03-14 8:52 ` Jan Glauber
2016-03-07 15:10 ` [PATCH v3 03/14] i2c-octeon: Cleanup resource allocation code Jan Glauber
2016-03-12 15:37 ` Wolfram Sang
2016-03-14 9:21 ` Jan Glauber
2016-03-07 15:10 ` [PATCH v3 04/14] i2c-octeon: Support I2C_M_RECV_LEN Jan Glauber
2016-03-12 15:44 ` Wolfram Sang
2016-03-07 15:10 ` [PATCH v3 05/14] i2c-octeon: Make adapter timeout tunable Jan Glauber
2016-03-12 15:46 ` Wolfram Sang
2016-03-14 12:45 ` Jan Glauber
2016-03-14 17:21 ` Swain, Peter
2016-03-07 15:10 ` [PATCH v3 06/14] i2c-octeon: Enable high-level controller and improve on bus contention Jan Glauber
2016-03-07 15:10 ` [PATCH v3 07/14] dt-bindings: i2c: Add Octeon cn78xx TWSI Jan Glauber
2016-03-07 15:10 ` [PATCH v3 08/14] i2c-octeon: Add support for cn78XX chips Jan Glauber
2016-03-07 15:10 ` Jan Glauber [this message]
2016-03-07 15:10 ` [PATCH v3 10/14] i2c-octeon: Faster operation when IFLG signals late Jan Glauber
2016-03-07 15:10 ` [PATCH v3 11/14] i2c-octeon: Add workaround for broken irqs on CN3860 Jan Glauber
2016-03-07 15:10 ` [PATCH v3 12/14] i2c-octeon: Split the driver into two parts Jan Glauber
2016-03-07 15:10 ` [PATCH v3 13/14] i2c-thunderx: Add i2c driver for ThunderX SOC Jan Glauber
2016-03-07 15:10 ` [PATCH v3 14/14] i2c-thunderx: Add smbus support Jan Glauber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b12605dbe864ee6302d0c112d2fad11e0b206427.1457362545.git.jglauber@cavium.com \
--to=jglauber@cavium.com \
--cc=ddaney@caviumnetworks.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pswain@cavium.com \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).