I2C: add new command i2c reset.
PATCH v2 2/16 I2C: add new command i2c reset.
If I2C Bus is blocked (see doc/I2C_Edge_Conditions), it is not possible to get out of this, until the complete Hardware gets a reset. This new commando calls again i2c_init (and that calls i2c_init_board if defined), which will deblock the I2C Bus.
--- common/cmd_i2c.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
common/cmd_i2c.c +9 -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_reset(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[]) {
@@ -1238,6 +1244,8 @@ int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])return do_i2c_crc (cmdtp, flag, --argc, ++argv);if (!strncmp (argv[1 ],"pr" ,2 ))return do_i2c_probe (cmdtp, flag, --argc, ++argv); +if (!strncmp (argv[1 ],"re" ,2 )) +return do_i2c_reset (cmdtp, flag, --argc, ++argv);if (!strncmp (argv[1 ],"lo" ,2 ))return do_i2c_loop (cmdtp, flag, --argc, ++argv);#if defined(CONFIG_CMD_SDRAM )
@@ -1266,6 +1274,7 @@ U_BOOT_CMD("i2c nm chip address[.0, .1, .2] - write to I2C device (constant address)\n" "i2c crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n" "i2c probe - show devices on the I2C bus\n" +"i2c reset - reinit the I2C Controller\n" "i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device\n"#if defined(CONFIG_CMD_SDRAM )"i2c sdram chip - print SDRAM configuration information\n"
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
PATCH v2 2/16 I2C: add new command i2c reset.
Quoted 4 lines · Heiko Schocher
If I2C Bus is blocked (see doc/I2C_Edge_Conditions), it is not possible to get out of this, until the complete Hardware gets a reset. This new commando
You mean a commando like Chuck Norris? Seriously, you use this word in a lot of these patches and it's not quite appropriate.
Quoted 35 lines
calls again
i2c_init(and that callsi2c_init_boardif defined), which will deblock the I2C Bus.Signed-off-by Heiko Schocher <[email protected]>--- common/cmd_i2c.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)common/cmd_i2c.c +8
-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_reset(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[]) {@@ -1238,6 +1244,8 @@ int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])return do_i2c_crc (cmdtp, flag, --argc, ++argv);if (!strncmp (argv[1 ],"pr" ,2 ))return do_i2c_probe (cmdtp, flag, --argc, ++argv); +if (!strncmp (argv[1 ],"re" ,2 )) +return do_i2c_reset (cmdtp, flag, --argc, ++argv);if (!strncmp (argv[1 ],"lo" ,2 ))return do_i2c_loop (cmdtp, flag, --argc, ++argv);#if defined(CONFIG_CMD_SDRAM )
common/cmd_i2c.c U_BOOT_CMD( · line 1278
Quoted 5 lines
common/cmd_i2c.c +1
-0@@ -1266,6 +1274,7 @@ U_BOOT_CMD("i2c nm chip address[.0, .1, .2] - write to I2C device (constant address)\n" "i2c crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n" "i2c probe - show devices on the I2C bus\n" +"i2c reset - reinit the I2C Controller\n"
re-init or re-initialize would be better.
Quoted 4 lines
common/cmd_i2c.c +0
-0"i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device\n"#if defined(CONFIG_CMD_SDRAM )"i2c sdram chip - print SDRAM configuration information\n"
regards,
Ben
PATCH v2 2/16 I2C: add new command i2c reset.
Hello Ben,
Quoted 1 line · Ben Warren
Heiko Schocher wrote:
[...]
Quoted 4 lines
Quoted 3 lines
"i2c probe - show devices on the I2C bus\n"
+ "i2c reset - reinit the I2C Controller\n"re-init or re-initialize would be better.
You are right (as I wrote in the help text ...)
Is "i2c reinit" as commandname ok?
bye
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH v2 2/16 I2C: add new command i2c reset.
Hi Heiko,
Quoted 15 lines · Heiko Schocher
Hello Ben,
Quoted 2 lines · Ben Warren
Heiko Schocher wrote:
[...]
Quoted 6 lines
Quoted 4 lines
"i2c probe - show devices on the I2C bus\n"
+ "i2c reset - reinit the I2C Controller\n"re-init or re-initialize would be better.
Quoted 7 lines
You are right (as I wrote in the help text ...)
Is "i2c reinit" as commandname ok?
bye
Heiko
I don't have a problem with 'i2c reset' or 'i2c reinit' as commands, since it's best to not have punctuation symbols in commands, but in the help text we should use proper words, either 'reset', 're-init' or 're-initialize'.
regards,
Ben
PATCH v2 2/16 I2C: add new command i2c reset.
Hello Ben,
Quoted 19 lines · Ben Warren
Quoted 18 lines · Heiko Schocher
Hello Ben,
Quoted 2 lines · Ben Warren
Heiko Schocher wrote:
[...]
Quoted 5 lines
Quoted 3 lines
"i2c probe - show devices on the I2C bus\n"
+ "i2c reset - reinit the I2C Controller\n"re-init or re-initialize would be better.
You are right (as I wrote in the help text ...)
Is "i2c reinit" as commandname ok?
Quoted 7 lines
Quoted 3 lines
bye
HeikoI don't have a problem with 'i2c reset' or 'i2c reinit' as commands, since it's best to not have punctuation symbols in commands, but in the help text we should use proper words, either 'reset', 're-init' or 're-initialize'.
Ah, okay. Then I fix just the help text, thanks.
bye
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH v2 2/16 I2C: add new command i2c reset.
In reply to Ben WarrenDear Ben Warren,
Quoted 4 lines · In message <[email protected]> you wrote:
Quoted 4 lines
You are right (as I wrote in the help text ...)
Is "i2c reinit" as commandname ok?
Please stick with "i2c reset"
Nad, Heiko: in English, it's "command name".
Quoted 4 lines
I don't have a problem with 'i2c reset' or 'i2c reinit' as commands, since it's best to not have punctuation symbols in commands, but in the help text we should use proper words, either 'reset', 're-init' or 're-initialize'.
ACK.
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 1000 pains = 1 Megahertz