From patchwork Thu May 28 13:03:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 6498511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 926E79F38C for ; Thu, 28 May 2015 13:12:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2773205CD for ; Thu, 28 May 2015 13:12:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C5A99205CB for ; Thu, 28 May 2015 13:12:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YxxZC-0006K9-6i; Thu, 28 May 2015 13:09:46 +0000 Received: from mail-pd0-f180.google.com ([209.85.192.180]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YxxWU-0004uu-NB for linux-arm-kernel@lists.infradead.org; Thu, 28 May 2015 13:07:02 +0000 Received: by pdbqa5 with SMTP id qa5so41512996pdb.0 for ; Thu, 28 May 2015 06:06:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=46ZYuqsyMqRCKozGzVRTGSkHUzcqpRR3Tq4Uz72Ttos=; b=FXDkLuYFoThlXhfHU+7RAw7O9XeX0sM28ggmmujHTaUzS75hCM1eJVj79DbL6XQvOM MoZSqF8qZyvey9wgBJUlBB716afN7GXjNQO70e6tJgOv8uFfnfdYIGiXnHHQhCveySA9 9XwpuDo8kQ1QouEn/heDJmX7Zj+RI03j6Qmqj6ME/tkauBgmci7PYjiymVMELgBrvT+p 11ST/RccQP+VmzZhyZxtecqI7icXPcEgyCLRz9iRRjM9RAwiDuqTrW67wSUXmgwAVHY4 7CZppZq59xMGKCYczvNPtHo4ymS+/O12xyC195qyAzJKaPG9XzOYx4cyPAEALId0za4W UlAA== X-Gm-Message-State: ALoCoQkzT6yb26KO3KqDoa+Fa5Q1wH5leXKw100CKJ2TaldTgW4wazpGhnqeLQrhSJKbls5LSRj2 X-Received: by 10.70.43.225 with SMTP id z1mr5291441pdl.45.1432818397022; Thu, 28 May 2015 06:06:37 -0700 (PDT) Received: from localhost.localdomain ([202.62.77.106]) by mx.google.com with ESMTPSA id dc5sm2392557pbc.53.2015.05.28.06.06.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 May 2015 06:06:35 -0700 (PDT) From: Vaibhav Hiremath To: linux-i2c@vger.kernel.org Subject: [PATCH 03/12] i2c: pxa: Add reset operation when i2c bus busy Date: Thu, 28 May 2015 18:33:35 +0530 Message-Id: <1432818224-17070-4-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432818224-17070-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1432818224-17070-1-git-send-email-vaibhav.hiremath@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150528_060658_854213_F38853EA X-CRM114-Status: UNSURE ( 9.59 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.8 (-) Cc: "Jett.Zhou" , Vaibhav Hiremath , linux-arm-kernel@lists.infradead.org, Wolfram Sang X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Jett.Zhou" According to some test in emei_dkb, we found some i2c slave device (eg. camera sensor ov2659 power up) introduce noise on sda, so detect i2c controller busy, and assert reset to i2c controller to recover as early as possible to avoid more latency on the entire i2c transaction. Signed-off-by: Jett.Zhou [vaibhav.hiremath@linaro.org: Removed reduction in timeout value, as I do not have goot explanation for it. Logically it is not required. And also Updated changelog] Signed-off-by: Vaibhav Hiremath Signed-off-by: Vaibhav Hiremath --- drivers/i2c/busses/i2c-pxa.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index d4c798a..a76c901 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -314,6 +314,10 @@ static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c) { int timeout = DEF_TIMEOUT; + if (readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) + i2c_pxa_reset(i2c); + + while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) { if ((readl(_ISR(i2c)) & ISR_SAD) != 0) timeout += 4;