diff options
author | Petr Cvek <petr.cvek@tul.cz> | 2014-11-25 00:05:33 -0500 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2014-11-25 15:32:26 -0500 |
commit | 86261fdd65ce076c0aa05dbf3f5f5fe10aab1bcf (patch) | |
tree | 3609f7232e78bb31b17ec103533628502d205e85 /drivers/i2c/busses/i2c-pxa.c | |
parent | 23173eae7b9a5389d3f7031b77cde34f63b814a2 (diff) |
i2c: pxa: add support for SCCB devices
Add support for SCCB by implementing I2C_M_IGNORE_NAK and I2C_M_STOP
flags and advertising functionality flag I2C_FUNC_PROTOCOL_MANGLING.
Also fixed missing functionality flag I2C_FUNC_NOSTART.
Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-pxa.c')
-rw-r--r-- | drivers/i2c/busses/i2c-pxa.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index be671f7a0e06..f80df8f84609 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -885,7 +885,9 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr) | |||
885 | return; /* ignore */ | 885 | return; /* ignore */ |
886 | } | 886 | } |
887 | 887 | ||
888 | if (isr & ISR_BED) { | 888 | if ((isr & ISR_BED) && |
889 | (!((i2c->msg->flags & I2C_M_IGNORE_NAK) && | ||
890 | (isr & ISR_ACKNAK)))) { | ||
889 | int ret = BUS_ERROR; | 891 | int ret = BUS_ERROR; |
890 | 892 | ||
891 | /* | 893 | /* |
@@ -919,12 +921,14 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr) | |||
919 | icr |= ICR_ALDIE | ICR_TB; | 921 | icr |= ICR_ALDIE | ICR_TB; |
920 | 922 | ||
921 | /* | 923 | /* |
922 | * If this is the last byte of the last message, send | 924 | * If this is the last byte of the last message or last byte |
923 | * a STOP. | 925 | * of any message with I2C_M_STOP (e.g. SCCB), send a STOP. |
924 | */ | 926 | */ |
925 | if (i2c->msg_ptr == i2c->msg->len && | 927 | if ((i2c->msg_ptr == i2c->msg->len) && |
926 | i2c->msg_idx == i2c->msg_num - 1) | 928 | ((i2c->msg->flags & I2C_M_STOP) || |
927 | icr |= ICR_STOP; | 929 | (i2c->msg_idx == i2c->msg_num - 1))) |
930 | icr |= ICR_STOP; | ||
931 | |||
928 | } else if (i2c->msg_idx < i2c->msg_num - 1) { | 932 | } else if (i2c->msg_idx < i2c->msg_num - 1) { |
929 | /* | 933 | /* |
930 | * Next segment of the message. | 934 | * Next segment of the message. |
@@ -1071,7 +1075,8 @@ static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num | |||
1071 | 1075 | ||
1072 | static u32 i2c_pxa_functionality(struct i2c_adapter *adap) | 1076 | static u32 i2c_pxa_functionality(struct i2c_adapter *adap) |
1073 | { | 1077 | { |
1074 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | 1078 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | |
1079 | I2C_FUNC_PROTOCOL_MANGLING | I2C_FUNC_NOSTART; | ||
1075 | } | 1080 | } |
1076 | 1081 | ||
1077 | static const struct i2c_algorithm i2c_pxa_algorithm = { | 1082 | static const struct i2c_algorithm i2c_pxa_algorithm = { |