From patchwork Wed Nov 27 16:10:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 294613 X-Patchwork-Delegate: trini@ti.com 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 3758F2C00A1 for ; Thu, 28 Nov 2013 03:11:01 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7399E4B7B0; Wed, 27 Nov 2013 17:10:59 +0100 (CET) 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 CPGastzzDXhm; Wed, 27 Nov 2013 17:10:59 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A28134B78B; Wed, 27 Nov 2013 17:10:57 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 46A4D4B78B for ; Wed, 27 Nov 2013 17:10:52 +0100 (CET) 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 EycKQQq6aQdi for ; Wed, 27 Nov 2013 17:10:47 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 BL_NJABL=ERR(-1.5) (only DNSBL check requested) Received: from mail.free-electrons.com (top.free-electrons.com [176.31.233.9]) by theia.denx.de (Postfix) with ESMTP id 63E684B784 for ; Wed, 27 Nov 2013 17:10:39 +0100 (CET) Received: by mail.free-electrons.com (Postfix, from userid 106) id CD24C846; Wed, 27 Nov 2013 17:10:39 +0100 (CET) Received: from skate (col31-4-88-188-83-94.fbx.proxad.net [88.188.83.94]) by mail.free-electrons.com (Postfix) with ESMTPSA id 2D7AF7EE; Wed, 27 Nov 2013 17:10:29 +0100 (CET) Date: Wed, 27 Nov 2013 17:10:26 +0100 From: Thomas Petazzoni To: Nikita Kiryanov Message-ID: <20131127171026.237fc859@skate> In-Reply-To: <5296153F.9040006@compulab.co.il> References: <20131127131929.34505e23@skate> <20131127151121.51f124e6@skate> <52960748.4020203@compulab.co.il> <20131127162839.0b7f65c3@skate> <5296153F.9040006@compulab.co.il> Organization: Free Electrons X-Mailer: Claws Mail 3.9.1 (GTK+ 2.24.17; x86_64-pc-linux-gnu) Mime-Version: 1.0 Cc: Javier Martinez Canillas , Lubomir Popov , Michael@theia.denx.de, "u-boot@lists.denx.de" , Opdenacker , Tom Rini , =?UTF-8?B?Q2zDqW1lbnQ=?= , Gregory@theia.denx.de Subject: Re: [U-Boot] OMAP3 i2c issues on IGEP, u-boot 2013.10 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Dear Nikita Kiryanov, On Wed, 27 Nov 2013 17:52:31 +0200, Nikita Kiryanov wrote: > The zeroing of the cnt register also happens in other places in the > driver, and it is entirely possible that they should be removed for > OMAP3s as well. > > In my patch I removed it only for i2c_write() because the original > driver also zeroed the cnt register in I/O functions- except in > i2c_write(), and I decided to follow the original driver's lead. > > What happens if you remove all the lines that zero the cnt register? It works. I've removed all the writew(0, ...cnt register...), and then I've done at least 20 boots of the IGEP board, and all of them were successful. I've attached the ugly patch that comments out all of those cases. Of course, it's not a patch intended for merging, just to show which locations I've commented. Since I've absolutely no idea of the background for the problem, would you mind submitting a proper patch with a good explanation? I will be happy to test it, of course. Thanks! Thomas diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c index ef38d71..54c36d8 100644 --- a/drivers/i2c/omap24xx_i2c.c +++ b/drivers/i2c/omap24xx_i2c.c @@ -165,7 +165,7 @@ void i2c_init(int speed, int slaveadd) udelay(1000); flush_fifo(); writew(0xFFFF, &i2c_base->stat); - writew(0, &i2c_base->cnt); + // writew(0, &i2c_base->cnt); if (gd->flags & GD_FLG_RELOC) bus_initialized[current_bus] = 1; @@ -205,7 +205,7 @@ int i2c_probe(uchar chip) return res; /* No data transfer, slave addr only */ - writew(0, &i2c_base->cnt); + //writew(0, &i2c_base->cnt); /* Set slave address */ writew(chip, &i2c_base->sa); /* Stop bit needed here */ @@ -241,7 +241,7 @@ int i2c_probe(uchar chip) pr_exit: flush_fifo(); writew(0xFFFF, &i2c_base->stat); - writew(0, &i2c_base->cnt); + //writew(0, &i2c_base->cnt); return res; } @@ -377,7 +377,7 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len) rd_exit: flush_fifo(); writew(0xFFFF, &i2c_base->stat); - writew(0, &i2c_base->cnt); + //writew(0, &i2c_base->cnt); return i2c_error; } @@ -476,7 +476,7 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len) wr_exit: flush_fifo(); writew(0xFFFF, &i2c_base->stat); - writew(0, &i2c_base->cnt); + //writew(0, &i2c_base->cnt); return i2c_error; }