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: 49104 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9570A202A3 for ; Thu, 28 May 2015 13:06:42 +0000 (UTC) Received: by lbcak1 with SMTP id ak1sf10419191lbc.2 for ; Thu, 28 May 2015 06:06:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=1dSsvhpMhAFtP3CuDUIPoJo4l9aiRutuPU5EdpbI5OM=; b=MSCck786I+iUl1LqTOYFjCOtqrCBCT47oiYT1m4B1X5ppL0Txk6NAuEOyFUOe7Tukh nTXvSo70QIC86+I8QXGyEMAbR/XPBfcrRJgtACL/i7+CpbKaoYdAPZc/Qe2miWnSSghJ HdxyCePrqh2zS8R95jizzS/Pu+VPMsWcZ50wxrbyD/pXIlNmymlmjVpvq64IJGvYtYLp +rLrZb2E9U1XHVBrZqTsTS1WEKI9Boz6cvYrsUc/6JK2XIKR53Nl8xBI3qudQ+QHN04D suLz/ZmrnCFiy7Im9A5VcJOGoI07emssYo655Ho1YkatM0oRMblEf/3JwHm9lAVDkvKl GB9A== X-Gm-Message-State: ALoCoQnynJE8bGksjz5TAYnrJG5GIv3V56hNHOhUTA93AFJ+5WMQbWVW5nq81AszcZhITmpAjLN0 X-Received: by 10.152.87.140 with SMTP id ay12mr2639766lab.8.1432818401542; Thu, 28 May 2015 06:06:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.162 with SMTP id g2ls189940lae.80.gmail; Thu, 28 May 2015 06:06:41 -0700 (PDT) X-Received: by 10.152.87.204 with SMTP id ba12mr2744754lab.35.1432818401393; Thu, 28 May 2015 06:06:41 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id e10si1931593lae.15.2015.05.28.06.06.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 06:06:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by labko7 with SMTP id ko7so27578985lab.2 for ; Thu, 28 May 2015 06:06:41 -0700 (PDT) X-Received: by 10.152.21.136 with SMTP id v8mr2697016lae.19.1432818401300; Thu, 28 May 2015 06:06:41 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1144268lbb; Thu, 28 May 2015 06:06:40 -0700 (PDT) X-Received: by 10.66.156.198 with SMTP id wg6mr5374898pab.126.1432818399553; Thu, 28 May 2015 06:06:39 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i4si3510427pdh.229.2015.05.28.06.06.38; Thu, 28 May 2015 06:06:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753669AbbE1NGi (ORCPT + 1 other); Thu, 28 May 2015 09:06:38 -0400 Received: from mail-pd0-f177.google.com ([209.85.192.177]:34303 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752514AbbE1NGh (ORCPT ); Thu, 28 May 2015 09:06:37 -0400 Received: by pdbki1 with SMTP id ki1so41543840pdb.1 for ; Thu, 28 May 2015 06:06:37 -0700 (PDT) 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 Cc: Wolfram Sang , linux-arm-kernel@lists.infradead.org, "Jett.Zhou" , Vaibhav Hiremath 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> Sender: linux-i2c-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-i2c@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vaibhav.hiremath@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;