Skip to contentSkip to conversation

i2c: add i2c reset command.

PATCH New Heiko Schocher 2 participants 3 messages Sep 29, 2008 – Oct 14, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: add i2c reset command.

---
 common/cmd_i2c.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
common/cmd_i2c.c +9 -0
index ef3928e..414c888 100644
@@ -1182,6 +1182,12 @@ int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 #endif
 
 #if defined(CONFIG_I2C_CMD_TREE)
+int do_i2c_res(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+{
+	i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
+	return 0;
+}
+
 #if defined(CONFIG_I2C_MULTI_BUS)
 int do_i2c_bus_num(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 {
@@ -1240,6 +1246,8 @@ int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 		return do_i2c_probe(cmdtp, flag, --argc, ++argv);
 	if (!strncmp(argv[1], "lo", 2))
 		return do_i2c_loop(cmdtp, flag, --argc, ++argv);
+	if (!strncmp(argv[1], "re", 2))
+		return do_i2c_res(cmdtp, flag, --argc, ++argv);
 #if defined(CONFIG_CMD_SDRAM)
 	if (!strncmp(argv[1], "sd", 2))
 		return do_sdram(cmdtp, flag, --argc, ++argv);
@@ -1267,6 +1275,7 @@ U_BOOT_CMD(
 	"i2c crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n"
 	"i2c probe - show devices on the I2C bus\n"
 	"i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device\n"
+	"i2c res - resets the I2C Controller\n"
 #if defined(CONFIG_CMD_SDRAM)
 	"i2c sdram chip - print SDRAM configuration information\n"
 #endif
Signature · 5 lines
1.5.6.1

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#1 lore raw

PATCH 1/1 i2c: add i2c reset command.

Dear Heiko Schocher,

Quoted 10 lines · In message <[email protected]> you wrote:
---
 common/cmd_i2c.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
common/cmd_i2c.c +0 -0
index ef3928e..414c888 100644

common/cmd_i2c.c int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) · line 1189

Quoted 8 lines
common/cmd_i2c.c +5 -0
@@ -1182,6 +1182,12 @@ int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 #endif
 
 #if defined(CONFIG_I2C_CMD_TREE)
+int do_i2c_res(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+{
+	i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
+	return 0;
+}

What does "res" mean? "Resource"? "resync"? "rescale"? "rescan"?

If you mean reset, then please write reset.

Also, in which way is this supposed to reset the I2C controller?

In short: which problem is this supposed to fix?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
One of the advantages of being a captain is being able to ask for ad-
vice without necessarily having to take it.
	-- Kirk, "Dagger of the Mind", stardate 2715.2
#2 lore raw

PATCH 1/1 i2c: add i2c reset command.

In reply to Heiko Schocher

Dear Heiko Schocher,

Quoted 4 lines · In message <[email protected]> you wrote:
---
 common/cmd_i2c.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

Added to "next" branch, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I have a very small mind and must live with it.    -- Edsger Dijkstra