Skip to contentSkip to conversation

i2c: rcar: bail out on zero length transfers

PATCH New Wolfram Sang 1 participant 2 messages May 5, 2014 – May 14, 2014

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

PATCH 1/1 i2c: rcar: bail out on zero length transfers

From: Wolfram Sang <[email protected]>

This hardware does not support zero length transfers. Instead, the driver does one (random) byte transfers currently with undefined results for the slaves. We now bail out.

---
 drivers/i2c/busses/i2c-rcar.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-rcar.c +9 -1
index 72a400a73cce..66c952e62f0a 100644
@@ -552,6 +552,13 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
 
 	ret = -EINVAL;
 	for (i = 0; i < num; i++) {
+
+		/* This HW can't send STOP after address phase */
+		if (msgs[i].len == 0) {
+			ret = -EOPNOTSUPP;
+			break;
+		}
+
 		/*-------------- spin lock -----------------*/
 		spin_lock_irqsave(&priv->lock, flags);
 
@@ -616,7 +623,8 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
 
 static u32 rcar_i2c_func(struct i2c_adapter *adap)
 {
-	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
+	/* This HW can't do SMBUS_QUICK and NOSTART */
+	return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
 }
 
 static const struct i2c_algorithm rcar_i2c_algo = {
Signature · 1 line
1.9.2
author Applied
#1 lore raw

PATCH 1/1 i2c: rcar: bail out on zero length transfers

Quoted 7 lines · Wolfram Sang

From: Wolfram Sang <[email protected]>

This hardware does not support zero length transfers. Instead, the driver does one (random) byte transfers currently with undefined results for the slaves. We now bail out.

Applied to for-current, thanks!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140514/832a9a59/attachment.sig>