From: Torsten Fleischer Date: Sat, 14 Apr 2012 11:38:25 +0200 Subject: [U-Boot] [PATCH] mxs_i2c: Fix internal address byte order Message-ID: <1669909.vHV08JIq0P@linux-1fbo.site> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Large EEPROMs, e.g. 24lc32, need 2 byte to address the internal memory. These devices require that the high byte of the internal address has to be written first. The mxs_i2c driver currently writes the address' low byte first. The following patch fixes the byte order of the internal address that should be written to the I2C device. Signed-off-by: Torsten Fleischer CC: Marek Vasut CC: Stefano Babic --- diff -Naur u-boot.orig/drivers/i2c/mxs_i2c.c u-boot/drivers/i2c/mxs_i2c.c --- u-boot.orig/drivers/i2c/mxs_i2c.c +++ u-boot/drivers/i2c/mxs_i2c.c @@ -97,7 +97,7 @@ for (i = 0; i < alen; i++) { data >>= 8; - data |= ((char *)&addr)[i] << 24; + data |= ((char *)&addr)[alen - i - 1] << 24; if ((i & 3) == 2) writel(data, &i2c_regs->hw_i2c_data); }