From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Wed, 09 May 2012 11:41:35 +0200 Subject: [U-Boot] [PATCH] mxs-i2c: Fix internal address byte order In-Reply-To: <1334677065-6620-1-git-send-email-to-fleischer@t-online.de> References: <1334677065-6620-1-git-send-email-to-fleischer@t-online.de> Message-ID: <4FAA3BCF.8080904@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 17/04/2012 17:37, Torsten Fleischer wrote: > 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 > CC: Fabio Estevam > --- > drivers/i2c/mxs_i2c.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/i2c/mxs_i2c.c b/drivers/i2c/mxs_i2c.c > index c8fea32..48aaaa6 100644 > --- a/drivers/i2c/mxs_i2c.c > +++ b/drivers/i2c/mxs_i2c.c > @@ -97,7 +97,7 @@ void mxs_i2c_write(uchar chip, uint addr, int alen, > > 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); > } I forwarded your patch to Heiko (I2C custodian), but here my: Acked-by: Stefano Babic Best regards, Stefano Babic -- ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================