From: Date: Tue, 15 Oct 2013 19:54:23 -0000 Subject: No subject Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D If "CONFIG_SYS_I2C_EEPROM_ADDR_LEN =3D=3D 1": addr[0] =3D offset >> 8; If "CONFIG_SYS_I2C_EEPROM_ADDR_LEN > 1": addr[0] =3D offset >> 16; And in both cases then OR with "dev_addr": addr[0] |=3D dev_addr; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D In other words it gets both real I2S slave address + MSB bits of offset. But note that "offset" value stays unchanged. So if you pass both "addr[0]" (which already has MSB bits of "offset") and "offset" itself then you'll get completely incorrect I2C command. > @@ -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], addr[1], alen-1, buffer, len) !=3D 0) > + if (i2c_write(addr[0], offset, alen - 1, buffer, len)) > rcode =3D 1; >=20 > #endif Same goes to "eeprom_write". Moreover I'd say that this address/offset tricks are very EEPROM-specific and because of this we'd better keep it here and don't modify generic I2C code. Regards, Alexey