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");