Skip to contentSkip to conversation

mxc i2c: let time to generate stop bit

PATCH In review Valentin Longchamp 2 participants 4 messages Jan 21, 2010 3 messages not in the archive

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

PATCH 1/1 mxc i2c: let time to generate stop bit

After generating the stop bit by changing MSTA from 1 to 0, the i2c_imx->stopped was immediatly set to 1. The second test on i2c_imx->stopped then is correct and the controller never waits if the bus is busy. This patch corrects this.

On mx31moboard, stop bit was not generated on single write transfers. This was kept unnoticed other transfers are made afterwards that help the write recipient to resynchronize.

Thanks to Philippe and Michael for the debugging.

---
 drivers/i2c/busses/i2c-imx.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-imx.c +3 -2
index e3654d6..602b30e 100644
@@ -226,7 +226,6 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
 		temp = readb(i2c_imx->base + IMX_I2C_I2CR);
 		temp &= ~(I2CR_MSTA | I2CR_MTX);
 		writeb(temp, i2c_imx->base + IMX_I2C_I2CR);
-		i2c_imx->stopped = 1;
 	}
 	if (cpu_is_mx1()) {
 		/*
@@ -236,8 +235,10 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
 		udelay(i2c_imx->disable_delay);
 	}
 
-	if (!i2c_imx->stopped)
+	if (!i2c_imx->stopped) {
 		i2c_imx_bus_busy(i2c_imx, 0);
+		i2c_imx->stopped = 1;
+	}
 
 	/* Disable I2C controller */
 	writeb(0, i2c_imx->base + IMX_I2C_I2CR);
Signature · 1 line
1.6.3.3
Acked-by
#2 lore raw
In reply to a message not in the archive
Quoted 8 lines · Valentin Longchamp

After generating the stop bit by changing MSTA from 1 to 0, the i2c_imx->stopped was immediatly set to 1. The second test on i2c_imx->stopped then is correct and the controller never waits if the bus is busy. This patch corrects this.

On mx31moboard, stop bit was not generated on single write transfers. This was kept unnoticed other transfers are made afterwards that help the write recipient to resynchronize.

"as other transfers"?

Quoted 1 line

Thanks to Philippe and Michael for the debugging.

Either full names, or maybe even Reported-by or Tested-by tags?

Quoted 1 line

Patch itself looks good to me:

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#4 lore raw

PATCH 1/1 mxc i2c: let time to generate stop bit

In reply to a message not in the archive

After generating the stop bit by changing MSTA from 1 to 0, the i2c_imx->stopped was immediatly set to 1. The second test on i2c_imx->stopped then is correct and the controller never waits if the bus is busy. This patch corrects this.

On mx31moboard, stop bit was not generated on single write transfers. This was kept unnoticed as other transfers are made afterwards that help the write recipient to resynchronize.

Thanks to Philippe and Michael for the debugging.

Signed-off by: Philippe Rétornaz <[email protected]>

---
 drivers/i2c/busses/i2c-imx.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-imx.c +3 -2
index e3654d6..602b30e 100644
@@ -226,7 +226,6 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
 		temp = readb(i2c_imx->base + IMX_I2C_I2CR);
 		temp &= ~(I2CR_MSTA | I2CR_MTX);
 		writeb(temp, i2c_imx->base + IMX_I2C_I2CR);
-		i2c_imx->stopped = 1;
 	}
 	if (cpu_is_mx1()) {
 		/*
@@ -236,8 +235,10 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
 		udelay(i2c_imx->disable_delay);
 	}
 
-	if (!i2c_imx->stopped)
+	if (!i2c_imx->stopped) {
 		i2c_imx_bus_busy(i2c_imx, 0);
+		i2c_imx->stopped = 1;
+	}
 
 	/* Disable I2C controller */
 	writeb(0, i2c_imx->base + IMX_I2C_I2CR);
Signature · 1 line
1.6.3.3
Acked-by
#6 lore raw
In reply to a message not in the archive
Quoted 9 lines · Valentin Longchamp

After generating the stop bit by changing MSTA from 1 to 0, the i2c_imx->stopped was immediatly set to 1. The second test on i2c_imx->stopped then is correct and the controller never waits if the bus is busy. This patch corrects this.

On mx31moboard, stop bit was not generated on single write transfers. This was kept unnoticed as other transfers are made afterwards that help the write recipient to resynchronize.

Quoted 5 lines

Thanks to Philippe and Michael for the debugging.

Signed-off by: Philippe Rétornaz <[email protected]>

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |