aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2011-01-12 17:26:12 -0500
committerBen Dooks <ben-linux@fluff.org>2011-01-12 17:26:12 -0500
commitdad92924ea4c9167e64a2835ec9310c73570b10b (patch)
treeb0a0c3dfb1abb7cbab7916eeacec7dbe4dc1e021 /drivers/i2c
parentadeaf46d311715deee9ae38ef1edb0d6b6fb0d55 (diff)
parent74f56c4ad4e4627862bddb0b8c3ab394e3c004f7 (diff)
Merge branch 'for-2638/i2c/bfin2' into for-linus/i2c-2638
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-bfin-twi.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
index fb26e5c67515..52b545a795f2 100644
--- a/drivers/i2c/busses/i2c-bfin-twi.c
+++ b/drivers/i2c/busses/i2c-bfin-twi.c
@@ -20,6 +20,7 @@
20#include <linux/completion.h> 20#include <linux/completion.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/delay.h>
23 24
24#include <asm/blackfin.h> 25#include <asm/blackfin.h>
25#include <asm/portmux.h> 26#include <asm/portmux.h>
@@ -159,6 +160,27 @@ static void bfin_twi_handle_interrupt(struct bfin_twi_iface *iface,
159 if (mast_stat & BUFWRERR) 160 if (mast_stat & BUFWRERR)
160 dev_dbg(&iface->adap.dev, "Buffer Write Error\n"); 161 dev_dbg(&iface->adap.dev, "Buffer Write Error\n");
161 162
163 /* Faulty slave devices, may drive SDA low after a transfer
164 * finishes. To release the bus this code generates up to 9
165 * extra clocks until SDA is released.
166 */
167
168 if (read_MASTER_STAT(iface) & SDASEN) {
169 int cnt = 9;
170 do {
171 write_MASTER_CTL(iface, SCLOVR);
172 udelay(6);
173 write_MASTER_CTL(iface, 0);
174 udelay(6);
175 } while ((read_MASTER_STAT(iface) & SDASEN) && cnt--);
176
177 write_MASTER_CTL(iface, SDAOVR | SCLOVR);
178 udelay(6);
179 write_MASTER_CTL(iface, SDAOVR);
180 udelay(6);
181 write_MASTER_CTL(iface, 0);
182 }
183
162 /* If it is a quick transfer, only address without data, 184 /* If it is a quick transfer, only address without data,
163 * not an err, return 1. 185 * not an err, return 1.
164 */ 186 */
@@ -760,7 +782,7 @@ static void __exit i2c_bfin_twi_exit(void)
760 platform_driver_unregister(&i2c_bfin_twi_driver); 782 platform_driver_unregister(&i2c_bfin_twi_driver);
761} 783}
762 784
763module_init(i2c_bfin_twi_init); 785subsys_initcall(i2c_bfin_twi_init);
764module_exit(i2c_bfin_twi_exit); 786module_exit(i2c_bfin_twi_exit);
765 787
766MODULE_AUTHOR("Bryan Wu, Sonic Zhang"); 788MODULE_AUTHOR("Bryan Wu, Sonic Zhang");