diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-08-31 10:30:47 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2018-09-02 17:50:43 -0400 |
commit | 38f5d8d8cbb2ffa2b54315118185332329ec891c (patch) | |
tree | d62d120f08f9cae3d7357d450fcd5b55b5e27da9 | |
parent | 57361846b52bc686112da6ca5368d11210796804 (diff) |
i2c: uniphier: 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: dd6fd4a32793 ("i2c: uniphier: add UniPhier FIFO-less 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.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c index bb181b088291..454f914ae66d 100644 --- a/drivers/i2c/busses/i2c-uniphier.c +++ b/drivers/i2c/busses/i2c-uniphier.c | |||
@@ -248,11 +248,8 @@ static int uniphier_i2c_master_xfer(struct i2c_adapter *adap, | |||
248 | return ret; | 248 | return ret; |
249 | 249 | ||
250 | for (msg = msgs; msg < emsg; msg++) { | 250 | for (msg = msgs; msg < emsg; msg++) { |
251 | /* If next message is read, skip the stop condition */ | 251 | /* Emit STOP if it is the last message or I2C_M_STOP is set. */ |
252 | bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD); | 252 | bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP); |
253 | /* but, force it if I2C_M_STOP is set */ | ||
254 | if (msg->flags & I2C_M_STOP) | ||
255 | stop = true; | ||
256 | 253 | ||
257 | ret = uniphier_i2c_master_xfer_one(adap, msg, stop); | 254 | ret = uniphier_i2c_master_xfer_one(adap, msg, stop); |
258 | if (ret) | 255 | if (ret) |