From patchwork Fri Jun 22 04:11:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 166477 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 8AEE2B6FA1 for ; Fri, 22 Jun 2012 14:13:30 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1396828101; Fri, 22 Jun 2012 06:13:14 +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 blLpoAwdQk1s; Fri, 22 Jun 2012 06:13:13 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 592CB280A1; Fri, 22 Jun 2012 06:12:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3CB1428088 for ; Fri, 22 Jun 2012 06:12:31 +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 Ym+K0AMFZdRA for ; Fri, 22 Jun 2012 06:12:30 +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 mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by theia.denx.de (Postfix) with ESMTPS id 343F52808B for ; Fri, 22 Jun 2012 06:12:27 +0200 (CEST) Received: by pbcwy7 with SMTP id wy7so2919129pbc.3 for ; Thu, 21 Jun 2012 21:12:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=9XdBB94w4tq2OW3iIrRcd3Lja5vXDEBGqGTpwA6bh+A=; b=pd+WL+1egmv05gzeF6HrHYv3s/Un6gMRaO/JoYt/Q3LA1q8mvTPUILZiG50j8dvRam yY9Yx1Q3fRmEhzw7vO9ZHkH7SlS5Rn0vi6ifEpzwLVzx03v6+URFEwu+o5i4rD8tGw9G oWfPrYB1HljM6N16py3OWWyW5Ggk5uoIVlZFwL/wzjPKthlGhuPsDKtDwf+p4JpC9MR2 QrPNDq5Sag9I4t5VaNJm0HB9VT8/q480eUiFzkaaDLYE41CaO2PdslydrE9WPPLbhl5l y15lFZKVx4raxqXf+W6j75Y4pw+ruswWqN7VWmpW0Eb+8Bq7T3x+7kcjs4pD/aAXuGaL zc6Q== Received: by 10.68.219.162 with SMTP id pp2mr5508350pbc.85.1340338346328; Thu, 21 Jun 2012 21:12:26 -0700 (PDT) Received: from officeserver-2 ([70.96.116.236]) by mx.google.com with ESMTPS id iv8sm37667964pbc.53.2012.06.21.21.12.22 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Jun 2012 21:12:24 -0700 (PDT) Received: from tkisky by officeserver-2 with local (Exim 4.76) (envelope-from ) id 1ShvEL-00032X-7c; Thu, 21 Jun 2012 21:12:21 -0700 From: Troy Kisky To: hs@denx.de, sbabic@denx.de Date: Thu, 21 Jun 2012 21:11:59 -0700 Message-Id: <1340338339-11626-4-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1340338339-11626-1-git-send-email-troy.kisky@boundarydevices.com> References: <1340338339-11626-1-git-send-email-troy.kisky@boundarydevices.com> X-Gm-Message-State: ALoCoQkpaEup5j2OXBCHTkPvTL9yX8ovGsrLjSPFAhlvZoRv7P3OUiklfUTpuj671U3Er6k1P1CG Cc: u-boot@lists.denx.de, r49496@freescale.com, jason.hui@linaro.org Subject: [U-Boot] [PATCH 04/24] mxc_i2c: clear i2sr before waiting for bit 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 Let's clear the sr register before waiting for bit to be set, instead of clearing it after hardware sets it. No real operational difference here, but allows combining of i2c_imx_trx_complete and i2c_imx_bus_busy in later patches. Signed-off-by: Troy Kisky Acked-by: Marek Vasut --- drivers/i2c/mxc_i2c.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c index 0fd508a..bae9335 100644 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -200,10 +200,8 @@ int i2c_imx_trx_complete(void) int timeout = I2C_MAX_TIMEOUT; while (timeout--) { - if (readb(&i2c_regs->i2sr) & I2SR_IIF) { - writeb(0, &i2c_regs->i2sr); + if (readb(&i2c_regs->i2sr) & I2SR_IIF) return 0; - } udelay(1); } @@ -215,6 +213,7 @@ static int tx_byte(struct mxc_i2c_regs *i2c_regs, u8 byte) { unsigned ret; + writeb(0, &i2c_regs->i2sr); writeb(byte, &i2c_regs->i2dr); ret = i2c_imx_trx_complete(); if (ret < 0)