diff options
author | Heiko Schocher <hs@denx.de> | 2008-10-15 09:33:30 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-10-18 21:54:01 +0200 |
commit | e43a27c49712203fe8848a17714330623edfb2eb (patch) | |
tree | 66b24fe19b73696228ebc958fa430b78d65f0927 /common/cmd_i2c.c | |
parent | 86e9cdf8c415c1a9725e9dae5237ba1e7bd9f686 (diff) | |
download | u-boot-e43a27c49712203fe8848a17714330623edfb2eb.zip u-boot-e43a27c49712203fe8848a17714330623edfb2eb.tar.gz u-boot-e43a27c49712203fe8848a17714330623edfb2eb.tar.bz2 |
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.
Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'common/cmd_i2c.c')
-rw-r--r-- | common/cmd_i2c.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index ea80e8a..ef9123e 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -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 - re-init 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" |