aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorSonic Zhang <sonic.zhang@analog.com>2009-05-19 07:21:58 -0400
committerBen Dooks <ben-linux@fluff.org>2009-06-13 05:39:25 -0400
commit57a8f32eafa6f36ea3a128e8b13f353c5a3ca9b2 (patch)
treeaf1aaed68c8049c345ca6bfa2b13b66efb73e8a2 /drivers/i2c
parent9528d1c7a541b481a0e80301dc8d545848104023 (diff)
i2c: Blackfin TWI: fix REPEAT START mode doesn't repeat
Avoid rewrite TWI MASTER_CTL reg when issue next message In i2c repeat transfer mode, byte count of next message should be filled into part of the TWI MASTER_CTL reg when interrupt MCOMP of last message transfer is triggered. But, other bits in this reg should not be touched. Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Bryan Wu <cooloney@kernel.org> [ben-linux@fluff.org: shorted subject] Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-bfin-twi.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
index 77cafb6ba923..4d73ad7b5703 100644
--- a/drivers/i2c/busses/i2c-bfin-twi.c
+++ b/drivers/i2c/busses/i2c-bfin-twi.c
@@ -196,8 +196,6 @@ static void bfin_twi_handle_interrupt(struct bfin_twi_iface *iface)
196 /* remove restart bit and enable master receive */ 196 /* remove restart bit and enable master receive */
197 write_MASTER_CTL(iface, 197 write_MASTER_CTL(iface,
198 read_MASTER_CTL(iface) & ~RSTART); 198 read_MASTER_CTL(iface) & ~RSTART);
199 write_MASTER_CTL(iface,
200 read_MASTER_CTL(iface) | MEN | MDIR);
201 SSYNC(); 199 SSYNC();
202 } else if (iface->cur_mode == TWI_I2C_MODE_REPEAT && 200 } else if (iface->cur_mode == TWI_I2C_MODE_REPEAT &&
203 iface->cur_msg+1 < iface->msg_num) { 201 iface->cur_msg+1 < iface->msg_num) {
@@ -222,18 +220,19 @@ static void bfin_twi_handle_interrupt(struct bfin_twi_iface *iface)
222 } 220 }
223 221
224 if (iface->pmsg[iface->cur_msg].len <= 255) 222 if (iface->pmsg[iface->cur_msg].len <= 255)
225 write_MASTER_CTL(iface, 223 write_MASTER_CTL(iface,
226 iface->pmsg[iface->cur_msg].len << 6); 224 (read_MASTER_CTL(iface) &
225 (~(0xff << 6))) |
226 (iface->pmsg[iface->cur_msg].len << 6));
227 else { 227 else {
228 write_MASTER_CTL(iface, 0xff << 6); 228 write_MASTER_CTL(iface,
229 (read_MASTER_CTL(iface) |
230 (0xff << 6)));
229 iface->manual_stop = 1; 231 iface->manual_stop = 1;
230 } 232 }
231 /* remove restart bit and enable master receive */ 233 /* remove restart bit and enable master receive */
232 write_MASTER_CTL(iface, 234 write_MASTER_CTL(iface,
233 read_MASTER_CTL(iface) & ~RSTART); 235 read_MASTER_CTL(iface) & ~RSTART);
234 write_MASTER_CTL(iface, read_MASTER_CTL(iface) |
235 MEN | ((iface->read_write == I2C_SMBUS_READ) ?
236 MDIR : 0));
237 SSYNC(); 236 SSYNC();
238 } else { 237 } else {
239 iface->result = 1; 238 iface->result = 1;