Skip to contentSkip to conversation

OMAP: Don't write IE state in unidle if 0

PATCH In review Cory Maccarrone 2 participants 2 messages Dec 23, 2009 – Dec 28, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP: Don't write IE state in unidle if 0

Commit ef871432... (i2c-omap: OMAP3: PM: (re)init for every transfer to support off-mode) introduced a change which make the dev->iestate contents be written to the OMAP_I2C_IE_REG every time omap_i2c_unidle is called. Previously, the state was only written if it wasn't equal to zero.

In omap_i2c_probe, omap_i2c_unidle() is called prior to omap_i2c_init(), in which case dev->iestate has not yet been initialized and will be set to zero. Having this value written to the registers causes deadlock while booting.

As such, this change restores the original functionality.

---
 drivers/i2c/busses/i2c-omap.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-omap.c +7 -1
index 3440d88..c0bb9eb 100644
@@ -248,7 +248,13 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev)
 		omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
 	}
 	dev->idle = 0;
-	omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
+
+	/*
+	 * Don't write to this register if the IE state is 0 as it can
+	 * cause deadlock.
+	 */
+	if (dev->iestate)
+		omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
 }
 
 static void omap_i2c_idle(struct omap_i2c_dev *dev)
Signature · 1 line
1.6.3.3
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Cory Maccarrone

Commit ef871432... (i2c-omap: OMAP3: PM: (re)init for every transfer to support off-mode) introduced a change which make the dev->iestate contents be written to the OMAP_I2C_IE_REG every time omap_i2c_unidle is called. Previously, the state was only written if it wasn't equal to zero.

Quoted 6 lines

In omap_i2c_probe, omap_i2c_unidle() is called prior to omap_i2c_init(), in which case dev->iestate has not yet been initialized and will be set to zero. Having this value written to the registers causes deadlock while booting.

As such, this change restores the original functionality.

Looks like initializing dev->iestate to something before calling omap_i2c_unidle in omap_i2c_probe is not an option in this case. We'd want to initialize it to zero, which causes the deadlock..

Quoted 32 lines
---
 drivers/i2c/busses/i2c-omap.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-omap.c +7 -1
index 3440d88..c0bb9eb 100644
@@ -248,7 +248,13 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev)
 		omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
 	}
 	dev->idle = 0;
-	omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
+
+	/*
+	 * Don't write to this register if the IE state is 0 as it can
+	 * cause deadlock.
+	 */
+	if (dev->iestate)
+		omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
 }
 
 static void omap_i2c_idle(struct omap_i2c_dev *dev)
Signature · 6 lines
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html