Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1320167 > unrolled thread

[PATCH 1/3] i2c: iproc: Add recovery mechanism in error case

Started byRay Jui <rjui@broadcom.com>
First post2016-01-28 01:30 +0100
Last post2016-01-28 01:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/3] i2c: iproc: Add recovery mechanism in error case Ray Jui <rjui@broadcom.com> - 2016-01-28 01:30 +0100

#1320167 — [PATCH 1/3] i2c: iproc: Add recovery mechanism in error case

FromRay Jui <rjui@broadcom.com>
Date2016-01-28 01:30 +0100
Subject[PATCH 1/3] i2c: iproc: Add recovery mechanism in error case
Message-ID<qVIDg-3rL-19@gated-at.bofh.it>
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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web