diff options
author | Imre Kaloz <kaloz@openwrt.org> | 2009-06-23 21:04:37 +0000 |
---|---|---|
committer | Imre Kaloz <kaloz@openwrt.org> | 2009-06-23 21:04:37 +0000 |
commit | ec03ced5fa6eb25eee164839268b538abb965e99 (patch) | |
tree | 6d3382662fa3ad4119d3a3cda223c53949ca4894 /target/linux/coldfire/patches/088-m547x_8x_i2c_timeout_fix.patch | |
parent | 777de3a39c4b92ad53b2b9363f405d0c4c28847a (diff) | |
download | upstream-ec03ced5fa6eb25eee164839268b538abb965e99.tar.gz upstream-ec03ced5fa6eb25eee164839268b538abb965e99.tar.bz2 upstream-ec03ced5fa6eb25eee164839268b538abb965e99.zip |
use broken-out patches for the coldfire to make it easier to follow differences against the bsp
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16547 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/coldfire/patches/088-m547x_8x_i2c_timeout_fix.patch')
-rw-r--r-- | target/linux/coldfire/patches/088-m547x_8x_i2c_timeout_fix.patch | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/target/linux/coldfire/patches/088-m547x_8x_i2c_timeout_fix.patch b/target/linux/coldfire/patches/088-m547x_8x_i2c_timeout_fix.patch new file mode 100644 index 0000000000..dbc3c994bb --- /dev/null +++ b/target/linux/coldfire/patches/088-m547x_8x_i2c_timeout_fix.patch @@ -0,0 +1,123 @@ +From b9607c9083b767eac26df1d39a030f3cba5d3ae3 Mon Sep 17 00:00:00 2001 +From: Kurt Mahan <kmahan@freescale.com> +Date: Fri, 18 Jul 2008 12:40:04 -0600 +Subject: [PATCH] Increase timeouts on I2C bus. + +LTIBName: m547x-8x-i2c-timeout-fix +Signed-off-by: Shrek Wu <b16972@freescale.com> +--- + drivers/i2c/busses/i2c-mcf548x.c | 40 +++++++++++++++++++++++++++++-------- + 1 files changed, 31 insertions(+), 9 deletions(-) + +--- a/drivers/i2c/busses/i2c-mcf548x.c ++++ b/drivers/i2c/busses/i2c-mcf548x.c +@@ -43,8 +43,8 @@ static struct i2c_adapter i2c_mcf_board_ + .id = I2C_HW_MPC107, + .algo_data = &i2c_mcf_board_data, + .class = I2C_CLASS_HWMON, +- .timeout = 1, +- .retries = 1 ++ .timeout = 100, ++ .retries = 2 + }; + /* + * static void i2c_start() +@@ -105,7 +105,7 @@ wait_for_bb( + for (i = 0; i < adap->timeout; i++) { + if (!(MCF_I2SR & MCF_I2SR_IBB)) + return 0; +- udelay(10); ++ udelay(100); + } + printk(KERN_ERR "%s: timeout", __FUNCTION__); + return -ETIMEDOUT; +@@ -124,7 +124,7 @@ wait_for_not_bb( + for (i = 0; i < adap->timeout; i++) { + if (MCF_I2SR & MCF_I2SR_IBB) + return 0; +- udelay(10); ++ udelay(100); + } + printk(KERN_ERR "%s: timeout", __FUNCTION__); + return -ETIMEDOUT; +@@ -146,7 +146,7 @@ wait_xfer_done( + MCF_I2SR &= ~MCF_I2SR_IIF; + return 0; + } +- udelay(1); ++ udelay(10); + } + printk(KERN_ERR "%s: timeout", __FUNCTION__); + return -ETIMEDOUT; +@@ -166,7 +166,7 @@ i2c_set_addr( + ) { + unsigned short flags = msg->flags; + unsigned char addr; +- ++ MCF_I2CR |= MCF_I2CR_MTX; + if ((flags & I2C_M_TEN)) { + /* 10 bit address not supported yet */ + return -EIO; +@@ -269,7 +269,7 @@ mcf_sendbytes( + i2c_stop(adap); + wait_for_bb(adap); + } else { +- i2c_repstart(adap); ++ /* i2c_repstart(adap);*/ + } + + return (i); +@@ -330,7 +330,7 @@ mcf_readbytes( + i2c_stop(adap); + wait_for_bb(adap); + } else { +- i2c_repstart(adap); ++ /* i2c_repstart(adap);*/ + } + + return (i+1); +@@ -380,6 +380,27 @@ mcf_xfer( + wait_for_bb(adap); + + for (i = 0; ret >= 0 && i < num; i++) { ++ if (MCF_I2SR & MCF_I2SR_IBB) { ++ MCF_I2ICR = 0x00; ++ MCF_I2CR = 0x00; ++ MCF_I2CR = 0x0A; ++ timeout = MCF_I2DR; ++ MCF_I2SR = 0x00; ++ MCF_I2CR = 0x00; ++ MCF_I2ICR = 0x01; ++ } ++ /* setup SCL clock */ ++ MCF_I2FDR = get_clock(adap); ++ /* set slave address */ ++ MCF_I2AR = get_own(adap); ++ /* enable I2C module */ ++ MCF_I2CR = MCF_I2CR_IEN; ++ ++ MCF_I2CR |= MCF_I2CR_TXAK; ++ ++ /* Check for bus busy */ ++ wait_for_bb(adap); ++ + pmsg = &msgs[i]; + + printk(KERN_DEBUG "i2c-algo-mcf: Doing %s %d bytes " +@@ -388,7 +409,7 @@ mcf_xfer( + pmsg->len, pmsg->addr, i + 1, num); + + /* Send START */ +- if (i == 0) ++ /*if (i == 0)*/ + i2c_start(adap); + + /* Wait for Bus Busy */ +@@ -440,6 +461,7 @@ mcf_xfer( + "%d bytes.\n", ret); + } + } ++ MCF_I2CR = 0; + } + + /* Disable I2C module */ |