mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
cmd_i2c: quit I2C commands immediately on error
If the i2c driver returns an error status, error out immediately. Continuing the loop just results in printing error messages again and again. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Cc: Simon Glass <sjg@chromium.org> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
1320112c8a
commit
9e533cb046
1 changed files with 13 additions and 13 deletions
|
@ -518,7 +518,7 @@ static int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
|
||||||
ret = i2c_read(chip, addr, alen, linebuf, linebytes);
|
ret = i2c_read(chip, addr, alen, linebuf, linebytes);
|
||||||
#endif
|
#endif
|
||||||
if (ret)
|
if (ret)
|
||||||
i2c_report_err(ret, I2C_ERR_READ);
|
return i2c_report_err(ret, I2C_ERR_READ);
|
||||||
else {
|
else {
|
||||||
printf("%04x:", addr);
|
printf("%04x:", addr);
|
||||||
cp = linebuf;
|
cp = linebuf;
|
||||||
|
@ -616,7 +616,7 @@ static int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
|
||||||
ret = i2c_write(chip, addr++, alen, &byte, 1);
|
ret = i2c_write(chip, addr++, alen, &byte, 1);
|
||||||
#endif
|
#endif
|
||||||
if (ret)
|
if (ret)
|
||||||
i2c_report_err(ret, I2C_ERR_WRITE);
|
return i2c_report_err(ret, I2C_ERR_WRITE);
|
||||||
/*
|
/*
|
||||||
* Wait for the write to complete. The write can take
|
* Wait for the write to complete. The write can take
|
||||||
* up to 10mSec (we allow a little more time).
|
* up to 10mSec (we allow a little more time).
|
||||||
|
@ -798,8 +798,8 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
|
||||||
ret = i2c_read(chip, addr, alen, (uchar *)&data, size);
|
ret = i2c_read(chip, addr, alen, (uchar *)&data, size);
|
||||||
#endif
|
#endif
|
||||||
if (ret)
|
if (ret)
|
||||||
i2c_report_err(ret, I2C_ERR_READ);
|
return i2c_report_err(ret, I2C_ERR_READ);
|
||||||
else {
|
|
||||||
data = cpu_to_be32(data);
|
data = cpu_to_be32(data);
|
||||||
if (size == 1)
|
if (size == 1)
|
||||||
printf(" %02lx", (data >> 24) & 0x000000FF);
|
printf(" %02lx", (data >> 24) & 0x000000FF);
|
||||||
|
@ -807,7 +807,6 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
|
||||||
printf(" %04lx", (data >> 16) & 0x0000FFFF);
|
printf(" %04lx", (data >> 16) & 0x0000FFFF);
|
||||||
else
|
else
|
||||||
printf(" %08lx", data);
|
printf(" %08lx", data);
|
||||||
}
|
|
||||||
|
|
||||||
nbytes = cli_readline(" ? ");
|
nbytes = cli_readline(" ? ");
|
||||||
if (nbytes == 0) {
|
if (nbytes == 0) {
|
||||||
|
@ -848,7 +847,8 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
|
||||||
(uchar *)&data, size);
|
(uchar *)&data, size);
|
||||||
#endif
|
#endif
|
||||||
if (ret)
|
if (ret)
|
||||||
i2c_report_err(ret, I2C_ERR_WRITE);
|
return i2c_report_err(ret,
|
||||||
|
I2C_ERR_WRITE);
|
||||||
#ifdef CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
|
#ifdef CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
|
||||||
udelay(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
|
udelay(CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue