[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1453940842-9658-2-git-send-email-rjui@broadcom.com>
Date: Wed, 27 Jan 2016 16:27:20 -0800
From: Ray Jui <rjui@...adcom.com>
To: Wolfram Sang <wsa@...-dreams.de>
CC: <linux-i2c@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<bcm-kernel-feedback-list@...adcom.com>,
Icarus Chau <ichau@...adcom.com>, Ray Jui <rjui@...adcom.com>
Subject: [PATCH 1/3] i2c: iproc: Add recovery mechanism in error case
Add proper recovery mechanism to the iProc I2C driver in error cases
Signed-off-by: Icarus Chau <ichau@...adcom.com>
Signed-off-by: Ray Jui <rjui@...adcom.com>
Tested-by: Icarus Chau <ichau@...adcom.com>
Reviewed-by: Scott Branden <sbranden@...adcom.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
Powered by blists - more mailing lists