[PATCH v2] i2c: imx: check bus for busy before signaling start condition.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Setting MSTA in I2CR signals a start condition on the bus. In a
multi-master scenario, this could clobber a transaction already in
progress.

Signed-off-by: Steven Weaver <steve@xxxxxxxxxxxxx>
---
 drivers/i2c/busses/i2c-imx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index c406700789e1..4720db608489 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -536,6 +536,9 @@ static int i2c_imx_start(struct imx_i2c_struct *i2c_imx)
 	usleep_range(50, 150);
 
 	/* Start I2C transaction */
+	result = i2c_imx_bus_busy(i2c_imx, 1);
+	if (result)
+		return result;
 	temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);
 	temp |= I2CR_MSTA;
 	imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR);
-- 
2.16.4




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux