aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhishek Sahu <[email protected]>2018-03-12 18:45:00 +0530
committerWolfram Sang <[email protected]>2018-03-24 13:20:41 +0100
commitf7714b4e451bdcb7918b9aad14af22684ceac638 (patch)
treed34cdca03983c9ea0496575fe312a2e25ba3dfb7
parent6f2f0f6465acbd59391c43352ff0df77df1f01db (diff)
i2c: qup: send NACK for last read sub transfers
According to I2c specification, “If a master-receiver sends a repeated START condition, it sends a not-acknowledge (A) just before the repeated START condition”. QUP v2 supports sending of NACK without stop with QUP_TAG_V2_DATARD_NACK so added the same. Signed-off-by: Abhishek Sahu <[email protected]> Reviewed-by: Austin Christ <[email protected]> Reviewed-by: Andy Gross <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
-rw-r--r--drivers/i2c/busses/i2c-qup.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index 5bb7ebe70f3c..4ebd9226dd87 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -104,6 +104,7 @@
#define QUP_TAG_V2_DATAWR 0x82
#define QUP_TAG_V2_DATAWR_STOP 0x83
#define QUP_TAG_V2_DATARD 0x85
+#define QUP_TAG_V2_DATARD_NACK 0x86
#define QUP_TAG_V2_DATARD_STOP 0x87
/* Status, Error flags */
@@ -606,7 +607,9 @@ static int qup_i2c_set_tags(u8 *tags, struct qup_i2c_dev *qup,
tags[len++] = QUP_TAG_V2_DATAWR_STOP;
} else {
if (msg->flags & I2C_M_RD)
- tags[len++] = QUP_TAG_V2_DATARD;
+ tags[len++] = qup->blk.pos == (qup->blk.count - 1) ?
+ QUP_TAG_V2_DATARD_NACK :
+ QUP_TAG_V2_DATARD;
else
tags[len++] = QUP_TAG_V2_DATAWR;
}