Reset i2c slave devices during init on mpc5xxx cpus
PATCH 1/1 Reset i2c slave devices during init on mpc5xxx cpus
Reset any i2c devices that may have been interrupted during a system reset. Normally this would be accomplished by clocking the line until SCL and SDA are released and then sending a start condtiion (From an Atmel datasheet). There is no direct access to the i2c pins so instead create start commands through the i2c interface. Send a start command then delay for the SDA Hold time, repeat this by disabling/enabling the bus a total of 9 times.
---
Heiko,
I was able to implement a i2c reset function with features common to all mpc5xxx cpu. Nothing was left from the first implementation, so I am submitting this as a new patch.
Thanks
Eric
README | 7 ++++++ cpu/mpc5xxx/i2c.c | 49 ++++++++++++++++++++++++++++++++++++++++++ include/configs/galaxy5200.h | 1 + 3 files changed, 57 insertions(+), 0 deletions(-)
README +7 -0
@@ -1366,6 +1366,13 @@ The following options need to be configured: therefore be cleared to 0 (See, eg, MPC823e User's Manual p.16-473). So, set CONFIG_SYS_I2C_SLAVE to 0. + CONFIG_SYS_I2C_INIT_MPC5XXX + + When a board is reset during an i2c bus transfer + chips might think that the current transfer is still + in progress. Reset the slave devices by sending start + commands until the slave device responds. + That's all that's required for CONFIG_HARD_I2C. If you use the software i2c interface (CONFIG_SOFT_I2C)
cpu/mpc5xxx/i2c.c +49 -0
61 lines not on this page · raw message
include/configs/galaxy5200.h +1 -0
@@ -110,6 +110,7 @@#define CONFIG_SYS_I2C_MODULE 2/* Select I2C module #1 or #2 */ #define CONFIG_SYS_I2C_SPEED 100000/* 100 kHz */ #define CONFIG_SYS_I2C_SLAVE 0x7F +#define CONFIG_SYS_I2C_INIT_MPC5XXX /* Reset devices on i2c bus */ /* * EEPROM CAT24WC32 configuration
Signature · 4 lines
1.6.3.1 http://openwebmail.org - eem
PATCH 1/1 Reset i2c slave devices during init on mpc5xxx cpus
Hello Eric,
after applying your patch I got the following warning:
$ ./MAKEALL galaxy5200 Configuring for galaxy5200 board... i2c.c:223: warning: function declaration isn't a prototype text data bss dec hex filename 239760 12928 283136 535824 82d10 ./u-boot $
please fix, thanks.
Quoted 7 lines · Eric Millbrandt
Reset any i2c devices that may have been interrupted during a system reset. Normally this would be accomplished by clocking the line until SCL and SDA are released and then sending a start condtiion (From an Atmel datasheet). There is no direct access to the i2c pins so instead create start commands through the i2c interface. Send a start command then delay for the SDA Hold time, repeat this by disabling/enabling the bus a total of 9 times.
Quoted 8 lines
Signed-off-by Eric Millbrandt <[email protected]>---
Heiko,
I was able to implement a i2c reset function with features common to all mpc5xxx cpu. Nothing was left from the first implementation, so I am submitting this as a new patch.
Thanks!
[..]
Quoted 3 lines
+ * time, repeat this by disabling/enabling the bus a total of 9 times.
+ */
+static voidsend_reset()
should be
static void send_reset(void)
cpu/mpc5xxx/i2c.c static int receive_bytes(uchar chip, char *buf, int len) · line 224
Quoted 2 lines
cpu/mpc5xxx/i2c.c +2
-0+{ +struct mpc5xxx_i2c *regs = (struct mpc5xxx_i2c *)I2C_BASE ;
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany