summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJan Glauber <jglauber@cavium.com>2016-04-26 16:26:52 +0200
committerWolfram Sang <wsa@the-dreams.de>2016-04-26 23:02:47 +0200
commit392d01de2d2476e8a50cf30f049e369deaaea127 (patch)
tree6cef3ad55c638a68599e3cccd194bedc7ecd1d35 /drivers/i2c
parenti2c: s3c2410: Check clk_prepare_enable() return value (diff)
downloadlinux-392d01de2d2476e8a50cf30f049e369deaaea127.tar.xz
linux-392d01de2d2476e8a50cf30f049e369deaaea127.zip
i2c: octeon: Remove zero-length message support
Zero-length message support (SMBUS QUICK or i2c) never worked with the Octeon hardware. Disable SMBUS QUICK support and bail out in case of a zero-length i2c request. After this change 'i2c-detect -q' will return an error on Octeon but the previously reported results were wrong anyway. Signed-off-by: Jan Glauber <jglauber@cavium.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-octeon.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
index 6a4f0581a7e0..4fc471ce173e 100644
--- a/drivers/i2c/busses/i2c-octeon.c
+++ b/drivers/i2c/busses/i2c-octeon.c
@@ -838,9 +838,6 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target,
int i, result, length = *rlength;
bool final_read = false;
- if (length < 1)
- return -EINVAL;
-
octeon_i2c_data_write(i2c, (target << 1) | 1);
octeon_i2c_ctl_write(i2c, TWSI_CTL_ENAB);
@@ -926,6 +923,12 @@ static int octeon_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
for (i = 0; ret == 0 && i < num; i++) {
struct i2c_msg *pmsg = &msgs[i];
+ /* zero-length messages are not supported */
+ if (!pmsg->len) {
+ ret = -EOPNOTSUPP;
+ break;
+ }
+
ret = octeon_i2c_start(i2c);
if (ret)
return ret;
@@ -999,7 +1002,7 @@ static struct i2c_bus_recovery_info octeon_i2c_recovery_info = {
static u32 octeon_i2c_functionality(struct i2c_adapter *adap)
{
- return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL |
+ return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK) |
I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_SMBUS_BLOCK_PROC_CALL;
}