diff options
author | Sifan Naeem <sifan.naeem@imgtec.com> | 2015-11-19 04:35:15 -0500 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2016-01-02 16:04:30 -0500 |
commit | dd29207e6ccf6ae705dc01c6db73f3a8cb641400 (patch) | |
tree | 13dccb4768eb5ed1ad05ad812b93096ece7b2c85 | |
parent | a8c5a8d8c9caa150f0e1faab3884ba48d9cd99fe (diff) |
i2c: img-scb: add handle for stop detected interrupt
Stop Detected interrupt is triggered when a Stop bit is detected on
the bus, which indicates the end of the current transfer.
When the end of a transfer is indicated by the Stop Detected interrupt,
drain the FIFO and signal completion for the transaction.
Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r-- | drivers/i2c/busses/i2c-img-scb.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c index 0af554a16ae5..f416010a0b49 100644 --- a/drivers/i2c/busses/i2c-img-scb.c +++ b/drivers/i2c/busses/i2c-img-scb.c | |||
@@ -152,6 +152,7 @@ | |||
152 | #define INT_TRANSACTION_DONE BIT(15) | 152 | #define INT_TRANSACTION_DONE BIT(15) |
153 | #define INT_SLAVE_EVENT BIT(16) | 153 | #define INT_SLAVE_EVENT BIT(16) |
154 | #define INT_TIMING BIT(18) | 154 | #define INT_TIMING BIT(18) |
155 | #define INT_STOP_DETECTED BIT(19) | ||
155 | 156 | ||
156 | #define INT_FIFO_FULL_FILLING (INT_FIFO_FULL | INT_FIFO_FILLING) | 157 | #define INT_FIFO_FULL_FILLING (INT_FIFO_FULL | INT_FIFO_FILLING) |
157 | 158 | ||
@@ -175,7 +176,8 @@ | |||
175 | INT_WRITE_ACK_ERR | \ | 176 | INT_WRITE_ACK_ERR | \ |
176 | INT_FIFO_FULL | \ | 177 | INT_FIFO_FULL | \ |
177 | INT_FIFO_FILLING | \ | 178 | INT_FIFO_FILLING | \ |
178 | INT_FIFO_EMPTY) | 179 | INT_FIFO_EMPTY | \ |
180 | INT_STOP_DETECTED) | ||
179 | 181 | ||
180 | #define INT_ENABLE_MASK_WAITSTOP (INT_SLAVE_EVENT | \ | 182 | #define INT_ENABLE_MASK_WAITSTOP (INT_SLAVE_EVENT | \ |
181 | INT_ADDR_ACK_ERR | \ | 183 | INT_ADDR_ACK_ERR | \ |
@@ -865,6 +867,13 @@ static unsigned int img_i2c_auto(struct img_i2c *i2c, | |||
865 | 867 | ||
866 | mod_timer(&i2c->check_timer, jiffies + msecs_to_jiffies(1)); | 868 | mod_timer(&i2c->check_timer, jiffies + msecs_to_jiffies(1)); |
867 | 869 | ||
870 | if (int_status & INT_STOP_DETECTED) { | ||
871 | /* Drain remaining data in FIFO and complete transaction */ | ||
872 | if (i2c->msg.flags & I2C_M_RD) | ||
873 | img_i2c_read_fifo(i2c); | ||
874 | return ISR_COMPLETE(0); | ||
875 | } | ||
876 | |||
868 | if (i2c->msg.flags & I2C_M_RD) { | 877 | if (i2c->msg.flags & I2C_M_RD) { |
869 | if (int_status & INT_FIFO_FULL_FILLING) { | 878 | if (int_status & INT_FIFO_FULL_FILLING) { |
870 | img_i2c_read_fifo(i2c); | 879 | img_i2c_read_fifo(i2c); |