diff options
Diffstat (limited to 'drivers/i2c/busses/i2c-bfin-twi.c')
-rw-r--r-- | drivers/i2c/busses/i2c-bfin-twi.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c index 4d73ad7b5703..40136ea7a46f 100644 --- a/drivers/i2c/busses/i2c-bfin-twi.c +++ b/drivers/i2c/busses/i2c-bfin-twi.c | |||
@@ -104,9 +104,14 @@ static void bfin_twi_handle_interrupt(struct bfin_twi_iface *iface) | |||
104 | write_MASTER_CTL(iface, | 104 | write_MASTER_CTL(iface, |
105 | read_MASTER_CTL(iface) | STOP); | 105 | read_MASTER_CTL(iface) | STOP); |
106 | else if (iface->cur_mode == TWI_I2C_MODE_REPEAT && | 106 | else if (iface->cur_mode == TWI_I2C_MODE_REPEAT && |
107 | iface->cur_msg+1 < iface->msg_num) | 107 | iface->cur_msg + 1 < iface->msg_num) { |
108 | write_MASTER_CTL(iface, | 108 | if (iface->pmsg[iface->cur_msg + 1].flags & I2C_M_RD) |
109 | read_MASTER_CTL(iface) | RSTART); | 109 | write_MASTER_CTL(iface, |
110 | read_MASTER_CTL(iface) | RSTART | MDIR); | ||
111 | else | ||
112 | write_MASTER_CTL(iface, | ||
113 | (read_MASTER_CTL(iface) | RSTART) & ~MDIR); | ||
114 | } | ||
110 | SSYNC(); | 115 | SSYNC(); |
111 | /* Clear status */ | 116 | /* Clear status */ |
112 | write_INT_STAT(iface, XMTSERV); | 117 | write_INT_STAT(iface, XMTSERV); |
@@ -134,9 +139,13 @@ static void bfin_twi_handle_interrupt(struct bfin_twi_iface *iface) | |||
134 | read_MASTER_CTL(iface) | STOP); | 139 | read_MASTER_CTL(iface) | STOP); |
135 | SSYNC(); | 140 | SSYNC(); |
136 | } else if (iface->cur_mode == TWI_I2C_MODE_REPEAT && | 141 | } else if (iface->cur_mode == TWI_I2C_MODE_REPEAT && |
137 | iface->cur_msg+1 < iface->msg_num) { | 142 | iface->cur_msg + 1 < iface->msg_num) { |
138 | write_MASTER_CTL(iface, | 143 | if (iface->pmsg[iface->cur_msg + 1].flags & I2C_M_RD) |
139 | read_MASTER_CTL(iface) | RSTART); | 144 | write_MASTER_CTL(iface, |
145 | read_MASTER_CTL(iface) | RSTART | MDIR); | ||
146 | else | ||
147 | write_MASTER_CTL(iface, | ||
148 | (read_MASTER_CTL(iface) | RSTART) & ~MDIR); | ||
140 | SSYNC(); | 149 | SSYNC(); |
141 | } | 150 | } |
142 | /* Clear interrupt source */ | 151 | /* Clear interrupt source */ |