1 From b9607c9083b767eac26df1d39a030f3cba5d3ae3 Mon Sep 17 00:00:00 2001
2 From: Kurt Mahan <kmahan@freescale.com>
3 Date: Fri, 18 Jul 2008 12:40:04 -0600
4 Subject: [PATCH] Increase timeouts on I2C bus.
6 LTIBName: m547x-8x-i2c-timeout-fix
7 Signed-off-by: Shrek Wu <b16972@freescale.com>
9 drivers/i2c/busses/i2c-mcf548x.c | 40 +++++++++++++++++++++++++++++--------
10 1 files changed, 31 insertions(+), 9 deletions(-)
12 --- a/drivers/i2c/busses/i2c-mcf548x.c
13 +++ b/drivers/i2c/busses/i2c-mcf548x.c
14 @@ -43,8 +43,8 @@ static struct i2c_adapter i2c_mcf_board_
16 .algo_data = &i2c_mcf_board_data,
17 .class = I2C_CLASS_HWMON,
24 * static void i2c_start()
25 @@ -105,7 +105,7 @@ wait_for_bb(
26 for (i = 0; i < adap->timeout; i++) {
27 if (!(MCF_I2SR & MCF_I2SR_IBB))
32 printk(KERN_ERR "%s: timeout", __FUNCTION__);
34 @@ -124,7 +124,7 @@ wait_for_not_bb(
35 for (i = 0; i < adap->timeout; i++) {
36 if (MCF_I2SR & MCF_I2SR_IBB)
41 printk(KERN_ERR "%s: timeout", __FUNCTION__);
43 @@ -146,7 +146,7 @@ wait_xfer_done(
44 MCF_I2SR &= ~MCF_I2SR_IIF;
50 printk(KERN_ERR "%s: timeout", __FUNCTION__);
52 @@ -166,7 +166,7 @@ i2c_set_addr(
54 unsigned short flags = msg->flags;
57 + MCF_I2CR |= MCF_I2CR_MTX;
58 if ((flags & I2C_M_TEN)) {
59 /* 10 bit address not supported yet */
61 @@ -269,7 +269,7 @@ mcf_sendbytes(
66 + /* i2c_repstart(adap);*/
70 @@ -330,7 +330,7 @@ mcf_readbytes(
75 + /* i2c_repstart(adap);*/
79 @@ -380,6 +380,27 @@ mcf_xfer(
82 for (i = 0; ret >= 0 && i < num; i++) {
83 + if (MCF_I2SR & MCF_I2SR_IBB) {
92 + /* setup SCL clock */
93 + MCF_I2FDR = get_clock(adap);
94 + /* set slave address */
95 + MCF_I2AR = get_own(adap);
96 + /* enable I2C module */
97 + MCF_I2CR = MCF_I2CR_IEN;
99 + MCF_I2CR |= MCF_I2CR_TXAK;
101 + /* Check for bus busy */
106 printk(KERN_DEBUG "i2c-algo-mcf: Doing %s %d bytes "
107 @@ -388,7 +409,7 @@ mcf_xfer(
108 pmsg->len, pmsg->addr, i + 1, num);
115 /* Wait for Bus Busy */
116 @@ -440,6 +461,7 @@ mcf_xfer(
123 /* Disable I2C module */