From patchwork Tue Apr 17 15:37:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Torsten Fleischer X-Patchwork-Id: 153252 X-Patchwork-Delegate: hs@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 77A3DB6FDB for ; Wed, 18 Apr 2012 02:51:47 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B4F9028086; Tue, 17 Apr 2012 18:51:44 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fBDdGoQ+2phs; Tue, 17 Apr 2012 18:51:44 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A354F2807F; Tue, 17 Apr 2012 18:51:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6206628090 for ; Tue, 17 Apr 2012 17:38:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7KYKXjBrsqLn for ; Tue, 17 Apr 2012 17:38:55 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mailout01.t-online.de (mailout01.t-online.de [194.25.134.80]) by theia.denx.de (Postfix) with ESMTP id 77D4D2808C for ; Tue, 17 Apr 2012 17:38:54 +0200 (CEST) Received: from fwd10.aul.t-online.de (fwd10.aul.t-online.de ) by mailout01.t-online.de with smtp id 1SKAUW-0002in-D4; Tue, 17 Apr 2012 17:38:52 +0200 Received: from linux-1fbo.site.site (SaOsMwZpQhR2+pGRN+gAszYuqEG-smg9wafuZTof+W0LCylN11OEysxBSUatBpjgre@[87.152.184.31]) by fwd10.t-online.de with esmtp id 1SKAUV-0iTFOS0; Tue, 17 Apr 2012 17:38:51 +0200 From: Torsten Fleischer To: u-boot@lists.denx.de Date: Tue, 17 Apr 2012 17:37:45 +0200 Message-Id: <1334677065-6620-1-git-send-email-to-fleischer@t-online.de> X-Mailer: git-send-email 1.7.7 X-ID: SaOsMwZpQhR2+pGRN+gAszYuqEG-smg9wafuZTof+W0LCylN11OEysxBSUatBpjgre X-TOI-MSGID: 9485a2c0-befc-4f31-a9f7-cce1ded4ea06 X-Mailman-Approved-At: Tue, 17 Apr 2012 18:51:41 +0200 Cc: Torsten Fleischer , Marek Vasut , Fabio Estevam Subject: [U-Boot] [PATCH] mxs-i2c: Fix internal address byte order X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@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 CC: Fabio Estevam Acked-by: Marek Vasut Acked-by: Marek Vasut Acked-by: Stefano Babic --- 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); }