Skip to contentSkip to conversation

Reset i2c slave devices during init on mpc5xxx cpus

PATCH New Eric Millbrandt 2 participants 2 messages Sep 3, 2009 – Sep 6, 2009

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

---

changes since v1
- Fixed compiler warning

 README                       |    7 ++++++
 cpu/mpc5xxx/i2c.c            |   49 ++++++++++++++++++++++++++++++++++++++++++
 include/configs/galaxy5200.h |    1 +
 3 files changed, 57 insertions(+), 0 deletions(-)
README +7 -0
index 246ae2b..6ccb2fe 100644
@@ -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
index 8d530d8..2ba5f0f 100644
@@ -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 · 1 line
1.6.3.1
#1 lore raw

PATCH v2 1/1 Reset i2c slave devices during init on mpc5xxx cpus

Hello Eric,

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 5 lines

---

changes since v1
- Fixed compiler warning

Applied to u-boot-i2c.git

Thanks for your work,

bye
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany