summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAlexey Brodkin <Alexey.Brodkin@synopsys.com>2013-11-07 17:51:43 +0400
committerHeiko Schocher <hs@denx.de>2013-11-13 06:21:21 +0100
commita2e0a45d2e1e258cbe9bd3dbbe7bc7cacbf7a84e (patch)
tree1e0d446d7eca064f48801329351027054135b417 /common
parent85bb251b393470c6d2a91b8f0f92b9f3fda856ca (diff)
downloadu-boot-imx-a2e0a45d2e1e258cbe9bd3dbbe7bc7cacbf7a84e.zip
u-boot-imx-a2e0a45d2e1e258cbe9bd3dbbe7bc7cacbf7a84e.tar.gz
u-boot-imx-a2e0a45d2e1e258cbe9bd3dbbe7bc7cacbf7a84e.tar.bz2
cmd_eeprom: fix i2c_{read|write} usage if env is in I2C EEPROM
Data "offset" is not used directly in case of I2C EEPROM. Istead it is split into "block number" and "offset within mentioned block". Which are "addr[0]" and "addr[1]" respectively. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> cc: Peter Tyser <ptyser@xes-inc.com> Cc: Heiko Schocher <hs@denx.de> Cc: Wolfgang Denk <wd@denx.de> Cc: Stefan Roese <sr@denx.de> Cc: Mischa Jonker <mjonker@synopsys.com>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_eeprom.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c
index ef694d8..02539c4 100644
--- a/common/cmd_eeprom.c
+++ b/common/cmd_eeprom.c
@@ -161,7 +161,7 @@ int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt
#if defined(CONFIG_SPI) && !defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
spi_read (addr, alen, buffer, len);
#else
- if (i2c_read (addr[0], offset, alen-1, buffer, len) != 0)
+ if (i2c_read (addr[0], addr[1], alen-1, buffer, len) != 0)
rcode = 1;
#endif
buffer += len;
@@ -339,7 +339,7 @@ int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cn
/* Write is enabled ... now write eeprom value.
*/
#endif
- if (i2c_write (addr[0], offset, alen-1, buffer, len) != 0)
+ if (i2c_write (addr[0], addr[1], alen-1, buffer, len) != 0)
rcode = 1;
#endif