Skip to contentSkip to conversation

cmd_eeprom: fix i2c_{read|write} usage if env is in I2C EEPROM

PATCH In review Alexey Brodkin 2 participants 2 messages Nov 7, 2013 – Nov 13, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
cc Peter Tyser <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Mischa Jonker <[email protected]>
---
 common/cmd_eeprom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/cmd_eeprom.c +2 -2
index ef694d8..02539c4 100644
@@ -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
Signature · 1 line
1.8.4.2
#1 lore raw

Hello Alexey,

Am 07.11.2013 14:51, schrieb Alexey Brodkin:

Quoted 13 lines

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.

Cc Jean-Christophe PLAGNIOL-VILLARD<[email protected]>
cc Peter Tyser<[email protected]>
Cc Heiko Schocher<[email protected]>
Cc Wolfgang Denk<[email protected]>
Cc Stefan Roese<[email protected]>
Cc Mischa Jonker<[email protected]>
Quoted 3 lines

---
common/cmd_eeprom.c | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)

Thanks!

Apllied to u-boot-i2c.git

bye,
Heiko

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