LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linaro.org>
To: wsa@the-dreams.de
Cc: broonie@kernel.org, baolin.wang@linaro.org,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] i2c: sprd: Fix the i2c count issue
Date: Mon, 9 Apr 2018 14:40:55 +0800 [thread overview]
Message-ID: <e42cc3e001d612e811166b8d21f44802ff20069e.1523255712.git.baolin.wang@linaro.org> (raw)
In-Reply-To: <99031524fa147e72451d26f54b24f36093c0d3fa.1523255712.git.baolin.wang@linaro.org>
In-Reply-To: <99031524fa147e72451d26f54b24f36093c0d3fa.1523255712.git.baolin.wang@linaro.org>
We found the I2C controller count register is unreliable sometimes,
that will cause I2C to lose data. Thus we can read the data count
from 'i2c_dev->count' instead of the I2C controller count register.
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
drivers/i2c/busses/i2c-sprd.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c
index 2fdad63..4053259 100644
--- a/drivers/i2c/busses/i2c-sprd.c
+++ b/drivers/i2c/busses/i2c-sprd.c
@@ -368,13 +368,12 @@ static irqreturn_t sprd_i2c_isr_thread(int irq, void *dev_id)
struct sprd_i2c *i2c_dev = dev_id;
struct i2c_msg *msg = i2c_dev->msg;
bool ack = !(readl(i2c_dev->base + I2C_STATUS) & I2C_RX_ACK);
- u32 i2c_count = readl(i2c_dev->base + I2C_COUNT);
u32 i2c_tran;
if (msg->flags & I2C_M_RD)
i2c_tran = i2c_dev->count >= I2C_FIFO_FULL_THLD;
else
- i2c_tran = i2c_count;
+ i2c_tran = i2c_dev->count;
/*
* If we got one ACK from slave when writing data, and we did not
@@ -412,14 +411,13 @@ static irqreturn_t sprd_i2c_isr(int irq, void *dev_id)
{
struct sprd_i2c *i2c_dev = dev_id;
struct i2c_msg *msg = i2c_dev->msg;
- u32 i2c_count = readl(i2c_dev->base + I2C_COUNT);
bool ack = !(readl(i2c_dev->base + I2C_STATUS) & I2C_RX_ACK);
u32 i2c_tran;
if (msg->flags & I2C_M_RD)
i2c_tran = i2c_dev->count >= I2C_FIFO_FULL_THLD;
else
- i2c_tran = i2c_count;
+ i2c_tran = i2c_dev->count;
/*
* If we did not get one ACK from slave when writing data, then we
--
1.7.9.5
next prev parent reply other threads:[~2018-04-09 6:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-09 6:40 [PATCH 1/2] i2c: sprd: Prevent i2c accesses after suspend is called Baolin Wang
2018-04-09 6:40 ` Baolin Wang [this message]
2018-04-27 12:14 ` [PATCH 2/2] i2c: sprd: Fix the i2c count issue Wolfram Sang
2018-04-09 20:56 ` [PATCH 1/2] i2c: sprd: Prevent i2c accesses after suspend is called Grygorii Strashko
2018-04-10 8:08 ` Baolin Wang
2018-04-27 12:14 ` Wolfram Sang
2018-05-02 3:27 ` Baolin Wang
2018-05-02 5:23 ` Wolfram Sang
2018-05-02 5:48 ` Baolin Wang
2018-05-03 16:26 ` Grygorii Strashko
2018-05-04 12:24 ` I2C PM overhaul needed? (Re: [PATCH 1/2] i2c: sprd: Prevent i2c accesses after suspend is called) Wolfram Sang
2018-05-05 1:54 ` Mark Brown
2018-05-05 8:32 ` Wolfram Sang
2018-05-09 8:18 ` Mark Brown
2018-05-07 17:48 ` Grygorii Strashko
2018-05-08 16:32 ` Wolfram Sang
2018-05-08 18:31 ` Peter Rosin
2018-05-11 15:14 ` Grygorii Strashko
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=e42cc3e001d612e811166b8d21f44802ff20069e.1523255712.git.baolin.wang@linaro.org \
--to=baolin.wang@linaro.org \
--cc=broonie@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wsa@the-dreams.de \
--subject='Re: [PATCH 2/2] i2c: sprd: Fix the i2c count issue' \
/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
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).