From: Ray Jui <rjui@broadcom.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: <linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<bcm-kernel-feedback-list@broadcom.com>,
Icarus Chau <ichau@broadcom.com>, Ray Jui <rjui@broadcom.com>
Subject: [PATCH 1/3] i2c: iproc: Add recovery mechanism in error case
Date: Wed, 27 Jan 2016 16:27:20 -0800 [thread overview]
Message-ID: <1453940842-9658-2-git-send-email-rjui@broadcom.com> (raw)
In-Reply-To: <1453940842-9658-1-git-send-email-rjui@broadcom.com>
Add proper recovery mechanism to the iProc I2C driver in error cases
Signed-off-by: Icarus Chau <ichau@broadcom.com>
Signed-off-by: Ray Jui <rjui@broadcom.com>
Tested-by: Icarus Chau <ichau@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
---
drivers/i2c/busses/i2c-bcm-iproc.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c
index 0419f52..99261cc 100644
--- a/drivers/i2c/busses/i2c-bcm-iproc.c
+++ b/drivers/i2c/busses/i2c-bcm-iproc.c
@@ -102,6 +102,10 @@ struct bcm_iproc_i2c_dev {
*/
#define ISR_MASK (1 << IS_M_START_BUSY_SHIFT)
+static int bcm_iproc_i2c_init(struct bcm_iproc_i2c_dev *iproc_i2c);
+static void bcm_iproc_i2c_enable_disable(struct bcm_iproc_i2c_dev *iproc_i2c,
+ bool enable);
+
static irqreturn_t bcm_iproc_i2c_isr(int irq, void *data)
{
struct bcm_iproc_i2c_dev *iproc_i2c = data;
@@ -149,6 +153,12 @@ static int bcm_iproc_i2c_check_status(struct bcm_iproc_i2c_dev *iproc_i2c,
default:
dev_dbg(iproc_i2c->device, "unknown error code=%d\n", val);
+
+ /* re-initialize i2c for recovery */
+ bcm_iproc_i2c_enable_disable(iproc_i2c, false);
+ bcm_iproc_i2c_init(iproc_i2c);
+ bcm_iproc_i2c_enable_disable(iproc_i2c, true);
+
return -EIO;
}
}
--
1.9.1
next prev parent reply other threads:[~2016-01-28 0:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-28 0:27 [PATCH 0/3] iProc I2C driver enhancement Ray Jui
2016-01-28 0:27 ` Ray Jui [this message]
2016-02-12 19:31 ` [PATCH 1/3] i2c: iproc: Add recovery mechanism in error case Wolfram Sang
2016-02-12 19:32 ` Ray Jui
2016-01-28 0:27 ` [PATCH 2/3] i2c: iproc: Fix typo in the driver Ray Jui
2016-01-28 0:27 ` [PATCH 3/3] i2c: iproc: Support larger TX transfer Ray Jui
2016-02-12 19:33 ` Wolfram Sang
2016-02-12 19:33 ` Ray Jui
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=1453940842-9658-2-git-send-email-rjui@broadcom.com \
--to=rjui@broadcom.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=ichau@broadcom.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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).