public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd_eeprom: fix i2c_{read|write} usage if env is in I2C EEPROM
@ 2013-11-07 13:51 Alexey Brodkin
  2013-11-13  6:37 ` [U-Boot] " Heiko Schocher
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Brodkin @ 2013-11-07 13:51 UTC (permalink / raw)
  To: u-boot

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>
---
 common/cmd_eeprom.c | 4 ++--
 1 file 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
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] cmd_eeprom: fix i2c_{read|write} usage if env is in I2C EEPROM
  2013-11-07 13:51 [U-Boot] [PATCH] cmd_eeprom: fix i2c_{read|write} usage if env is in I2C EEPROM Alexey Brodkin
@ 2013-11-13  6:37 ` Heiko Schocher
  0 siblings, 0 replies; 2+ messages in thread
From: Heiko Schocher @ 2013-11-13  6:37 UTC (permalink / raw)
  To: u-boot

Hello Alexey,

Am 07.11.2013 14:51, schrieb Alexey Brodkin:
> 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>
>
> ---
> common/cmd_eeprom.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Thanks!

Apllied to u-boot-i2c.git

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-13  6:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-07 13:51 [U-Boot] [PATCH] cmd_eeprom: fix i2c_{read|write} usage if env is in I2C EEPROM Alexey Brodkin
2013-11-13  6:37 ` [U-Boot] " Heiko Schocher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox