From patchwork Fri Jul 3 13:55:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raviteja Narayanam X-Patchwork-Id: 11641971 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68293159A for ; Fri, 3 Jul 2020 13:57:29 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 401A220870 for ; Fri, 3 Jul 2020 13:57:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0LpEOx1W"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="d1tKNZ0B" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 401A220870 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=DJLL3hmzzeRCIJjHOWH2puGc/IHY3VkK3pYHq5saUTU=; b=0LpEOx1WEiBiefRr0SLZJRNmrX tpUK2R4DlmxicRqIz2cA+CLt4U5aEp9Igdu7HErclnF58NVwyr5BsWl5QqVRc/1WmHpa4Q9Mr4yRK sVz3rl79LwHYsIqhZ+rnGiQKjNEjhmuLOdk4Rrxgoh2OFWSRQgk0qTISvmJ9uaaARAXPfuSfBjLfY gZZ8CzCMU9HiD7vVsl2sCwiqM9tv7PH7SsEeL7bZLKjRXBrTSh94To1QxxPFjh2nEmW+Vjp/jgDbG h4qosCNoxdy3+D65azkBV8DZ0zRwh8LYkKnWbP8zMZuj5kKLQe8i0q+5v5ORwjdV1g6GaywG/5DH+ uj3nSn5g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrMAi-00068A-No; Fri, 03 Jul 2020 13:56:08 +0000 Received: from mail-bn7nam10on2053.outbound.protection.outlook.com ([40.107.92.53] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrMAg-00067G-F1 for linux-arm-kernel@lists.infradead.org; Fri, 03 Jul 2020 13:56:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CiaXqnYK1fmZZ0E6/8UdtFyVbs5gjeIuaH5hElnKB3ee2OiK5WlMszIHTqoYtysx8XGhBso+3Vhx6sygHWKIyQJMj4Sg3Ul427n+Z5ojoY8+XpsclWT1WiytkOkP/G8lxcqjdZqVewLjwYWbDE4LC9Eei+4/KiIsGZoVLJOVG2XCdOE+CKiUuxEENHnNLAY9LA3w5HVFVC4/gZUn8YuFgk7SzKnlMW/sg864yjqFQJNqUIMnDkv64N8bT9QwnbpMyosbfK8IOsw5pqmUH10U211QpasNbBIOZ1oF4E5AZZB1ZzJq5ri3OrgTstw9HsFtNIkB/cIn3ltraWgMUp6Lqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WchCHECsvgIR3DgyY/0kDtgXEnmCbgfhyJrwn7yszpI=; b=jdcKFj9KC40KPfU0mGboFvnhVqpqwYpUQfcyx/1dpC0uVvDxPBrohnQ7NfWnOT/ELnb0pmamaW6WbN0OyR7sCaaHRJLq3NW4hJ90AOPdpcXG1bF0V7NLkSaiLB7EpeEdmwnpogbtbHWfynsrvOrYgCvG3gOEwBrkVQmjEk/5GxJrPWPPdLZx4LH/h7m8hfEic/lgFzA4Rdeds+avHrqghAr7hq4F3Z7m8q98QIjRvfi8fCwqzlyI/CJyttzDbqYKSd2LjFhFQFnPjSUeF7nGBaeGFDhJLThMhvcEbN29fx9T/cT64y4fbwL6I47qeamSeh7hU7ejLUzp04/JSF1gVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WchCHECsvgIR3DgyY/0kDtgXEnmCbgfhyJrwn7yszpI=; b=d1tKNZ0BfxjYDuvC0u+1yvfQUoDmKrATIXAR1ejbsdAjHv9ptHcs6Qwcf+DPytxJHtKyEk4Wc3pcMEWuFQ2dd3dEDg+Buw5phTTZLNR1UKW+7BaVAj1XC3Tv2bt2ryukSdsrehSbVKAGanMSFqLciF1u+erC5zZ6ndEGOnsjnNs= Received: from SN1PR12CA0084.namprd12.prod.outlook.com (2603:10b6:802:21::19) by BY5PR02MB6913.namprd02.prod.outlook.com (2603:10b6:a03:230::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.27; Fri, 3 Jul 2020 13:56:04 +0000 Received: from SN1NAM02FT003.eop-nam02.prod.protection.outlook.com (2603:10b6:802:21:cafe::4d) by SN1PR12CA0084.outlook.office365.com (2603:10b6:802:21::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.20 via Frontend Transport; Fri, 3 Jul 2020 13:56:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by SN1NAM02FT003.mail.protection.outlook.com (10.152.73.29) with Microsoft SMTP Server id 15.20.3153.24 via Frontend Transport; Fri, 3 Jul 2020 13:56:04 +0000 Received: from [149.199.38.66] (port=58211 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.90) (envelope-from ) id 1jrM9F-0002wm-LY; Fri, 03 Jul 2020 06:54:37 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1jrMAe-0004QD-05; Fri, 03 Jul 2020 06:56:04 -0700 Received: from xsj-pvapsmtp01 (maildrop.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 063Dtt6C014340; Fri, 3 Jul 2020 06:55:56 -0700 Received: from [10.140.6.6] (helo=xhdappanad40.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1jrMAV-0004Mo-E7; Fri, 03 Jul 2020 06:55:55 -0700 From: Raviteja Narayanam To: linux-i2c@vger.kernel.org Subject: [PATCH 1/2] Revert "i2c: cadence: Fix the hold bit setting" Date: Fri, 3 Jul 2020 19:25:49 +0530 Message-Id: <1593784549-21489-1-git-send-email-raviteja.narayanam@xilinx.com> X-Mailer: git-send-email 2.7.4 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapsmtpgw01; PTR:unknown-60-83.xilinx.com; CAT:NONE; SFTY:; SFS:(136003)(39860400002)(396003)(346002)(376002)(46966005)(44832011)(8676002)(8936002)(47076004)(5660300002)(478600001)(2906002)(107886003)(426003)(356005)(82740400003)(2616005)(336012)(81166007)(9786002)(6916009)(70206006)(6666004)(82310400002)(26005)(186003)(70586007)(7696005)(316002)(36756003)(83380400001)(4326008); DIR:OUT; SFP:1101; X-MS-PublicTrafficType: Email MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 9e53b414-878a-4252-a438-08d81f58d3c2 X-MS-TrafficTypeDiagnostic: BY5PR02MB6913: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:785; X-Forefront-PRVS: 045315E1EE X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hl14khzXnpZXL82TUIH89LH93WZTf+O4jklwfg024Zz6DXKn43sQxy3g9nwMUL3nZuaMnLXs0j4zgqjW09GKyc2moLEK/VrWBSCdhCJRtXKsXSNUKy/hen5v9Pb1hhraN4j46Rz1oQ3c4CMGEK5L40kTkpyRaWl8px4IXY2fS/41CDzZq4Xts4F1n7BvfPkJkvrg3cFLvRWmA0phu/dVXC/ygh32NMBdrUFhhBXLBje5baGszNDbj69vb0T9921pXdDJ77KWk5LZNTlpXyKGkmwkifTqJs43GIKksaICFqWqrt4dNsoQBwI6+GQWqlXm3m69fQkG9ahd2O3iVYEA9uDFQ/2bGU3wV3vfscaVGD5zvw96Lw6ikz2uhgnux2ST2KBM/4e+TdATqhIyUVrukw== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2020 13:56:04.3206 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9e53b414-878a-4252-a438-08d81f58d3c2 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT003.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6913 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200703_095606_549973_F13A4C22 X-CRM114-Status: GOOD ( 13.58 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [40.107.92.53 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.92.53 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: git@xilinx.com, Raviteja Narayanam , michal.simek@xilinx.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This reverts commit d358def706880defa4c9e87381c5bf086a97d5f9. There are two issues with "i2c: cadence: Fix the hold bit setting" commit. 1. In case of combined message request from user space, when the HOLD bit is cleared in cdns_i2c_mrecv function, a STOP condition is sent on the bus even before the last message is started. This is because when the HOLD bit is cleared, the FIFOS are empty and there is no pending transfer. The STOP condition should occur only after the last message is completed. 2. The code added by the commit is redundant. Driver is handling the setting/clearing of HOLD bit in right way before the commit. The setting of HOLD bit based on 'bus_hold_flag' is taken care in cdns_i2c_master_xfer function even before cdns_i2c_msend/cdns_i2c_recv functions. The clearing of HOLD bit is taken care at the end of cdns_i2c_msend and cdns_i2c_recv functions based on bus_hold_flag and byte count. Since clearing of HOLD bit is done after the slave address is written to the register (writing to address register triggers the message transfer), it is ensured that STOP condition occurs at the right time after completion of the pending transfer (last message). Signed-off-by: Raviteja Narayanam --- drivers/i2c/busses/i2c-cadence.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c index 4b72398..e069602 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -594,10 +594,8 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id) * Check for the message size against FIFO depth and set the * 'hold bus' bit if it is greater than FIFO depth. */ - if ((id->recv_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag) + if (id->recv_count > CDNS_I2C_FIFO_DEPTH) ctrl_reg |= CDNS_I2C_CR_HOLD; - else - ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD; cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET); @@ -654,11 +652,8 @@ static void cdns_i2c_msend(struct cdns_i2c *id) * Check for the message size against FIFO depth and set the * 'hold bus' bit if it is greater than FIFO depth. */ - if ((id->send_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag) + if (id->send_count > CDNS_I2C_FIFO_DEPTH) ctrl_reg |= CDNS_I2C_CR_HOLD; - else - ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD; - cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET); /* Clear the interrupts in interrupt status register. */ From patchwork Fri Jul 3 13:56:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raviteja Narayanam X-Patchwork-Id: 11641973 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C00DE92A for ; Fri, 3 Jul 2020 13:57:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9743820870 for ; Fri, 3 Jul 2020 13:57:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="E4vyOxLr"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="AeXagBY8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9743820870 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=frKNeWu6+BeM7qUFm6FeiUIu+V9sZzj2USo2Cz3k87g=; b=E4vyOxLrf46Ma2PKWp9apgCFVx qMHFJYRlimKHn4EeOPPec/35M1zbFAyalrNCSsGi3iIf4BImfQpUvo+sz9AZBKVrKik/6lujm1B7Z y7yaOF1jfso6+OQ2FZe3Sp2od3jjhIzlOgJUJdwOz7nYlhLwyM6pC43leuLhzPFkaCMdBPjunjNa4 uRCfLu6Y8DrkuojtNFVBUkMeYqMgF2PrLaupIOph55Fxh5dbCPShqFwdZZNBwIgvys6vu9Ly1S5Ev sGl+Fp4hDfk72+642nWEKETy/cR4AZOt6WyqRwRK+GS983AX+hIROoHkxcFABdPFaLg19vHYudHQy 2MNt+Lhw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrMB6-0006Gi-5K; Fri, 03 Jul 2020 13:56:32 +0000 Received: from mail-co1nam04on0628.outbound.protection.outlook.com ([2a01:111:f400:fe4d::628] helo=NAM04-CO1-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrMB2-0006Ea-KE for linux-arm-kernel@lists.infradead.org; Fri, 03 Jul 2020 13:56:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EaManCNPlM6bCyYI9Ed8Cut1Nzm4NMEPnWcNg0W82EOvnH9ogb2RgSckXe1aVzcdmNyMYwC91fhxCB+hhVwYTSjrkTAvE1podWyE3BCkRzHUrxiUAqGfFLfHwHnYP6/bjZyTgMXb45fYKq9Zuz6PbvxHdyLQUKFdfaSneFDlKIMSOtE+NwBB5YX5UksiWTKH0HioRc41ksJusGQ4XURohofNq3RGHRkBxJYUipKsVEcdQZBh1v2E9Z158bUDKl8ipJmtet2vkHyB3Hi5ahGOHGoDXve2sGXphB2I30JiI2A1tuO8PpwbyMmETAnUZJYifKEJzWlnXAflsd5T9cIQfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1FGY4417WxzOZRswBSTPd7er1aCrtnOPiLn7y0li0js=; b=dHjAFeH4peOyy1ca/IpShQqhOdY7w63QySdwStkgtfdMgJxtwBdRh/sW8ymQxXyjx1IWxLgdir6hIIW7n+hAlY0curkh6hmaRcLtW3BtpbdG2h1aHKUNVnq1UIV2HykKBWMqyQQlJjU9UuwoPYGlWMjUx4EOKhumT7BS3U0Txc3EZ62076vfnqnvBmCIXNuVR5H3Df+iRl+rYjJsCHcIxKS+6TrH/GO/syc0iA5onysA7im88GbR2M6o77MyymwtyID7KqiAGokxJPHDFXNPrEQ87fPoVm2uNHquFuYmjGrGIniTu6OC3ClWeJm4JOElY5xRLdfHaPSEcDtOvlnN/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1FGY4417WxzOZRswBSTPd7er1aCrtnOPiLn7y0li0js=; b=AeXagBY8C2kc6jxglmvSm0p1duB/0bXl2jpmdwKtTBrFdCbvFVTLtq8KaQwzK1BkWDi8WvfXU/LLXBZ0TucM5dH/3peQ1QLseADFr+mbJX5SIJqdB5lZ7a/Q7oe38bVSYfzJWR1pGPwGHA9Hym7+rw5aBg+oGror9Y8p7NJsWco= Received: from SN4PR0501CA0113.namprd05.prod.outlook.com (2603:10b6:803:42::30) by BN7PR02MB5331.namprd02.prod.outlook.com (2603:10b6:408:2b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.23; Fri, 3 Jul 2020 13:56:24 +0000 Received: from SN1NAM02FT035.eop-nam02.prod.protection.outlook.com (2603:10b6:803:42:cafe::3c) by SN4PR0501CA0113.outlook.office365.com (2603:10b6:803:42::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.12 via Frontend Transport; Fri, 3 Jul 2020 13:56:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by SN1NAM02FT035.mail.protection.outlook.com (10.152.72.145) with Microsoft SMTP Server id 15.20.3153.24 via Frontend Transport; Fri, 3 Jul 2020 13:56:24 +0000 Received: from [149.199.38.66] (port=58707 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.90) (envelope-from ) id 1jrM9Z-0002x8-Qa; Fri, 03 Jul 2020 06:54:57 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1jrMAy-0004WL-4w; Fri, 03 Jul 2020 06:56:24 -0700 Received: from xsj-pvapsmtp01 (mailhost.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 063DuGSZ014470; Fri, 3 Jul 2020 06:56:17 -0700 Received: from [10.140.6.6] (helo=xhdappanad40.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1jrMAq-0004Te-Cr; Fri, 03 Jul 2020 06:56:16 -0700 From: Raviteja Narayanam To: linux-i2c@vger.kernel.org Subject: [PATCH 2/2] i2c: cadence: Clear HOLD bit at correct time in Rx path Date: Fri, 3 Jul 2020 19:26:12 +0530 Message-Id: <1593784572-21910-1-git-send-email-raviteja.narayanam@xilinx.com> X-Mailer: git-send-email 2.7.4 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapsmtpgw01; PTR:unknown-60-83.xilinx.com; CAT:NONE; SFTY:; SFS:(346002)(376002)(396003)(136003)(39860400002)(46966005)(4326008)(478600001)(426003)(186003)(82740400003)(316002)(26005)(47076004)(9786002)(6666004)(36756003)(336012)(8676002)(70586007)(7696005)(107886003)(83380400001)(8936002)(70206006)(6916009)(356005)(44832011)(81166007)(5660300002)(2906002)(82310400002)(2616005); DIR:OUT; SFP:1101; X-MS-PublicTrafficType: Email MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 660b7f12-ad21-4a08-7b93-08d81f58dfc2 X-MS-TrafficTypeDiagnostic: BN7PR02MB5331: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 045315E1EE X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J2Hj8ZfB0XanmIkMgNEd+m/UpROHNxTqL9W6i2LqqmDRqigWLgA9RkSbQjw9LEWFNfsk1Dxq47c2i1VoK63BPBuBfz/TWaDbiksk19+II42s3XKc7yWvGbftDGT3+r5A73ClYomxrBsz+12mmTZgC3lD/NtNZKRPI12LWIRqdP5DAAT3l5aAWx7dRETmYA8d6bGnJ6xZNuOJ1gbbeWMPWZkcXxQLpvuZ3i7spXpos5LWtatAZveMRwcFyDQW0GCVXQzpzoiExuTUSXMXVWV+BbM2x6rntCB+8HqnybZhqFxeh1voO19Hm2Sh2yfGt8pqYS/qF6RqS/7OJZAedCIs31nTsEcnfcgJZQJu3D0ufuQKrIk/FsW4hRtn4MH+D3idKOx6RdrUWH1hqB20DO3TEw== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2020 13:56:24.4513 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 660b7f12-ad21-4a08-7b93-08d81f58dfc2 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT035.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR02MB5331 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200703_095628_723975_DA738DB9 X-CRM114-Status: GOOD ( 13.59 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: git@xilinx.com, Raviteja Narayanam , michal.simek@xilinx.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org There are few issues on Zynq SOC observed in the stress tests causing timeout errors. Even though all the data is received, timeout error is thrown. This is due to an IP bug in which the COMP bit in ISR is not set at end of transfer and completion interrupt is not generated. This bug is seen on Zynq platforms when the following condition occurs: Master read & HOLD bit set & Transfer size register reaches '0'. One workaround is to clear the HOLD bit before the transfer size register reaches '0'. The current implementation checks for this at the start of the loop and also only for less than FIFO DEPTH case (ignoring the equal to case). So clear the HOLD bit when the data yet to receive is less than or equal to the FIFO DEPTH. This avoids the IP bug condition. Signed-off-by: Raviteja Narayanam --- drivers/i2c/busses/i2c-cadence.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c index e069602..e4b7f2a 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -421,20 +421,21 @@ static irqreturn_t cdns_i2c_master_isr(void *ptr) /* Read data if receive data valid is set */ while (cdns_i2c_readreg(CDNS_I2C_SR_OFFSET) & CDNS_I2C_SR_RXDV) { - /* - * Clear hold bit that was set for FIFO control if - * RX data left is less than FIFO depth, unless - * repeated start is selected. - */ - if ((id->recv_count < CDNS_I2C_FIFO_DEPTH) && - !id->bus_hold_flag) - cdns_i2c_clear_bus_hold(id); - if (id->recv_count > 0) { *(id->p_recv_buf)++ = cdns_i2c_readreg(CDNS_I2C_DATA_OFFSET); id->recv_count--; id->curr_recv_count--; + + /* + * Clear hold bit that was set for FIFO control + * if RX data left is less than or equal to + * FIFO DEPTH unless repeated start is selected + */ + if (id->recv_count <= CDNS_I2C_FIFO_DEPTH && + !id->bus_hold_flag) + cdns_i2c_clear_bus_hold(id); + } else { dev_err(id->adap.dev.parent, "xfer_size reg rollover. xfer aborted!\n");