diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-08-31 10:30:48 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2018-09-02 17:50:43 -0400 |
commit | 4c85609b08c4761eca0a40fd7beb06bc650f252d (patch) | |
tree | de8994491e42ecc85ee6eb245566687eb14ec116 | |
parent | 38f5d8d8cbb2ffa2b54315118185332329ec891c (diff) |
i2c: uniphier-f: issue STOP only for last message or I2C_M_STOP
This driver currently emits a STOP if the next message is not
I2C_MD_RD. It should not do it because it disturbs the I2C_RDWR
ioctl, where read/write transactions are combined without STOP
between.
Issue STOP only when the message is the last one _or_ flagged with
I2C_M_STOP.
Fixes: 6a62974b667f ("i2c: uniphier_f: add UniPhier FIFO-builtin I2C driver")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r-- | drivers/i2c/busses/i2c-uniphier-f.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c index 9918bdd81619..a403e8579b65 100644 --- a/drivers/i2c/busses/i2c-uniphier-f.c +++ b/drivers/i2c/busses/i2c-uniphier-f.c | |||
@@ -401,11 +401,8 @@ static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap, | |||
401 | return ret; | 401 | return ret; |
402 | 402 | ||
403 | for (msg = msgs; msg < emsg; msg++) { | 403 | for (msg = msgs; msg < emsg; msg++) { |
404 | /* If next message is read, skip the stop condition */ | 404 | /* Emit STOP if it is the last message or I2C_M_STOP is set. */ |
405 | bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD); | 405 | bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP); |
406 | /* but, force it if I2C_M_STOP is set */ | ||
407 | if (msg->flags & I2C_M_STOP) | ||
408 | stop = true; | ||
409 | 406 | ||
410 | ret = uniphier_fi2c_master_xfer_one(adap, msg, stop); | 407 | ret = uniphier_fi2c_master_xfer_one(adap, msg, stop); |
411 | if (ret) | 408 | if (ret) |