From patchwork Sat Jun 26 10:27:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Raviteja Narayanam X-Patchwork-Id: 12346389 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BDB2C49EA6 for ; Sat, 26 Jun 2021 10:30:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 C9BE461939 for ; Sat, 26 Jun 2021 10:30:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C9BE461939 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fbqjR3leoO+pL36JKywUXTSc826gFYMwiGQmYcUpj9M=; b=UPf27XOi+yDqRY CyJqkdbWDpTOJlnM1XTkAzZT43hmQBzVKPySGXjs8hjOR3+pMF2yAdjsGgtp+kv7pCMoRVZ+RTGtO WcwNkair3vAWa+uJ+L/V3fzofC78cGXDZdiHxSsHIwPLNGB1l7O4jt3hSLdGTmPFUjcKdPprRWE4v W7KcvlDwRTSyLhwU3AAmJkRSLFGVXN1/SLhwc4jAtZEuSnnJCAGkMbDKZ31h7NOC1cUN8UHr5Sfnx j7Z2oR+znJUmzDXIKCAYah6y2JTjakRsPp01XrzEVziaEA9idNu1w0Bo1T3UW7dAOIdu/YrOFDOj/ MvHY0PzaID1NWiTt4CVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5YJ-003s7Y-Ri; Sat, 26 Jun 2021 10:28:44 +0000 Received: from mail-mw2nam10on2087.outbound.protection.outlook.com ([40.107.94.87] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5YE-003s6A-69 for linux-arm-kernel@lists.infradead.org; Sat, 26 Jun 2021 10:28:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QHcCzhmhwIi/En/NeqRb6suTOYqL1bWlsBOWotrV6yH3N/OP77z6VERRFgKmxvdMW+SOm5ZDTSARpLBwIvNvHfd821N7r4+JgDz0FE4c1JM1Me/+0BQyN5M9oCsQfVdJjDTGk8oZo4Q4QK4uxrVo97Mi388mGe5jbH2LjjMpR4NNOPcmNMW8sCO3Wa6uTft6qb/cVRbHLXbx+czl/HyhwhmqfP2q3f/pZn+3v6Zos0duZJDC9vZFzuywI+AIWUyoOaJzkIcI+dTzFKmnJjMk2UhND31dP2zswgCflfa8zKNnbwgOQ1zvxz2TBLC1K55AOBxW0BnHjklSC22/YvwtZw== 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=kL8lolMTkO63Fg/K73nW307o00cEo5h5ZAlDpKI4w8E=; b=NjgeEQenEU9kh6vJy6qOPI39dh05eQnlTzg+H4WqctFZ9kdMbaaKtSZEfT6/L6g0Yij2SbDRTwmIzA5yrMMSMA9FCoDuXEoHj14v9K9x5ijZ/De7k5E/t8OvbIl8A1Y1LWNOsJ4AMSiOSvCIxPzxbljbJ23G4QjviuzARoGHwLKWNb1lltgAzTrNvDJPoikpqkDTh0NUTKUUC3F+DDI25wRGyh4XC+BQkZY3o3lT93Dt8fg6K8awiSAQZWqToOViU8e9c1T9tafVZZzVuCulktyLVeB3dFFkAte2shCOUPJ9mnYM/xdXfeerOUC4Kz2WN003lnVfTtEcnupv5A7eEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=kL8lolMTkO63Fg/K73nW307o00cEo5h5ZAlDpKI4w8E=; b=VlvH5IITFy9Y0E9rgOVy1jTNPYvjWu6sznZFVyE2s2BpsrMzfETm4AxICFsRFO8Qbdsw51tk+v02VzMK+MaNdXVKA0fE1lsFPVlrBgA8CXInl09iVfXYQh+eUDb5SZmZHz2bQR4avBAVboyTDYswPE+89LY26IghDGCR5uDTAjU= Received: from SN4PR0701CA0016.namprd07.prod.outlook.com (2603:10b6:803:28::26) by DM6PR02MB6234.namprd02.prod.outlook.com (2603:10b6:5:1f5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18; Sat, 26 Jun 2021 10:28:32 +0000 Received: from SN1NAM02FT0064.eop-nam02.prod.protection.outlook.com (2603:10b6:803:28:cafe::24) by SN4PR0701CA0016.outlook.office365.com (2603:10b6:803:28::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.19 via Frontend Transport; Sat, 26 Jun 2021 10:28:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0064.mail.protection.outlook.com (10.97.4.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:28:32 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 26 Jun 2021 03:28:16 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Sat, 26 Jun 2021 03:28:16 -0700 Received: from [10.140.6.6] (port=55646 helo=xhdappanad40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lx5Xr-000AWJ-GV; Sat, 26 Jun 2021 03:28:15 -0700 From: Raviteja Narayanam To: , CC: , , , , , Raviteja Narayanam Subject: [PATCH v2 01/10] i2c: xiic: Fix Tx Interrupt path for grouped messages Date: Sat, 26 Jun 2021 15:57:57 +0530 Message-ID: <20210626102806.15402-2-raviteja.narayanam@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> References: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 452f3eca-8e9b-4f69-33ce-08d9388d25be X-MS-TrafficTypeDiagnostic: DM6PR02MB6234: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pWRMzQMPoWffA6sWITgJVEqjqrFqDppQ6NYVkN9IItPEXCdq72VFezrddbjoulUuYDNOEFmZ4fRlzBnJetaXvIvp4Ha4bLAxFwGVRkFjffghlrCj7hU/v9KDQuj441rBUdKa72kFAmpDyOWWKQKULydX6FEZnxyCGSYU9a9uGc84q7Z/hD3JYMQk/m5TS10PYq6K9HHJ6l8IFFFJI+i5K77tUaS5JL5l0eV3LR3VxOwfILy0NYTo9KwT3LNqq1UmBhk6SkCYW+laxWZ5h1jYNA5EjBoLUv5u/Lp93h2ViLvSFVhkEutdYrkKwSzg1Tntws2Xxdm8HfSGO/vvQYL1wARG/JocfVGdWyV+eXiH4KW70kSy6nu9bhyVwU0JfKhIRLkdqY/lnuazRMJUKn4YMy4A5fhuBVg8yy1RahzzjFHm7YnOVt4TEWaXfz8Vqft+Uz0p5QwORwJzm8+d/jh4IO98WaZyvjaA+sG+gBmx9510MBENmouI6kmnzuqX5dziTWajJGGEtRqZEsDanRDzNnCHcMy7Bj9FDXzEgh6wB22JvTlGlTLr4LHoJMLcEDj2GJn3q1/QmFHZGAUEjketJdJBtG5VzqgwTLyVcO+R9/AH/RJTHA3xUVf3tNnjzbl01yc64+WLDDWw0dtWrs+xmHwX2JYJNKgk99H6aQZX9vIlPG/Z0QJ5y9XI3wayuuZd X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(136003)(396003)(346002)(376002)(39860400002)(46966006)(36840700001)(70586007)(478600001)(2616005)(9786002)(7696005)(110136005)(54906003)(70206006)(2906002)(1076003)(36756003)(336012)(7636003)(316002)(36906005)(356005)(6636002)(15650500001)(6666004)(8936002)(5660300002)(36860700001)(107886003)(426003)(44832011)(4326008)(82310400003)(82740400003)(83380400001)(26005)(47076005)(186003)(8676002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2021 10:28:32.3612 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 452f3eca-8e9b-4f69-33ce-08d9388d25be X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0064.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6234 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210626_032838_282796_9D7723E6 X-CRM114-Status: GOOD ( 12.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When a group of messages are sent from user space as a set, if the last message has less than Tx FIFO DEPTH number of bytes to transfer, Tx half empty interrupt is triggered continuously from the hardware. It is due to Bus not busy interrupt coming along with Tx half empty and tx empty. Hence, service the Tx interrupts before Bus not busy interrupt to update the i2c message status correctly. Signed-off-by: Raviteja Narayanam --- drivers/i2c/busses/i2c-xiic.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 2a8568b97c14..b0cfd9d15467 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -453,22 +453,6 @@ static irqreturn_t xiic_process(int irq, void *dev_id) } } } - if (pend & XIIC_INTR_BNB_MASK) { - /* IIC bus has transitioned to not busy */ - clr |= XIIC_INTR_BNB_MASK; - - /* The bus is not busy, disable BusNotBusy interrupt */ - xiic_irq_dis(i2c, XIIC_INTR_BNB_MASK); - - if (!i2c->tx_msg) - goto out; - - if ((i2c->nmsgs == 1) && !i2c->rx_msg && - xiic_tx_space(i2c) == 0) - xiic_wakeup(i2c, STATE_DONE); - else - xiic_wakeup(i2c, STATE_ERROR); - } if (pend & (XIIC_INTR_TX_EMPTY_MASK | XIIC_INTR_TX_HALF_MASK)) { /* Transmit register/FIFO is empty or ½ empty */ @@ -505,6 +489,24 @@ static irqreturn_t xiic_process(int irq, void *dev_id) */ xiic_irq_dis(i2c, XIIC_INTR_TX_HALF_MASK); } + + if (pend & XIIC_INTR_BNB_MASK) { + /* IIC bus has transitioned to not busy */ + clr |= XIIC_INTR_BNB_MASK; + + /* The bus is not busy, disable BusNotBusy interrupt */ + xiic_irq_dis(i2c, XIIC_INTR_BNB_MASK); + + if (!i2c->tx_msg) + goto out; + + if (i2c->nmsgs == 1 && !i2c->rx_msg && + xiic_tx_space(i2c) == 0) + xiic_wakeup(i2c, STATE_DONE); + else + xiic_wakeup(i2c, STATE_ERROR); + } + out: dev_dbg(i2c->adap.dev.parent, "%s clr: 0x%x\n", __func__, clr); From patchwork Sat Jun 26 10:27:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raviteja Narayanam X-Patchwork-Id: 12346391 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A652C49EA6 for ; Sat, 26 Jun 2021 10:31:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 0371E61939 for ; Sat, 26 Jun 2021 10:31:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0371E61939 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=25ZglBIeVKFvYIUqZw2QU4RljDBJlevGDUaLcwqUHLE=; b=pZy4VdLbpnXyFb NhkQhM1bQljrJRIgKdo6IbeN8uqdy5CZBf6sxn5qldtuOXfbxsaMWce17A6ewrl29QLNN1LgYMtjZ WRM8gCsbPUGBGcei3smCe0mCjk6zCuLxYD3knkmwz7Ac/umoYwVMvSKv62i3Ul3Vmqmeqrr4jeYYF ddz2BtLOhEGqtymY7wnshUieoTnz5iOAqn45gNCSnr7x1+1RNPUl/E0qKNIbADPMHOsaZiGXrZgvZ QncMaTNW/gfCHYmZBZFZrGNmc5OQbQQfREiOUzzp+5mrgqj925G4jj6fAJ/qpaJx6wBxzjqsXLSmZ Mz5ZHRkokCpuJ2fuLn9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5YU-003s9z-SL; Sat, 26 Jun 2021 10:28:55 +0000 Received: from mail-co1nam11on2057.outbound.protection.outlook.com ([40.107.220.57] helo=NAM11-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5YF-003s6R-Sj for linux-arm-kernel@lists.infradead.org; Sat, 26 Jun 2021 10:28:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nFFrY6RmdgdJ4iW7BWPvA7YopUgKOuJvgercwXUWjMKbzqYcX0mp0gDvkJQpX6RJT6OYEnjVJoUny8qZWY88jhKuGOkZkMarw6iJfWx80EsnBj0NPgDYUxALvHPKPHR7QXJtbptqbaToRa9Pn37Y8h43VDcveOFfW3OVmF3pNAwam7NPeKT7yaYPrWYI9tmhhkLnQF+2PdIrs6C4/iyXu3UjDJlZtZKBt74381/Qyvjqw8n0mrCpv2U6+Gsvwf3KGnIE92qE5AozYcgY5FK/NXqC5oa7T3L+/D+GzZbbFxItnBefvadYKML3gzIHzfgiDdeQNPUhQaFzSyvGahTCjA== 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=b8YWvGcRhX1Wp0SGqnRKhxCjN2UKT+g0wXrkPJChmMM=; b=IPdM/RsjWzgP70uYdZWsJCnw/5OD3PUK4T6fMSjNSqNHCZdlTUxERye29oWW3cp/zl0PEolYfXIlT/0XA8x4BGHqUEVlpLvgHdbZLXIose3HiP5HPCdMUrxapcyoo4tACav2V0ifope6oqelymYeEYzrXXAh5esm8ShjGTu/mo8LGsvnRytiGwQE0S8ejXMDXtx08uMY1msfDAIL7HvfbLUb8qkcd0Fc53fAg1M79BQIlNRGKcBQ+KJagCnDNjoo6UBA70uOBx3eCnWxBLHEwQ/SHsjht+rJB/OztEK1+rsXfuxvTpcmNCiTFGcJEQCj/K6RVzfrLzGTQ82sTovy5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=b8YWvGcRhX1Wp0SGqnRKhxCjN2UKT+g0wXrkPJChmMM=; b=BwHZaJJ2pKd8I+nc4sL4fxbr6JnmZvWtKfP4IxoNzY8tvGJzSSUNfPKC0hqSL7MoqeMxg47v81tTq/OtS/TV/vP5k+XqEHbnLNnV3oob01CUeR+E5E7EmEN3DP4YgVTZyY6hZRBqbh3am+5KItOG+aqVHK/9n5PF8eQHphYZD4I= Received: from SA0PR11CA0177.namprd11.prod.outlook.com (2603:10b6:806:1bb::32) by DM5PR02MB3765.namprd02.prod.outlook.com (2603:10b6:4:b2::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.24; Sat, 26 Jun 2021 10:28:37 +0000 Received: from SN1NAM02FT0061.eop-nam02.prod.protection.outlook.com (2603:10b6:806:1bb:cafe::79) by SA0PR11CA0177.outlook.office365.com (2603:10b6:806:1bb::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:28:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0061.mail.protection.outlook.com (10.97.4.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:28:36 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 26 Jun 2021 03:28:20 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Sat, 26 Jun 2021 03:28:20 -0700 Received: from [10.140.6.6] (port=55646 helo=xhdappanad40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lx5Xv-000AWJ-Aw; Sat, 26 Jun 2021 03:28:19 -0700 From: Raviteja Narayanam To: , CC: , , , , , Raviteja Narayanam Subject: [PATCH v2 02/10] i2c: xiic: Add standard mode support for > 255 byte read transfers Date: Sat, 26 Jun 2021 15:57:58 +0530 Message-ID: <20210626102806.15402-3-raviteja.narayanam@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> References: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 18a6c846-7710-47cc-d375-08d9388d2824 X-MS-TrafficTypeDiagnostic: DM5PR02MB3765: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:232; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XIS0Nf0EBIVqrw4ANGSzyVYUcC91yDHs2zd4HprUgtu4lvhJkqYLLlFDABUijo2msSbDerOYHZ2cx5cBR8JYE62Rk9zMo9GZ2wIxR3UY2hXMcYPWJGD7GCSdc+wM0CIR7eAH2lMe7ApnNe8YDOq9B06nT49TNmsSZwX++eo6ObxD6n1WuCe7xOFCP4ltO7TiVF+3WyRsfNdkRI3Om9HJh1AHWTUOVJBkJA9wJZf/iS2ovhnw+MeCQmgFarTqeK4VniZmS9yQMQVbI8aD2XCReacZ53+O8Qrr3cPArnsSuZDFMxajSJCEWtTLE+4EXhB4ywWnx02kBCqxFSp2mmfOMbklppL9Nd7mkC08X4Ut2vY1ykX2SytE29xtq7uyyEPzQRtVcQxqTfRbr2EIzTHvEB2NGgRAKtpUBe3rpkJ4Lp5smFJotNNL7bk73cAJV8xm5BKOIUhT3QouGNnN+aoNx5TPB8mGrkg+O+43h/cGaVsLZT1xUH74euugwUK7vFv8/bVEvnBKfrHfRjFb5ovwSsJVff8H6I6FwK1bJDESMoeRt3xfAixXLycMRhwoI5Y/NMJkpHPcv7tfFE1KFO2+u/bZVZeOjXHPwXiqZKh+pIr6DZdnEr/V0txaQN3zyRhuLzz6tZAqkLeyVmtvX9HaxQqSa24tRpFH3VthqNg+cIRC3S+tQeIP5lB+u52wwjf5dlzxBf+hamxLb9JN+YO6QNAJFcTqYNJarERPNkdQhi8= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(376002)(39860400002)(136003)(396003)(346002)(46966006)(36840700001)(336012)(70206006)(36860700001)(6636002)(36906005)(8936002)(54906003)(82740400003)(316002)(356005)(5660300002)(82310400003)(30864003)(8676002)(83380400001)(2906002)(7636003)(44832011)(1076003)(9786002)(186003)(7696005)(26005)(110136005)(70586007)(2616005)(107886003)(4326008)(6666004)(36756003)(426003)(478600001)(47076005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2021 10:28:36.3882 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 18a6c846-7710-47cc-d375-08d9388d2824 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0061.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB3765 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210626_032840_052306_952D60F2 X-CRM114-Status: GOOD ( 33.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In the current driver implementation, there is a limit of read transfer size to 255 bytes as it is using AXI I2C dynamic mode. But the IP supports this transfer through standard mode. So added AXI I2C standard mode support to enable read transfers of size more than 255 bytes. The driver scans through the message request from user space and selects AXI I2C standard mode if there is a read request of more than 255 bytes. Then the whole message goes through standard mode Tx and Rx paths. Signed-off-by: Raviteja Narayanam --- drivers/i2c/busses/i2c-xiic.c | 367 +++++++++++++++++++++++++++++----- 1 file changed, 319 insertions(+), 48 deletions(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index b0cfd9d15467..004103267e9c 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -60,6 +60,8 @@ enum xiic_endian { * @clk: Pointer to AXI4-lite input clock * @state: See STATE_ * @singlemaster: Indicates bus is single master + * @dynamic: Mode of controller + * @prev_msg_tx: Previous message is Tx */ struct xiic_i2c { struct device *dev; @@ -76,6 +78,8 @@ struct xiic_i2c { struct clk *clk; enum xilinx_i2c_state state; bool singlemaster; + bool dynamic; + bool prev_msg_tx; }; @@ -144,6 +148,9 @@ struct xiic_i2c { #define XIIC_TX_DYN_START_MASK 0x0100 /* 1 = Set dynamic start */ #define XIIC_TX_DYN_STOP_MASK 0x0200 /* 1 = Set dynamic stop */ +/* Dynamic mode constants */ +#define MAX_READ_LENGTH_DYNAMIC 255 /* Max length for dynamic read */ + /* * The following constants define the register offsets for the Interrupt * registers. There are some holes in the memory map for reserved addresses @@ -270,6 +277,24 @@ static int xiic_clear_rx_fifo(struct xiic_i2c *i2c) return 0; } +static int xiic_wait_tx_empty(struct xiic_i2c *i2c) +{ + u8 isr; + unsigned long timeout; + + timeout = jiffies + XIIC_I2C_TIMEOUT; + for (isr = xiic_getreg32(i2c, XIIC_IISR_OFFSET); + !(isr & XIIC_INTR_TX_EMPTY_MASK); + isr = xiic_getreg32(i2c, XIIC_IISR_OFFSET)) { + if (time_after(jiffies, timeout)) { + dev_err(i2c->dev, "Timeout waiting at Tx empty\n"); + return -ETIMEDOUT; + } + } + + return 0; +} + static int xiic_reinit(struct xiic_i2c *i2c) { int ret; @@ -311,13 +336,14 @@ static void xiic_deinit(struct xiic_i2c *i2c) static void xiic_read_rx(struct xiic_i2c *i2c) { - u8 bytes_in_fifo; + u8 bytes_in_fifo, cr = 0, bytes_to_read = 0; + u32 bytes_rem = 0; int i; bytes_in_fifo = xiic_getreg8(i2c, XIIC_RFO_REG_OFFSET) + 1; dev_dbg(i2c->adap.dev.parent, - "%s entry, bytes in fifo: %d, msg: %d, SR: 0x%x, CR: 0x%x\n", + "%s entry, bytes in fifo: %d, rem: %d, SR: 0x%x, CR: 0x%x\n", __func__, bytes_in_fifo, xiic_rx_space(i2c), xiic_getreg8(i2c, XIIC_SR_REG_OFFSET), xiic_getreg8(i2c, XIIC_CR_REG_OFFSET)); @@ -325,13 +351,53 @@ static void xiic_read_rx(struct xiic_i2c *i2c) if (bytes_in_fifo > xiic_rx_space(i2c)) bytes_in_fifo = xiic_rx_space(i2c); - for (i = 0; i < bytes_in_fifo; i++) + bytes_to_read = bytes_in_fifo; + + if (!i2c->dynamic) { + bytes_rem = xiic_rx_space(i2c) - bytes_in_fifo; + + if (bytes_rem > IIC_RX_FIFO_DEPTH) { + bytes_to_read = bytes_in_fifo; + } else if (bytes_rem > 1) { + bytes_to_read = bytes_rem - 1; + } else if (bytes_rem == 1) { + bytes_to_read = 1; + /* Set NACK in CR to indicate slave transmitter */ + cr = xiic_getreg8(i2c, XIIC_CR_REG_OFFSET); + xiic_setreg8(i2c, XIIC_CR_REG_OFFSET, cr | + XIIC_CR_NO_ACK_MASK); + } else if (bytes_rem == 0) { + bytes_to_read = bytes_in_fifo; + + /* Generate stop on the bus if it is last message */ + if (i2c->nmsgs == 1) { + cr = xiic_getreg8(i2c, XIIC_CR_REG_OFFSET); + xiic_setreg8(i2c, XIIC_CR_REG_OFFSET, cr & + ~XIIC_CR_MSMS_MASK); + } + + /* Make TXACK=0, clean up for next transaction */ + cr = xiic_getreg8(i2c, XIIC_CR_REG_OFFSET); + xiic_setreg8(i2c, XIIC_CR_REG_OFFSET, cr & + ~XIIC_CR_NO_ACK_MASK); + } + } + + /* Read the fifo */ + for (i = 0; i < bytes_to_read; i++) { i2c->rx_msg->buf[i2c->rx_pos++] = xiic_getreg8(i2c, XIIC_DRR_REG_OFFSET); + } - xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, - (xiic_rx_space(i2c) > IIC_RX_FIFO_DEPTH) ? - IIC_RX_FIFO_DEPTH - 1 : xiic_rx_space(i2c) - 1); + if (i2c->dynamic) { + u8 bytes; + + /* Receive remaining bytes if less than fifo depth */ + bytes = min_t(u8, xiic_rx_space(i2c), IIC_RX_FIFO_DEPTH); + bytes--; + + xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, bytes); + } } static int xiic_tx_fifo_space(struct xiic_i2c *i2c) @@ -361,6 +427,62 @@ static void xiic_fill_tx_fifo(struct xiic_i2c *i2c) } } +static void xiic_std_fill_tx_fifo(struct xiic_i2c *i2c) +{ + u8 fifo_space = xiic_tx_fifo_space(i2c); + u16 data = 0; + int len = xiic_tx_space(i2c); + + dev_dbg(i2c->adap.dev.parent, "%s entry, len: %d, fifo space: %d\n", + __func__, len, fifo_space); + + if (len > fifo_space) + len = fifo_space; + else if (len && !(i2c->nmsgs > 1)) + len--; + + while (len--) { + data = i2c->tx_msg->buf[i2c->tx_pos++]; + xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, data); + } +} + +static void xiic_send_tx(struct xiic_i2c *i2c) +{ + dev_dbg(i2c->adap.dev.parent, + "%s entry, rem: %d, SR: 0x%x, CR: 0x%x\n", + __func__, xiic_tx_space(i2c), + xiic_getreg8(i2c, XIIC_SR_REG_OFFSET), + xiic_getreg8(i2c, XIIC_CR_REG_OFFSET)); + + if (xiic_tx_space(i2c) > 1) { + xiic_std_fill_tx_fifo(i2c); + return; + } + + if ((xiic_tx_space(i2c) == 1)) { + u16 data; + + if (i2c->nmsgs == 1) { + u8 cr; + int status; + + /* Wait till FIFO is empty so STOP is sent last */ + status = xiic_wait_tx_empty(i2c); + if (status) + return; + + /* Write to CR to stop */ + cr = xiic_getreg8(i2c, XIIC_CR_REG_OFFSET); + xiic_setreg8(i2c, XIIC_CR_REG_OFFSET, cr & + ~XIIC_CR_MSMS_MASK); + } + /* Send last byte */ + data = i2c->tx_msg->buf[i2c->tx_pos++]; + xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, data); + } +} + static void xiic_wakeup(struct xiic_i2c *i2c, int code) { i2c->tx_msg = NULL; @@ -391,7 +513,9 @@ static irqreturn_t xiic_process(int irq, void *dev_id) dev_dbg(i2c->adap.dev.parent, "%s: SR: 0x%x, msg: %p, nmsgs: %d\n", __func__, xiic_getreg8(i2c, XIIC_SR_REG_OFFSET), i2c->tx_msg, i2c->nmsgs); - + dev_dbg(i2c->adap.dev.parent, "%s, ISR: 0x%x, CR: 0x%x\n", + __func__, xiic_getreg32(i2c, XIIC_IISR_OFFSET), + xiic_getreg8(i2c, XIIC_CR_REG_OFFSET)); /* Service requesting interrupt */ if ((pend & XIIC_INTR_ARB_LOST_MASK) || @@ -465,7 +589,10 @@ static irqreturn_t xiic_process(int irq, void *dev_id) goto out; } - xiic_fill_tx_fifo(i2c); + if (i2c->dynamic) + xiic_fill_tx_fifo(i2c); + else + xiic_send_tx(i2c); /* current message sent and there is space in the fifo */ if (!xiic_tx_space(i2c) && xiic_tx_fifo_space(i2c) >= 2) { @@ -554,35 +681,113 @@ static int xiic_busy(struct xiic_i2c *i2c) static void xiic_start_recv(struct xiic_i2c *i2c) { - u8 rx_watermark; + u16 rx_watermark; + u8 cr = 0, rfd_set = 0; struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg; unsigned long flags; - /* Clear and enable Rx full interrupt. */ - xiic_irq_clr_en(i2c, XIIC_INTR_RX_FULL_MASK | XIIC_INTR_TX_ERROR_MASK); + dev_dbg(i2c->adap.dev.parent, "%s entry, ISR: 0x%x, CR: 0x%x\n", + __func__, xiic_getreg32(i2c, XIIC_IISR_OFFSET), + xiic_getreg8(i2c, XIIC_CR_REG_OFFSET)); + + /* Disable Tx interrupts */ + xiic_irq_dis(i2c, XIIC_INTR_TX_HALF_MASK | XIIC_INTR_TX_EMPTY_MASK); - /* we want to get all but last byte, because the TX_ERROR IRQ is used - * to inidicate error ACK on the address, and negative ack on the last - * received byte, so to not mix them receive all but last. - * In the case where there is only one byte to receive - * we can check if ERROR and RX full is set at the same time - */ - rx_watermark = msg->len; - if (rx_watermark > IIC_RX_FIFO_DEPTH) - rx_watermark = IIC_RX_FIFO_DEPTH; - xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, rx_watermark - 1); - - local_irq_save(flags); - if (!(msg->flags & I2C_M_NOSTART)) - /* write the address */ + if (i2c->dynamic) { + u8 bytes; + u16 val; + + /* Clear and enable Rx full interrupt. */ + xiic_irq_clr_en(i2c, XIIC_INTR_RX_FULL_MASK | + XIIC_INTR_TX_ERROR_MASK); + + /* + * We want to get all but last byte, because the TX_ERROR IRQ + * is used to indicate error ACK on the address, and + * negative ack on the last received byte, so to not mix + * them receive all but last. + * In the case where there is only one byte to receive + * we can check if ERROR and RX full is set at the same time + */ + rx_watermark = msg->len; + bytes = min_t(u8, rx_watermark, IIC_RX_FIFO_DEPTH); + bytes--; + + xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, bytes); + + local_irq_save(flags); + if (!(msg->flags & I2C_M_NOSTART)) + /* write the address */ + xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, + i2c_8bit_addr_from_msg(msg) | + XIIC_TX_DYN_START_MASK); + + xiic_irq_clr_en(i2c, XIIC_INTR_BNB_MASK); + + /* If last message, include dynamic stop bit with length */ + val = (i2c->nmsgs == 1) ? XIIC_TX_DYN_STOP_MASK : 0; + val |= msg->len; + + xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, val); + local_irq_restore(flags); + } else { + /* + * If previous message is Tx, make sure that Tx FIFO is empty + * before starting a new transfer as the repeated start in + * standard mode can corrupt the transaction if there are + * still bytes to be transmitted in FIFO + */ + if (i2c->prev_msg_tx) { + int status; + + status = xiic_wait_tx_empty(i2c); + if (status) + return; + } + + cr = xiic_getreg8(i2c, XIIC_CR_REG_OFFSET); + + /* Set Receive fifo depth */ + rx_watermark = msg->len; + if (rx_watermark > IIC_RX_FIFO_DEPTH) { + rfd_set = IIC_RX_FIFO_DEPTH - 1; + } else if ((rx_watermark == 1) || (rx_watermark == 0)) { + rfd_set = rx_watermark - 1; + /* Handle single byte transfer separately */ + cr |= XIIC_CR_NO_ACK_MASK; + } else { + rfd_set = rx_watermark - 2; + } + + /* Check if RSTA should be set */ + if (cr & XIIC_CR_MSMS_MASK) { + /* Already a master, RSTA should be set */ + xiic_setreg8(i2c, XIIC_CR_REG_OFFSET, (cr | + XIIC_CR_REPEATED_START_MASK) & + ~(XIIC_CR_DIR_IS_TX_MASK)); + } + + xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, rfd_set); + + /* Clear and enable Rx full and transmit complete interrupts */ + xiic_irq_clr_en(i2c, XIIC_INTR_RX_FULL_MASK | + XIIC_INTR_TX_ERROR_MASK); + + /* Write the address */ xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, - i2c_8bit_addr_from_msg(msg) | XIIC_TX_DYN_START_MASK); + i2c_8bit_addr_from_msg(msg)); - xiic_irq_clr_en(i2c, XIIC_INTR_BNB_MASK); + /* Write to Control Register,to start transaction in Rx mode */ + if ((cr & XIIC_CR_MSMS_MASK) == 0) { + xiic_setreg8(i2c, XIIC_CR_REG_OFFSET, (cr | + XIIC_CR_MSMS_MASK) + & ~(XIIC_CR_DIR_IS_TX_MASK)); + } - xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, - msg->len | ((i2c->nmsgs == 1) ? XIIC_TX_DYN_STOP_MASK : 0)); - local_irq_restore(flags); + dev_dbg(i2c->adap.dev.parent, "%s end, ISR: 0x%x, CR: 0x%x\n", + __func__, xiic_getreg32(i2c, XIIC_IISR_OFFSET), + xiic_getreg8(i2c, XIIC_CR_REG_OFFSET)); + } if (i2c->nmsgs == 1) /* very last, enable bus not busy as well */ @@ -590,10 +795,17 @@ static void xiic_start_recv(struct xiic_i2c *i2c) /* the message is tx:ed */ i2c->tx_pos = msg->len; + + /* Enable interrupts */ + xiic_setreg32(i2c, XIIC_DGIER_OFFSET, XIIC_GINTR_ENABLE_MASK); + + i2c->prev_msg_tx = false; } static void xiic_start_send(struct xiic_i2c *i2c) { + u8 cr = 0; + u16 data; struct i2c_msg *msg = i2c->tx_msg; xiic_irq_clr(i2c, XIIC_INTR_TX_ERROR_MASK); @@ -604,22 +816,71 @@ static void xiic_start_send(struct xiic_i2c *i2c) __func__, xiic_getreg32(i2c, XIIC_IISR_OFFSET), xiic_getreg8(i2c, XIIC_CR_REG_OFFSET)); - if (!(msg->flags & I2C_M_NOSTART)) { - /* write the address */ - u16 data = i2c_8bit_addr_from_msg(msg) | - XIIC_TX_DYN_START_MASK; - if ((i2c->nmsgs == 1) && msg->len == 0) - /* no data and last message -> add STOP */ - data |= XIIC_TX_DYN_STOP_MASK; + if (i2c->dynamic) { + if (!(msg->flags & I2C_M_NOSTART)) { + /* write the address */ + data = i2c_8bit_addr_from_msg(msg) | + XIIC_TX_DYN_START_MASK; + + if (i2c->nmsgs == 1 && msg->len == 0) + /* no data and last message -> add STOP */ + data |= XIIC_TX_DYN_STOP_MASK; + + xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, data); + } + + xiic_fill_tx_fifo(i2c); + + /* Clear any pending Tx empty, Tx Error and then enable them */ + xiic_irq_clr_en(i2c, (XIIC_INTR_TX_EMPTY_MASK | + XIIC_INTR_TX_ERROR_MASK | + XIIC_INTR_BNB_MASK)); + } else { + /* + * If previous message is Tx, make sure that Tx FIFO is empty + * before starting a new transfer as the repeated start in + * standard mode can corrupt the transaction if there are + * still bytes to be transmitted in FIFO + */ + if (i2c->prev_msg_tx) { + int status; + + status = xiic_wait_tx_empty(i2c); + if (status) + return; + } + /* Check if RSTA should be set */ + cr = xiic_getreg8(i2c, XIIC_CR_REG_OFFSET); + if (cr & XIIC_CR_MSMS_MASK) { + /* Already a master, RSTA should be set */ + xiic_setreg8(i2c, XIIC_CR_REG_OFFSET, (cr | + XIIC_CR_REPEATED_START_MASK | + XIIC_CR_DIR_IS_TX_MASK) & + ~(XIIC_CR_NO_ACK_MASK)); + } + + /* Write address to FIFO */ + data = i2c_8bit_addr_from_msg(msg); xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, data); - } + /* Fill fifo */ + xiic_std_fill_tx_fifo(i2c); - xiic_fill_tx_fifo(i2c); + if ((cr & XIIC_CR_MSMS_MASK) == 0) { - /* Clear any pending Tx empty, Tx Error and then enable them. */ - xiic_irq_clr_en(i2c, XIIC_INTR_TX_EMPTY_MASK | XIIC_INTR_TX_ERROR_MASK | - XIIC_INTR_BNB_MASK); + /* Start Tx by writing to CR */ + cr = xiic_getreg8(i2c, XIIC_CR_REG_OFFSET); + xiic_setreg8(i2c, XIIC_CR_REG_OFFSET, cr | + XIIC_CR_MSMS_MASK | + XIIC_CR_DIR_IS_TX_MASK); + } + + /* Clear any pending Tx empty, Tx Error and then enable them */ + xiic_irq_clr_en(i2c, XIIC_INTR_TX_EMPTY_MASK | + XIIC_INTR_TX_ERROR_MASK | + XIIC_INTR_BNB_MASK); + } + i2c->prev_msg_tx = true; } static irqreturn_t xiic_isr(int irq, void *dev_id) @@ -703,7 +964,7 @@ static int xiic_start_xfer(struct xiic_i2c *i2c) static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { struct xiic_i2c *i2c = i2c_get_adapdata(adap); - int err; + int err, count; dev_dbg(adap->dev.parent, "%s entry SR: 0x%x\n", __func__, xiic_getreg8(i2c, XIIC_SR_REG_OFFSET)); @@ -719,6 +980,21 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) i2c->tx_msg = msgs; i2c->nmsgs = num; + /* Decide standard mode or Dynamic mode */ + i2c->dynamic = true; + + /* Initialize prev message type */ + i2c->prev_msg_tx = false; + + /* Enter standard mode only when read length is > 255 bytes */ + for (count = 0; count < i2c->nmsgs; count++) { + if ((i2c->tx_msg[count].flags & I2C_M_RD) && + i2c->tx_msg[count].len > MAX_READ_LENGTH_DYNAMIC) { + i2c->dynamic = false; + break; + } + } + err = xiic_start_xfer(i2c); if (err < 0) { dev_err(adap->dev.parent, "Error xiic_start_xfer\n"); @@ -752,16 +1028,11 @@ static const struct i2c_algorithm xiic_algorithm = { .functionality = xiic_func, }; -static const struct i2c_adapter_quirks xiic_quirks = { - .max_read_len = 255, -}; - static const struct i2c_adapter xiic_adapter = { .owner = THIS_MODULE, .name = DRIVER_NAME, .class = I2C_CLASS_DEPRECATED, .algo = &xiic_algorithm, - .quirks = &xiic_quirks, }; From patchwork Sat Jun 26 10:27:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raviteja Narayanam X-Patchwork-Id: 12346393 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EEADC49EA5 for ; Sat, 26 Jun 2021 10:31:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 4561461931 for ; Sat, 26 Jun 2021 10:31:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4561461931 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t6ZQmDMkRgOj/pA7pLqEgTpWHXHBjbb2C6lfa4H0RlM=; b=DO4E+Q2tdCe9Tz T3N9BnbknLIxd2D5IBtwn2K5+Q/vYODDLXuu950SrRGK5oxEEKV6CtdIK6u/tf/vK4VTJ/6BD6gAR 6vVwFwJGz9AJDgufw0x4o1jPPaU2pyo2mEA67bRZymbwvQLRVkOI/VKDX78BnyavfnbfkIhhM+1DI 6MfQXm67UyfyaTDbVARuaimxW8hiPhBgImQZZ7mDYoCSu0+37+W8erY71loH6zS52711lUc7oMP1Z kAlSucpNnzymd0GA546Riffkc1JTJLlJRGaOlRyd3dz8Gxu4kI6hwZfT76PjAGsiYoP3ORe/bgkH1 K4ouumbBoonOLF2SIazw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5Yh-003sCj-7y; Sat, 26 Jun 2021 10:29:07 +0000 Received: from mail-dm6nam11on2086.outbound.protection.outlook.com ([40.107.223.86] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5YJ-003s7F-CZ for linux-arm-kernel@lists.infradead.org; Sat, 26 Jun 2021 10:28:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PxsMmjOm7TkpApjJYDicRTYwJoXFP6IieoYdJ2L0p1WhhNE5erDGFvYyirqaKjKQWJV53qufe1tLqauPuCbnq5Mgu+YXdVgeZH5Sb9S+xGkWL2HTvpqBfVnLpcfWkiDoRAmM7E899qw+BOwJ17duFvlD4PZ6tjfd0pSCSjHoLxi4Nvq0giDlgk5+3VeicAsuL1NuYFX55zldGEXzpgMNUpdqxtGU3b6MAWivSumMfAVIRqPQoBMbW/EEqz31I5ufuMTS6Kc7Sl/TyOw8nI1fHMz+418LFXcNrS29FDvZELU8LdkHp0B8OihLY9/suj9E3hDwtQ8V7/EEcOr/mEni8g== 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=hXKCqVaK3KBPFimqqPK6oUy9SddBtUFw0eGUpOZA+WQ=; b=al8/SQmWhUXo+9xlj+oy6x6ZJH47LRmgaApNXhH5BP3BAh0OjMuj+4sYJW0sawdgNM4mPBWKpHNyYP6WX/BnvzO8U0aD0s1bCjUPlHveXpQLKGVPzwDImccl3PNdDEgUQcBhRYa92ukwYb/7bFStCQ4Oe7zAQbG2WUREmLHOlfH6hbsT09RrouXkQ7GHHRXum4Ffpe6pvruHlwPFfrZ+90Hxbd8QrFMYwR7lzbTGJM5jQOSEljAcwxDMeUvK2xrpSpThPqrWXqgdYgepSsiSZCBGlKAZGSL5bqvz4frUH7wtWkwG4vI2Jawabnanfks1rH0rh6ryaHBaoN/EXPQnMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=hXKCqVaK3KBPFimqqPK6oUy9SddBtUFw0eGUpOZA+WQ=; b=n3k0M/MdS/zedNjLYU1Wb2Tsj6Px4kGTpt8TqxsswGK4cGT5X3UJBzJKICQnc7CiaGTh2cG9fwAwsDTvNU35cEm0FjoU3raztIMwMXQrbG1YP+rGGOj6SxYtLfJWwoHYPyoBZX73bUDfQgoQ6HKL7kEbJgMot1LRyvdz8im6DFQ= Received: from SA0PR11CA0163.namprd11.prod.outlook.com (2603:10b6:806:1bb::18) by CO6PR02MB7745.namprd02.prod.outlook.com (2603:10b6:303:a3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18; Sat, 26 Jun 2021 10:28:41 +0000 Received: from SN1NAM02FT0061.eop-nam02.prod.protection.outlook.com (2603:10b6:806:1bb:cafe::40) by SA0PR11CA0163.outlook.office365.com (2603:10b6:806:1bb::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.19 via Frontend Transport; Sat, 26 Jun 2021 10:28:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0061.mail.protection.outlook.com (10.97.4.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:28:40 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 26 Jun 2021 03:28:24 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Sat, 26 Jun 2021 03:28:24 -0700 Received: from [10.140.6.6] (port=55646 helo=xhdappanad40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lx5Xz-000AWJ-4c; Sat, 26 Jun 2021 03:28:23 -0700 From: Raviteja Narayanam To: , CC: , , , , , Raviteja Narayanam Subject: [PATCH v2 03/10] i2c: xiic: Switch to Xiic standard mode for i2c-read Date: Sat, 26 Jun 2021 15:57:59 +0530 Message-ID: <20210626102806.15402-4-raviteja.narayanam@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> References: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e1586486-46d5-4f96-519c-08d9388d2adc X-MS-TrafficTypeDiagnostic: CO6PR02MB7745: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H96C24umzG5x57pIUHrbQ34YYTVHZGbK+uagK4F7qa0ZOV7igbJIkiAzbFvJ3lV2oSWIIRj0GKnrC6qqVkhKqQ5cXkm0T+wBWGDjumns8V0Sg/wUASWLAqiZimt1Z4i9DcZ2Utkqz8xO0nzN6jgysagB2OSQifRlRuxNMR7sigjZ+KeeXE1gWZ6V8LHC1sVu2hHgst89e0W6IHhAIJjW6n/+OqBky6c3IUht5izQ7XeIcQlJVHgB63/uhV3uI6HWZi2DLY9sTzRjRjBN6hJuAnLEdvHsMWqo/nt3IwRp7aBxxg1xS9UX7NVoJb4uGcOhUMLHIMxTuwqQThBFmqSxoQhvI7Bvb/QhATRwCxmP9ocDS046oy5nikpSj07qHAeKWuac/1Lsw2MPTWr3CumUaoWdBCW+d4RaBkUE+crY1DjtfCd3zdhIvN+1Ug+kuYbVn1ax6IpbE4S+J5S9i9HkWEZXNkQTz/8sQ2xmJi5wQ4TNCqQnCUPowUIx+tQwZEeVyvDh98DVIOaGBnHCxRicDwN3rT++sr44L6lw90HXDugL4Vz1TRZBxPDm0rq3uIysYCDS4FB/c8TW67BHzBHFP6WJK7W+zxR+zSBSqbOgeqza4WcekziWMIm8+Dn4KmHYJVYnBU06eGIPnTvnY4CB/SM/ymoAjMRR5FYj0Zw/9yipSHcO0aas0oEBXdkEWPHAYQboRSt2AJsvr3N1LJlULQXxdw5WyE3/oSAxzurGS18= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(396003)(39860400002)(136003)(376002)(346002)(36840700001)(46966006)(8936002)(4326008)(1076003)(6666004)(36756003)(44832011)(2616005)(356005)(426003)(316002)(36906005)(47076005)(82310400003)(9786002)(83380400001)(8676002)(82740400003)(5660300002)(107886003)(7696005)(6636002)(336012)(36860700001)(478600001)(2906002)(26005)(186003)(70206006)(70586007)(7636003)(110136005)(54906003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2021 10:28:40.9462 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1586486-46d5-4f96-519c-08d9388d2adc X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0061.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR02MB7745 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210626_032843_484952_D408DEBD X-CRM114-Status: GOOD ( 19.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Xilinx I2C IP has two modes of operation, both of which implement I2C transactions. The only difference from sw perspective is the programming sequence for these modes. Dynamic mode -> Simple to program, less number of steps in sequence. Standard mode -> Gives flexibility, more number of steps in sequence. In dynamic mode, during the i2c-read transactions, if there is a delay(> 200us) between the register writes (address & byte count), read transaction fails. On a system with load, this scenario is occurring frequently. To avoid this, switch to standard mode if there is a read request. Added a quirk to identify the IP version effected by this and follow the standard mode. Signed-off-by: Raviteja Narayanam --- drivers/i2c/busses/i2c-xiic.c | 54 ++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 004103267e9c..c31d0d0a8384 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -33,6 +33,8 @@ #define DRIVER_NAME "xiic-i2c" +#define DYNAMIC_MODE_READ_BROKEN_BIT BIT(0) + enum xilinx_i2c_state { STATE_DONE, STATE_ERROR, @@ -62,6 +64,7 @@ enum xiic_endian { * @singlemaster: Indicates bus is single master * @dynamic: Mode of controller * @prev_msg_tx: Previous message is Tx + * @quirks: To hold platform specific bug info */ struct xiic_i2c { struct device *dev; @@ -80,8 +83,12 @@ struct xiic_i2c { bool singlemaster; bool dynamic; bool prev_msg_tx; + u32 quirks; }; +struct xiic_version_data { + u32 quirks; +}; #define XIIC_MSB_OFFSET 0 #define XIIC_REG_OFFSET (0x100+XIIC_MSB_OFFSET) @@ -963,6 +970,7 @@ static int xiic_start_xfer(struct xiic_i2c *i2c) static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { + bool broken_read, max_read_len; struct xiic_i2c *i2c = i2c_get_adapdata(adap); int err, count; @@ -986,10 +994,21 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) /* Initialize prev message type */ i2c->prev_msg_tx = false; - /* Enter standard mode only when read length is > 255 bytes */ + /* + * Scan through nmsgs, use dynamic mode when none of the below two + * conditions occur. We need standard mode even if one condition holds + * true in the entire array of messages in a single transfer. + * If read transaction as dynamic mode is broken for delayed reads + * in xlnx,axi-iic-2.0 / xlnx,xps-iic-2.00.a IP versions. + * If read length is > 255 bytes. + */ for (count = 0; count < i2c->nmsgs; count++) { - if ((i2c->tx_msg[count].flags & I2C_M_RD) && - i2c->tx_msg[count].len > MAX_READ_LENGTH_DYNAMIC) { + broken_read = (i2c->quirks & DYNAMIC_MODE_READ_BROKEN_BIT) && + (i2c->tx_msg[count].flags & I2C_M_RD); + max_read_len = (i2c->tx_msg[count].flags & I2C_M_RD) && + (i2c->tx_msg[count].len > MAX_READ_LENGTH_DYNAMIC); + + if (broken_read || max_read_len) { i2c->dynamic = false; break; } @@ -1035,11 +1054,23 @@ static const struct i2c_adapter xiic_adapter = { .algo = &xiic_algorithm, }; +static const struct xiic_version_data xiic_2_00 = { + .quirks = DYNAMIC_MODE_READ_BROKEN_BIT, +}; + +#if defined(CONFIG_OF) +static const struct of_device_id xiic_of_match[] = { + { .compatible = "xlnx,xps-iic-2.00.a", .data = &xiic_2_00 }, + {}, +}; +MODULE_DEVICE_TABLE(of, xiic_of_match); +#endif static int xiic_i2c_probe(struct platform_device *pdev) { struct xiic_i2c *i2c; struct xiic_i2c_platform_data *pdata; + const struct of_device_id *match; struct resource *res; int ret, irq; u8 i; @@ -1049,6 +1080,13 @@ static int xiic_i2c_probe(struct platform_device *pdev) if (!i2c) return -ENOMEM; + match = of_match_node(xiic_of_match, pdev->dev.of_node); + if (match && match->data) { + const struct xiic_version_data *data = match->data; + + i2c->quirks = data->quirks; + } + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); i2c->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(i2c->base)) @@ -1129,6 +1167,8 @@ static int xiic_i2c_probe(struct platform_device *pdev) i2c_new_client_device(&i2c->adap, pdata->devices + i); } + dev_info(&pdev->dev, "mmio %08lx irq %d\n", (unsigned long)res->start, irq); + return 0; err_clk_dis: @@ -1160,14 +1200,6 @@ static int xiic_i2c_remove(struct platform_device *pdev) return 0; } -#if defined(CONFIG_OF) -static const struct of_device_id xiic_of_match[] = { - { .compatible = "xlnx,xps-iic-2.00.a", }, - {}, -}; -MODULE_DEVICE_TABLE(of, xiic_of_match); -#endif - static int __maybe_unused xiic_i2c_runtime_suspend(struct device *dev) { struct xiic_i2c *i2c = dev_get_drvdata(dev); From patchwork Sat Jun 26 10:28:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raviteja Narayanam X-Patchwork-Id: 12346395 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 409DCC49EA6 for ; Sat, 26 Jun 2021 10:31:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 10D5161931 for ; Sat, 26 Jun 2021 10:31:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 10D5161931 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=G6vZJm4RTNYJszZ2RhewSaA6wrc9Zzz7Fb+xIZiJFvg=; b=s9mojAK4HBbvbt fZN+Lcj9riksz00lqOeaJXv0c0PWRabNn0ANVBkx1W/OLkhj60oYiYP2rZjmWu0agavy4nvOI7pWs H09MAr7dTGzVYPKWxsE09AFBA9qPb9jqv2KnVK4n8feMZLHiBTRr7jLPX40YhepRbakwger3Vd+C3 JefoT2Kb9iAkimOm5cM2poQjTvhgy/usHepzvj1tS5UgZ6m+//GVF9tFt0i8DKe7iG1D6qHPCAVdX jHbo8ZoYlJFjw1nXfls+hj/Bzja5d+5bNJaSWMF7g3ESFcAHTZsz56RvSDCVVbEyHTzakulM6/v21 Vl7op/hR/U7e60P6x02w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5Yv-003sFn-HA; Sat, 26 Jun 2021 10:29:22 +0000 Received: from mail-dm6nam11on2043.outbound.protection.outlook.com ([40.107.223.43] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5YK-003s7r-TE for linux-arm-kernel@lists.infradead.org; Sat, 26 Jun 2021 10:28:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iFoDIkvMtSxhrR/JB5QiqFAEtwVaFV4emwWcWqamtcyuQgjZalSbxETF23YjG6TCoyphz4rKGFzNbV8m9A3ZEq35/WBT53GsTjnnb+UCSiXvNon41ISxbicfAS9eDAjN/aDv9IZlbgGyCisyDSl27aJdCBj+rFzO3kQoA9LDnI/x75VS01ZFt5pgh6BgfDnOteyNKK31wqO782Eseqp36ItHHC1Ly2RXYqEVdRgr0V38SQeYQghaSh3Q+wOLrwAlbznoFAYOUFL6zBuFVIXr4sIATNAch2zKkX6L8pvbY1+36fzcQKzQa0O5YPAXAai2fgvhMNLJZi+cpG/cRUoNYw== 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=4NDCSf4A1c8Arzt6jcl21UUd+3eeKwp+xRpDDsk18Hs=; b=YRXmf8/hViCMUnVoIAvN9COtaMHS1eDYE1uhuvAOtQVcRM+X+/f/lWP5cXv4q3qsuKVrG4Nv9uQn+6trnsWxzMNewZcA9vcDPg+jiEiilhTjmOUmF47YecV7dMCqiWV+VhrXC8KAfjf0MlTJT2NSiEpmzbMSeTAIjHjow5hvu0FfS+kuVt2D7ElfnOcIoK6HpREbrvCEzCYBuAxTJ5uTMnYjmwDIhOdwF78l675tV2B8DvWAXruzZEa6PdQMbyX5AtsQ8jpY4sxudriRfH9gXsrpzK95iqee0roo61jSJg0o/oBW5okZMpLgq1WzhRciKtdhDXtXtsaohW/Ygqcmqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=4NDCSf4A1c8Arzt6jcl21UUd+3eeKwp+xRpDDsk18Hs=; b=einvYLGLDp4uoskfTH5HwkL099OvkohTAWPcx3tytnJPG2A5gJUkinHp8m6lNPEjx7qKx1f77F1USsCJR0DsI5311iBDskkq4EcleYpCkgfosPkI1pdfJ4oJ0l/VgZzGwwehF12vAS5QGVsJFIxsIbBPLjKZPa1FmaoZTrg8c70= Received: from SA9PR11CA0015.namprd11.prod.outlook.com (2603:10b6:806:6e::20) by DM5PR02MB3339.namprd02.prod.outlook.com (2603:10b6:4:66::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.19; Sat, 26 Jun 2021 10:28:42 +0000 Received: from SN1NAM02FT0005.eop-nam02.prod.protection.outlook.com (2603:10b6:806:6e:cafe::96) by SA9PR11CA0015.outlook.office365.com (2603:10b6:806:6e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:28:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0005.mail.protection.outlook.com (10.97.4.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:28:41 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 26 Jun 2021 03:28:27 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Sat, 26 Jun 2021 03:28:27 -0700 Received: from [10.140.6.6] (port=55646 helo=xhdappanad40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lx5Y2-000AWJ-Nr; Sat, 26 Jun 2021 03:28:27 -0700 From: Raviteja Narayanam To: , CC: , , , , , Raviteja Narayanam Subject: [PATCH v2 04/10] i2c: xiic: Remove interrupt enable/disable in Rx path Date: Sat, 26 Jun 2021 15:58:00 +0530 Message-ID: <20210626102806.15402-5-raviteja.narayanam@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> References: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2a1765c1-4eba-4c52-13a1-08d9388d2b67 X-MS-TrafficTypeDiagnostic: DM5PR02MB3339: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5obvHLme/d8FJ8DNzT9fhqElHo+VbepSdwhQZo+n06+ThXvkNsGgnV9UgYEO6Ju+soc0k01jboF1sQ/EHXbTMSSUUl+z5RzpLCjoi+717HjWbY2ue0JOfhwfNgH8yB+tVk64u9l54zP4Bf4wRB5tSB5HAptjesjHS3pPxOB5/cD5s1btVEarD2lQXsEd0gaWoCZ44iXDhI8oBbz2Dkl5o7x6Q644uoZoZmLgQgGYkk7PjcC/oWKT+Epg3lNw+7Ic9EiQN/bNsUVdCvkg8wHGhnPw54NZ+Pwcgi2rPafgnu3zBOrKE0LAErwbwT+2Me36QJ5/cc439L8VetLiwdonH7feUta/7VAbG9fLK/jqNwbRvYCDDzH4BmfNdBUQY20y0yeCA+5/QPf8VuEMLrSRPPcV8pnom18c8FkdFacJagbt5DNy3mHxTX7kzWRDEVlVi7SYePGHO7vqZrk+RS9OzKbp+jnIHleCWSF5b4SNGEUOZ3h2kHVE8G+AY2VUjoNtI3pq5iBVYmJ2IKmytF/SDR+LUM90vPHCmWxYWpC0D8jb7GMTNsfFAC7J3hp9AdiIdRSS7w1jzymLIQXGjyFKBmcQxu5VB2lGTrKXt1+JW1+W87T2UGEchGxfP65sfQbpQytSoYQOfic03EVHDIU8I0nb1tjqyGN/tNpnQGPLjBd3aSDibq4rdXb4zGR6+xdq X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(396003)(376002)(39860400002)(136003)(346002)(46966006)(36840700001)(8676002)(107886003)(36906005)(70586007)(54906003)(36756003)(316002)(47076005)(110136005)(9786002)(8936002)(478600001)(70206006)(5660300002)(186003)(26005)(6666004)(336012)(36860700001)(7696005)(2616005)(4326008)(82310400003)(83380400001)(6636002)(356005)(1076003)(82740400003)(44832011)(426003)(2906002)(7636003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2021 10:28:41.8435 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2a1765c1-4eba-4c52-13a1-08d9388d2b67 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0005.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB3339 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210626_032845_020451_AD2CDC75 X-CRM114-Status: UNSURE ( 8.71 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org As the 'DYNAMIC_MODE_READ_BROKEN_BIT' quirk is added in the driver, we no longer enter dynamic mode for the effected IP versions. So, remove local_irq_save/local_irq_restore APIs from driver. Signed-off-by: Raviteja Narayanam --- drivers/i2c/busses/i2c-xiic.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index c31d0d0a8384..72c46cdfa712 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -691,7 +691,6 @@ static void xiic_start_recv(struct xiic_i2c *i2c) u16 rx_watermark; u8 cr = 0, rfd_set = 0; struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg; - unsigned long flags; dev_dbg(i2c->adap.dev.parent, "%s entry, ISR: 0x%x, CR: 0x%x\n", __func__, xiic_getreg32(i2c, XIIC_IISR_OFFSET), @@ -722,7 +721,6 @@ static void xiic_start_recv(struct xiic_i2c *i2c) xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, bytes); - local_irq_save(flags); if (!(msg->flags & I2C_M_NOSTART)) /* write the address */ xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, @@ -736,7 +734,6 @@ static void xiic_start_recv(struct xiic_i2c *i2c) val |= msg->len; xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, val); - local_irq_restore(flags); } else { /* * If previous message is Tx, make sure that Tx FIFO is empty From patchwork Sat Jun 26 10:28:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raviteja Narayanam X-Patchwork-Id: 12346397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12F73C49EA6 for ; Sat, 26 Jun 2021 10:31:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 CF81C61931 for ; Sat, 26 Jun 2021 10:31:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF81C61931 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7pavqe9I7E/1fuDB1B6zYlWVGUMmZl2fMjNgOD8oa70=; b=K/rGARYQ9e98hy geJnXNaGQDcj8L2QmHJR+t1SpJRX6ArQu/PaeKeTG4DG23xH2y+r5Li/jMuseAgsaEFCXD+eoqBVc wUvTtJdEtr0NBHVStRvS8K8RCoqFWTLk4exnDfp4ONJuPqccueORnJ+ondeWfdAQGZajkVICsSxWs DY5qC5uD5SOnsa24/ECfCXu6cpK8TWKqtvJo9QjF92sgvf7LdEX9BDcMtOKptk/lgvmh7NKDxmzfx sYxa7FJOG6mc9pYVhlRfTiePQozy3lh3f0L22eDi+aHPJL5top0DymnNxU2YETKFPqAHqKF4upDst U1cJkMgPHtZZcujYLXdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5ZL-003sMw-IF; Sat, 26 Jun 2021 10:29:49 +0000 Received: from mail-bn8nam12on2069.outbound.protection.outlook.com ([40.107.237.69] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5YO-003s8Z-4B for linux-arm-kernel@lists.infradead.org; Sat, 26 Jun 2021 10:28:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R2TEq0gl7/Blefv8WFw8bhekwpZtTbnOP1v4VJpIg2D4p/1FdmTX8NqmGRdKh8/Uop40vkJIpj0Pq38t26FhhSDdk0TtvRp1DkxM+cNImvdbO+GlvRvQe4xrp9JUrBY0tTN5dvFjAPwAItubflgJ7upZrOMs+DXCM9DU9Xg1s9HAapmJ5ACxo0HDXYkwwojvO1bmVjITj0gwU+Xkey+0hkXwYRULcaAzJu/fNWY3qM+hdC2q4zBdD8aC7s/CeHEJkl8DCrie3TAtC7WXQvAaxN/d3kQ684NrN2WoMkjGYpUxW3+dVxAIQAdXz3npJ9cN0ZvM2YXfsuv5NPp/CpgTPA== 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=m+rHyRdipJ/VM+/Whnrp1CDYpAEEFhO4ukHZjSHZJ6o=; b=QDfMPLjf08+Z9j965ca9GufSEEnr9TNIFGwwksiL4FUUXC3R8wZMASKOESIboFg2ZN4A5XMpLyFHsFNtzK2LhgrGZxPSa4g1tIcbZeWaqgDKeT9rNg9twc4xUkz8LUnFOqZ/HshGRzkC5p2PFqS/sSagFIpuYegGMappIIf3jEVRZRUaX3CIdzkkDsWaKjWO7RHrcPRZPHKGqv3i1GasXhRJBRH1lY9UZFe/UOd3CkfXIgbEIVb6T6DNYDipIVe6sD7vJL3CMJNr7+/hqNMYmwiPmQDOStXvHK9eozm8WpZdRNKQ+mU/Vjx1t/ogfENOtatueXun/UZSYap2aZclQQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=m+rHyRdipJ/VM+/Whnrp1CDYpAEEFhO4ukHZjSHZJ6o=; b=g2ELEqc2hjHKWJoZ9kwMNBmrIXR6bPiOUCZIFKRUSfsy4EaJAfXBTqcX1SjIOB5rSpPcbnE8kRZuLXzWZYk27UG3XIpIoRxcKmYTdgjXEFXV2D14DlhgA56xY6Zr9zzpZZH5y3xix6x+cNtLuHswtbz6u0pEaCjSC83AK41fDzY= Received: from SA9PR11CA0013.namprd11.prod.outlook.com (2603:10b6:806:6e::18) by MN2PR02MB7040.namprd02.prod.outlook.com (2603:10b6:208:1f7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18; Sat, 26 Jun 2021 10:28:43 +0000 Received: from SN1NAM02FT0005.eop-nam02.prod.protection.outlook.com (2603:10b6:806:6e:cafe::7a) by SA9PR11CA0013.outlook.office365.com (2603:10b6:806:6e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:28:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0005.mail.protection.outlook.com (10.97.4.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:28:43 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 26 Jun 2021 03:28:31 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Sat, 26 Jun 2021 03:28:31 -0700 Received: from [10.140.6.6] (port=55646 helo=xhdappanad40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lx5Y6-000AWJ-OE; Sat, 26 Jun 2021 03:28:31 -0700 From: Raviteja Narayanam To: , CC: , , , , , Raviteja Narayanam Subject: [PATCH v2 05/10] dt-bindings: i2c: xiic: Add 'xlnx, axi-iic-2.1' to compatible Date: Sat, 26 Jun 2021 15:58:01 +0530 Message-ID: <20210626102806.15402-6-raviteja.narayanam@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> References: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f37514e8-0573-4a4d-9be5-08d9388d2c8b X-MS-TrafficTypeDiagnostic: MN2PR02MB7040: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:849; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 64lecYFMcKoqGo8pvZ+AmdXpABSBsCULKNyCy+Wx7W76WfuQw7Tml0DI8SaywVYEZDB+jcKyBLYykYUekyeVlWqwc1r6uapc8H13hY9I4r4F0R35NptC3YIenxtCn1WkfAlM+QFZaOtJ3GyED8LV88ssOoSA6c9s2Oq6iEIcIm6Xw1pe1yfPnTG1ccwZfn7il6qMoMFXHKsp2UnloNSkyNswSb1DlhKyPpslATM60/v09baXwmupEfjA5cEDej7tqSOu/kb3HU+pmvLSb75OdQvWOs8/lI097ioFr8vxLTkTdY+TZ9IvfRILZYyJp6VAsUJTDJ1OWki8LVequ2Qe1NrmPrISzQL70mT4rzMHWMETZPJRoavOlutGKJomvO6o0DFdSMZ4BbjBSa03AWGU7YNul0hqUOXbI6/0B1l3XtH0cipSwbZSWESaunNfwc7ddsR3R+YD/X7RYNH2raGU1RYGTo9ERhVHoiOvx14ive4/7llG+E9tEZwDbPcFAVAavVJgN0IIiPWPM+KgQNsliFo3bZKohcWmPUGGapffYhmt65bGgctNJIY8IsBvk2hhfvLDTc5FG7s0pxop0VM7X6WgilTldiKW8xR8puUHIpFgSdkBH0FQWQPpFSSweSU6SBRwCO5SWarIf6T+Ea72rAkjbN071FVQcuSDWl9ORSx2dLMipSFQ0c3jhZT8Eus0 X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(39860400002)(376002)(136003)(396003)(346002)(46966006)(36840700001)(2616005)(2906002)(478600001)(82310400003)(9786002)(426003)(1076003)(36756003)(47076005)(4326008)(336012)(5660300002)(36860700001)(44832011)(107886003)(6636002)(8676002)(7636003)(26005)(356005)(70206006)(70586007)(83380400001)(186003)(8936002)(82740400003)(7696005)(4744005)(110136005)(36906005)(6666004)(54906003)(316002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2021 10:28:43.7727 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f37514e8-0573-4a4d-9be5-08d9388d2c8b X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0005.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB7040 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210626_032848_232521_1647FEBF X-CRM114-Status: UNSURE ( 7.65 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Added the xilinx I2C new version 'xlnx,axi-iic-2.1' string to compatible Signed-off-by: Raviteja Narayanam --- .../devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml b/Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml index 715dcfa5a922..e516c1ed358c 100644 --- a/Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml +++ b/Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml @@ -14,7 +14,9 @@ allOf: properties: compatible: - const: xlnx,xps-iic-2.00.a + enum: + - xlnx,xps-iic-2.00.a + - xlnx,axi-iic-2.1 reg: maxItems: 1 From patchwork Sat Jun 26 10:28:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raviteja Narayanam X-Patchwork-Id: 12346399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8C71C49EA5 for ; Sat, 26 Jun 2021 10:32:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 9BD6261926 for ; Sat, 26 Jun 2021 10:32:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9BD6261926 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uljK1VmWuteGMyKna/WrqtX4RZ3nF3FofXTtBRorCy4=; b=CMs1JfOIeBL/B7 2GfCzpYauaGld5zu4ma4pjxXWjGQTegb8vkXB//nwmjzyh2WLqN3CWSE0sDAGYwZ7Eq7uqWxsp3NY oLkn2cKwo2iD0tax2LZkHPNVIUr9MfRrjeLPgX7jNnkiwTTBV9KSMz/dLYPq8evE5tmCwVbuhGQ1u 2ef9KssylUNtYmzeuAPeluCByr7HdaumXxveWyVZhMh4NVoWZ6knW/8rK9DnTeHTy/pnA4zGfKNuu t+Ls4a9eCorC6a1qW45MqzdQmK22HoPZV5sX9VcpeUb//vEgrNZPdBUN4k50nuJO5bhb7sA679XO7 pWlsh1xRyoyynyuldfQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5Zv-003sZq-KT; Sat, 26 Jun 2021 10:30:24 +0000 Received: from mail-co1nam11on2087.outbound.protection.outlook.com ([40.107.220.87] helo=NAM11-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5YR-003s9F-RO for linux-arm-kernel@lists.infradead.org; Sat, 26 Jun 2021 10:28:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TKwPNcNmZwWpWgtYjHLEeU66Y6Qkohvghru33uyC0b5YKSVkeUxh+w1rWRK+/FbiuDnOM4EA7lfVONR3EZ8fv6CmUbtnbrBdimjDnWKcAl0iwcot0wHfnQcuJDrgo1Agcw8k3XyBXm86h6GmpTEYnAlllUf+OnfXZaq8m0ROwWxY3+7tNJ6XyKyzq285nzQOOBcKucsEWi/S2ZEpK02dFuwQ3PLBf/89At3IFLDeeHpc//CGiMqRfBD6HjMy/62zXaLUX0LuGOlMnOLTGNuFm09/6wXF64viAYvEM+3geE5LH9Ieez9RIMTaTSzP4LCG6pPr9dUDo2y/biD3v8PWsg== 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=4z9PqdnsvcQRvSwHqvaJQ0UEhrHpS+ZoJRyxzRYSW4k=; b=P3IcE8EhiohGTHaqK4OiAxeEedcqQnZu8DApFEPXU8QSIbNqfnqg412ggRdB2D490BdcmDC+++t3YI0/Z4FGFbcisoNHKlp9rWpT8iIZqqWG0i1pUXWhdMAOgPBRnAXYafiSHZvLRwWaHCzkJmZLFmn2DspoNQ9DeXfXtP5jxdEcFb6MYM+TW+CNGzI7p/QSvgPLs7AlNo+xwplEuLCm+su8FWZioBsqUpXQdrH9qRhT3x2jH1Jc5wodjfAP7KHvqVmXAp5MDlzT3GuDy30kBzgE2TOyd2DYJa3r0yO7TsV1aT8DzfoGk4/3+jzaKRcImjqTZCoQUgfJiMQuz5PvFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=4z9PqdnsvcQRvSwHqvaJQ0UEhrHpS+ZoJRyxzRYSW4k=; b=JW9Xc0Ue3PmMRfBMCkdttZChavXX4FgG8uUUc4ZIa8SbTuH//Lt4WSUiQYDuKNU5LXxrC+tNDzwhyIT0gFuc3+CxPp6XBB7rBHOFFPpyC0w8JyGZ1f9r6Emr4PF4Z/OUub9prcheJ2SQ5BY9uPbOx4Zl5LpLp4ePu4RwDnhUVac= Received: from SA9PR11CA0027.namprd11.prod.outlook.com (2603:10b6:806:6e::32) by BN8PR02MB5748.namprd02.prod.outlook.com (2603:10b6:408:b0::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.20; Sat, 26 Jun 2021 10:28:45 +0000 Received: from SN1NAM02FT0005.eop-nam02.prod.protection.outlook.com (2603:10b6:806:6e:cafe::b5) by SA9PR11CA0027.outlook.office365.com (2603:10b6:806:6e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.20 via Frontend Transport; Sat, 26 Jun 2021 10:28:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0005.mail.protection.outlook.com (10.97.4.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:28:45 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 26 Jun 2021 03:28:37 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Sat, 26 Jun 2021 03:28:37 -0700 Received: from [10.140.6.6] (port=55646 helo=xhdappanad40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lx5YC-000AWJ-9s; Sat, 26 Jun 2021 03:28:36 -0700 From: Raviteja Narayanam To: , CC: , , , , , Raviteja Narayanam Subject: [PATCH v2 06/10] i2c: xiic: Update compatible with new IP version Date: Sat, 26 Jun 2021 15:58:02 +0530 Message-ID: <20210626102806.15402-7-raviteja.narayanam@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> References: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f0672b42-0d4c-451a-76ab-08d9388d2dae X-MS-TrafficTypeDiagnostic: BN8PR02MB5748: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:1122; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ErkzR78v4SgFsnihbalcVpAyPbUq7lbnB7rkd7OCbdkMiMV9hOD8PRWs2VkJfyHxkjuMKRjZ5sfS50sSm+nadVp/LqNMXDd37P6YjO2+LOMqPblokAlzl9+uspgp4AbeiGGn2OD/xmdJAIzuTHxCnJbssQDTTrbnhdRX6doFeTwjvMvoz8MBD/0vhwK1wE0SmtKXmhVCb73bZ3Cy1+GpVnZ+/q40jBV5dwukKnOofPcqBJdSGGeP1m1Jl5Y61eK1nAwxIAxsz3xoDjOX+isdxDEFcwsY8GGm80+xgc/CN/rATzNyDx+w7tAqGFnK01ozjMDb3Okmw1ZFZER67bKccoj/SucW4oe56igsXsgi6xnVF2AzSI70719WhWbkUmHbD3lB2dqzg/evoK7p5lhB6wVqtWuD8xuPp4kijVyeJi3DktC0WYNOmJWRgyf6XDrguQfVHxulP/6EiRXlIf+8IbKHqxXO+jQWozG16im7M8/nZJUpMoEw7YRm44uzqCwgZXCabOVJ5snmiK5gthoOOruCJZs3av2XKhNI1S+3YiI2ZnjY2E7RJLBFjrd8GLOuUVsaEmGauxP0kaAyuh9UYnu6lVTsc2agOYItDRW9wSOIqFmELWLcyx+CwMOmoktPNodBMUfhlKeTMEyjIwhyORhxYb9VYB3Y5KRZCKpeFOatZhhgPinVjWkBR+cs3O14 X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(376002)(136003)(346002)(396003)(39860400002)(46966006)(36840700001)(15650500001)(36860700001)(2906002)(36756003)(6666004)(70206006)(70586007)(6636002)(54906003)(426003)(336012)(26005)(2616005)(110136005)(8936002)(36906005)(4744005)(8676002)(186003)(1076003)(44832011)(356005)(478600001)(4326008)(9786002)(7636003)(316002)(5660300002)(82740400003)(82310400003)(7696005)(83380400001)(107886003)(47076005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2021 10:28:45.6788 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f0672b42-0d4c-451a-76ab-08d9388d2dae X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0005.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR02MB5748 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210626_032851_940928_C93F37F8 X-CRM114-Status: UNSURE ( 9.18 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Xilinx AXI I2C IP is updated with a bug fix for dynamic mode reads. Older IPs are handled with a workaround in which they are using xiic standard mode for all these effected use cases. Added the new IP version to compatible. Signed-off-by: Raviteja Narayanam --- drivers/i2c/busses/i2c-xiic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 72c46cdfa712..007a78215a90 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -1058,6 +1058,7 @@ static const struct xiic_version_data xiic_2_00 = { #if defined(CONFIG_OF) static const struct of_device_id xiic_of_match[] = { { .compatible = "xlnx,xps-iic-2.00.a", .data = &xiic_2_00 }, + { .compatible = "xlnx,axi-iic-2.1", }, {}, }; MODULE_DEVICE_TABLE(of, xiic_of_match); From patchwork Sat Jun 26 10:28:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raviteja Narayanam X-Patchwork-Id: 12346401 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80D99C49EA5 for ; Sat, 26 Jun 2021 10:33:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 45D8961926 for ; Sat, 26 Jun 2021 10:33:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 45D8961926 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/ygO+36GB7AvPp6SmXVn4zH/3WmrHC3cd2SHxbdBCuA=; b=2BTk8bjGWkabJ6 GL607GYJ11Qe2/K1gIkvVgIlBQhNH1/Nd2W60D9ByjxopNeLOwC/bBQ3+NYERU5jWm5LjR/zScDIB ZHtNdXgAJf2kgs4xlgD/7nUUWmByLdX4vrr5aaZY/Bd8EC/OC9ElwPAb2XWkBbvaqsYYs1WraqwF8 RBb3APsyc9/yt+47OgiU8vxx4snyj+b/9JPI9ezNfqmwxDAQxIFyKsuBQGT/8tNAwTjNWRNeqzzeM +1CBU/1I5BIE3x1wyDEBMc9bGNMpAPIWAy9tc+rcmv3/7eBSbcSYORqbIQz/Q7lSCorBzCEZtx+aZ cqWtRl9fx8r1ySxCyjZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5af-003ssG-NG; Sat, 26 Jun 2021 10:31:12 +0000 Received: from mail-bn8nam12on2042.outbound.protection.outlook.com ([40.107.237.42] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5YU-003s9m-Dp for linux-arm-kernel@lists.infradead.org; Sat, 26 Jun 2021 10:28:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AGva/2hX7cJcjr0u9qX3Ihg+wRtqrCYkRgQn2qvAwYu4vZLU+cVbT9DibNYQzJyuIClm6m1NANt1f1vXy8+PuBH5AkDreKRcwnZUpP4bPH7AoYOdIRyoKk4EmMZYC1KtuLVLdKjTL4gGD1tiEFuWcNmDeJDHcAi8ojBBXBy6gXXklblrGRnwFo3ddCTL2678a5U7Tr1eP2IljrW2nPk5V7ARiFvzEHYQL9R8+qu8VezZyR4TxCNS2+66zOD/T4HzawvkLAWSEaD1oYhC01vRykyY35/KUcn2ChyDcEfC3+e5w2zQUGzoof3ZnKnh5d8hfbqwzL1kfpAML2WBrmADiw== 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=bZHdWlItDItKdHqHd7COthhh0FQoeZRENhTACPti+3Q=; b=hlrI1xa2wEozyZCh3CnXBT9Jhh25Bkkv6Cm0f4x8AsLlkIJsCRyTX1OFjaAb6wpRkm84PU7pVqsDe1Dtb8GDW+Te2XLdYclxobf7rahnjdeIOOV6ulU9D+6iERtPjpIpa/Ui2/wSLkaGxPUB9yST+YLL+QYgzgfqnnlRP0MJwonfsxC7P6ubhIFyzrtc62TaTiZMKYuwnCZKTdb/iPLX/+C5AC8qOYAMFYgYM0LBCfJ2eKEN5VQGxwjpIeQ2xu7gAQXZk4eIOKQ3oOHRiLBpO03D7Vec75DvMaSke8WNVPuP7XgeXL/bguqEZFPGJrULdjQXqd+TPX4wNMs3miQs2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=bZHdWlItDItKdHqHd7COthhh0FQoeZRENhTACPti+3Q=; b=Oq0LQ5YFPvffqeGQhMhQpROLSb0D9TjfzAxM0jBItbBmkAOd5cRbF/EF17chRXkZvr5cpZ7DP7n4RwFFD0kJvLJ9S6YD8UZJM/ScYQviaQ8hSFihe03lymhjKy4euFPR+dbXXpZ1/reDXzdRq23uq9QVIfKE1GzsIjWT7RnibKc= Received: from SA9PR11CA0013.namprd11.prod.outlook.com (2603:10b6:806:6e::18) by BN6PR02MB3332.namprd02.prod.outlook.com (2603:10b6:405:6b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.21; Sat, 26 Jun 2021 10:28:51 +0000 Received: from SN1NAM02FT0005.eop-nam02.prod.protection.outlook.com (2603:10b6:806:6e:cafe::37) by SA9PR11CA0013.outlook.office365.com (2603:10b6:806:6e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:28:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0005.mail.protection.outlook.com (10.97.4.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:28:51 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 26 Jun 2021 03:28:41 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Sat, 26 Jun 2021 03:28:41 -0700 Received: from [10.140.6.6] (port=55646 helo=xhdappanad40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lx5YG-000AWJ-Hm; Sat, 26 Jun 2021 03:28:40 -0700 From: Raviteja Narayanam To: , CC: , , , , , Shubhrajyoti Datta , Raviteja Narayanam Subject: [PATCH v2 07/10] i2c: xiic: Return value of xiic_reinit Date: Sat, 26 Jun 2021 15:58:03 +0530 Message-ID: <20210626102806.15402-8-raviteja.narayanam@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> References: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4d126b5b-55c7-47a1-da84-08d9388d3133 X-MS-TrafficTypeDiagnostic: BN6PR02MB3332: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: botN33TYnEf3/B7+9DkTUcjric4eVxNIPv8j4qD2pvogi8/O2P9S/n3JtJzH5vwG4GKXhyTrmesmNTXux5f75L06jKMUBDycGo8ITbMUdazvuF7XKojqVea1I+Btzdxpr0W46YKg+WahXXo6uiEuEZ9ZsZV+H2jaqxTyY6YFat93TZ8VtHOo5Z8jEOhVbn/kj19Es1mbVcv3fW/+r+bHdB2Km+IXj6bzKkgEpYFe65F45aYXrMJgd4mruqS4EhGVnVMRB2P61HwJRCJXJ+nfwRJLJFjNvggga7vJMYN+qGSwdXI6enOOAkyP3C2PeNX83PczcvTNkYhBbz2hFn+8t1GB75+xZWWPShSd8g4C5S23zbefbR4Ft2B04DpPH0PQSLIjvTUgx5plZta6fkG3xIQXSADBhiG17eR8pkzyQB39jxfFqYcg2eMrM2voFY8ks/XZulYAvSJ0QBiOBfv3Fzxstt/Lm0kSy49KcuNEqIHNYDghdWq7pYpAwQymR/tzBMTqSjZetFO1meFw+diJ7ESxd6y3QAzfTect1hm9seXY7HgaHuUsEJwSe9pHg4E5lHrJl0rJAql0RPs717IekdMmuEUzTQU2BuwuJi0E2rcnqA14dyvTNFocURydlMxCwetH9U//5PPEaAxZmUZbIHOpOq5eIeQNeKhSaOPIR/h4xF6zd0UKCS5oLLzNejlZjYpf9GTsVzFGpikV01aJ3scJB5hg2U5SwNJU9QpLiIY= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(136003)(376002)(39860400002)(346002)(396003)(46966006)(36840700001)(336012)(36860700001)(7696005)(1076003)(186003)(2616005)(26005)(5660300002)(47076005)(36756003)(54906003)(8676002)(44832011)(426003)(36906005)(316002)(6666004)(70206006)(70586007)(110136005)(107886003)(4326008)(478600001)(2906002)(8936002)(82740400003)(82310400003)(6636002)(9786002)(356005)(7636003)(83380400001)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2021 10:28:51.5862 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4d126b5b-55c7-47a1-da84-08d9388d3133 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0005.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB3332 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210626_032854_522463_09FC0ECA X-CRM114-Status: GOOD ( 12.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Shubhrajyoti Datta Check the return value of xiic_reinit. Signed-off-by: Shubhrajyoti Datta Signed-off-by: Raviteja Narayanam --- drivers/i2c/busses/i2c-xiic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 007a78215a90..0d76261f1841 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -504,6 +504,7 @@ static irqreturn_t xiic_process(int irq, void *dev_id) struct xiic_i2c *i2c = dev_id; u32 pend, isr, ier; u32 clr = 0; + int ret; /* Get the interrupt Status from the IPIF. There is no clearing of * interrupts in the IPIF. Interrupts must be cleared at the source. @@ -540,7 +541,9 @@ static irqreturn_t xiic_process(int irq, void *dev_id) * fifos and the next message is a TX with len 0 (only addr) * reset the IP instead of just flush fifos */ - xiic_reinit(i2c); + ret = xiic_reinit(i2c); + if (!ret) + dev_dbg(i2c->adap.dev.parent, "reinit failed\n"); if (i2c->rx_msg) xiic_wakeup(i2c, STATE_ERROR); From patchwork Sat Jun 26 10:28:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raviteja Narayanam X-Patchwork-Id: 12346403 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63739C49EA5 for ; Sat, 26 Jun 2021 10:34:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 1A80861926 for ; Sat, 26 Jun 2021 10:34:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A80861926 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=l2QngQ0/9YrgAfyqmfTJ2JtKFFgBn3hX/z69mt4VrSs=; b=dMnpN+emRdI3pJ 2DlL3pgw9MktkDSrvoeRTbNDhshQGjd/8VsRrZz43DeCz7if22YnF5b4Lbdy7OWls2bUbZSepTuWA LtvWnlqhJk8dQQDJ0WDHJHCOObOhq+SUADwC0FhgHQnsG6NeIZOwUrcnoObEobRA3pUIlbQqw8nqC NZfXB+ssux26I1ntHXgWFprOr7EwNJIzHwVtP4hYwuUytnaJK2HiBgY+4P6mpfhF9X3vIWzQBxeEQ lZ2+l1PRDa6Nz054c1qDag59KVBoSzGhBKN6cQpRf9r6pMYnKgutP8XcbcrEHHFQVArTy7TqUf66E 05h+aSOEAaO2I7kVrNJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5bb-003tJv-7G; Sat, 26 Jun 2021 10:32:09 +0000 Received: from mail-mw2nam08on2089.outbound.protection.outlook.com ([40.107.101.89] helo=NAM04-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5YZ-003sBD-NU for linux-arm-kernel@lists.infradead.org; Sat, 26 Jun 2021 10:29:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yy7+6gwnC4NN1nnoIelTyR2pcrENwiv5hED+ysV1Y2NL1Pt8lT9KC0jC2Z/YEw8PCofNbCxkT+YQoipdkUy6Zs1h59CvGP8J9HRBteS3H6zlrX1aCyx7HFm86BMaD5LOfHafNmaLY3NuRMNwcQ1FgFb72pEbmZ3rluxrlcuquUxX4PBOu/BaHouvX137Jj06nI5WZJDfKbKdSKTGYo2aYoZ3eslYwproEIaoC1VYOuvN/MsJXyEXr1RFeRqAWDGLVI+NVCgU+0yWNb2eK6G+MgC1uTWke/nuTQ99IlvClJb4HimAc0cMXNpJ8idkB7yWStJCUw92ebnRIhmdutBb8Q== 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=ka99UuqMvEVrXc8zLH1F3MaFqFoQwBZsaxJNyVg30gs=; b=IXz+TJXkMnIw/cnD3oOQRzW7PrjO4gjlgOUbCHg22qKt7Qw+aNtuIgemCrqW/xypDUwbsbUbtD7sHWeSo+Y5eunrNLDayYCO5gd7iEnOO7OmFF/g0jDSknNLxL930lNg01+xamv9Y3hHtkOPJBclhkZf0eqOs5TC0zuity13lUrnWTo8DucMuCcV6rWkUlSXK3nwngGjB9ftOa7umZN9mSrrPHma1afgv0HhXNzKLBDInQIpK22YPLxMR2xc7JA2deHYGMaBHAzTA8d1waDtfLLCrsEvOJi4Ww2vndlr9j8DU4O75EzvXF1jsclB+JcjLqYMnG6gc0HUbfuV/zEaTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=ka99UuqMvEVrXc8zLH1F3MaFqFoQwBZsaxJNyVg30gs=; b=YdPDtyI1VVDayzIWbbMjDp6pnjTuMS2kQaUvBELk31oTuwNEtawgK1PwjNEgAUaetBKIZ2kckLtv8+2hJ6FRlg2Lk177LxqaSv7FmwXHD/RPYQRWGdRI2N5u1PT+usfZzQg7eq/pKIq/lTLbqj/Q5lCAPjtRk7evjK6BwspR52s= Received: from SA9PR11CA0011.namprd11.prod.outlook.com (2603:10b6:806:6e::16) by SN6PR02MB5230.namprd02.prod.outlook.com (2603:10b6:805:72::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.23; Sat, 26 Jun 2021 10:28:56 +0000 Received: from SN1NAM02FT0005.eop-nam02.prod.protection.outlook.com (2603:10b6:806:6e:cafe::1b) by SA9PR11CA0011.outlook.office365.com (2603:10b6:806:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:28:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0005.mail.protection.outlook.com (10.97.4.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:28:55 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 26 Jun 2021 03:28:46 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Sat, 26 Jun 2021 03:28:46 -0700 Received: from [10.140.6.6] (port=55646 helo=xhdappanad40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lx5YL-000AWJ-CO; Sat, 26 Jun 2021 03:28:45 -0700 From: Raviteja Narayanam To: , CC: , , , , , Shubhrajyoti Datta , Raviteja Narayanam Subject: [PATCH v2 08/10] i2c: xiic: Fix the type check for xiic_wakeup Date: Sat, 26 Jun 2021 15:58:04 +0530 Message-ID: <20210626102806.15402-9-raviteja.narayanam@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> References: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: abee86ec-1002-4232-a31b-08d9388d33c0 X-MS-TrafficTypeDiagnostic: SN6PR02MB5230: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ufj0jL+PuPvtO0v63smS9DPqPy46FreY7+NGAZyZT6OY9myw386VPZxWeljybwoWBeqb3TeCpQKhXgs3Jp8Wu91bPS1APZjUCNS25pfdHFeiQns9KkZWKZyefIZt1Ujcyb0NsKXPg3N8kVaEQJLsBQc2NPwKAwbM+QrKiJI2ZuJHBraKtLKf3z73/CH7Se2xZTv/L4dAxclpXC25nUtPoHaTfNfreXB/FudGBqZ4iMdgFi1w39YFk/zxlSV1kbdpBqIE/gShEIRIXg1jDMWqvI3oMVmJJxrpyCjbDXWuEZx38UJvDR+MqIg7wzzEOj1i8+N9MXdcr/z65eSMBHlq0spV6uGRyfLl3lTzgcYzSaoUXG02VNdtvCHasx1oQUK4BHV4dVCg/DzYDWTuJ2L01/CnXtjRZ0oG2jSX0YKIWn207pYoU8odt59zwe/JLCuhBb8XkD9wfEWrIbXbQ47xoEMFEE3CklMqscSBHusJTuaeQtnOjhG0Zv2bA4XHjCYXQVFYWJ+r23G/f1z6MBAR+l9DJpQDqs9rzmrXOnYj70FI0ZwONI2+PfWASOvJP2UuOOiCdUVudt2VLnJAwXC4SkY80X2Z5W4IWSq963RMpZycC3eRRCDSKhqllSXGVg4cOa0Jqjgoo9gAQUuc5mFX/P9AUc6hqU0P+eHQ+1AVmHfne3PU4uFUHF98K1VkRMfHWdhXSk2iNCS0Qg0qAvshGScNlb98XTrvlbYQ8H3hiwM= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(376002)(39860400002)(136003)(396003)(346002)(46966006)(36840700001)(110136005)(4744005)(7696005)(316002)(36860700001)(107886003)(1076003)(356005)(2616005)(426003)(336012)(9786002)(70206006)(6636002)(5660300002)(70586007)(7636003)(82310400003)(478600001)(6666004)(36906005)(4326008)(44832011)(186003)(82740400003)(54906003)(83380400001)(26005)(36756003)(47076005)(8936002)(8676002)(2906002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2021 10:28:55.8633 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: abee86ec-1002-4232-a31b-08d9388d33c0 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0005.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB5230 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210626_032859_810894_FF323795 X-CRM114-Status: UNSURE ( 9.85 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Shubhrajyoti Datta Fix the coverity warning mixed_enum_type: enumerated type mixed with another type We are passing an enum in the xiic_wakeup lets change the function parameters to reflect that. Signed-off-by: Shubhrajyoti Datta Signed-off-by: Raviteja Narayanam --- drivers/i2c/busses/i2c-xiic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 0d76261f1841..3e81ec08b001 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -490,7 +490,7 @@ static void xiic_send_tx(struct xiic_i2c *i2c) } } -static void xiic_wakeup(struct xiic_i2c *i2c, int code) +static void xiic_wakeup(struct xiic_i2c *i2c, enum xilinx_i2c_state code) { i2c->tx_msg = NULL; i2c->rx_msg = NULL; From patchwork Sat Jun 26 10:28:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raviteja Narayanam X-Patchwork-Id: 12346405 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 776D9C49EA6 for ; Sat, 26 Jun 2021 10:35:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3ED5C61939 for ; Sat, 26 Jun 2021 10:35:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3ED5C61939 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U/MWvCWrkphSh4XrWCOceL61RFQrFkRdpFa3z3oCn00=; b=gEhTtkxRGgUmEa +Op/FgpbTNUjDgrCstlNKj8ZW4803LXFIFIBBpYntdAtVxU2BbeKOs4p1JFD82EBhL4ZGgDwsc2a4 dlY40rZ/YIioatui40Km0RzXsZuH+3r5PkVP9j1mDk4JAZklPzv1idCn2EhsuTRYSXLwsJjlRzHkM b/cxgyqmcuGCno1njPJaUj5Xua3caG1oRF+56vX7e0TmHxEY4pE5qwB8Z1lsedwyJTwyn+HcCLzVO rPPP/YTz0iyjnejSuet87oA/sMYbeC6JBp+Dz7YbA/mKN4EdqbyW4Fd66Y8W90YdMYdvdhDjBoesL H9ZC4nf7larun9BveaFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5cN-003tiR-1x; Sat, 26 Jun 2021 10:32:56 +0000 Received: from mail-dm6nam10on2078.outbound.protection.outlook.com ([40.107.93.78] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5Yj-003sDG-PU for linux-arm-kernel@lists.infradead.org; Sat, 26 Jun 2021 10:29:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=god8aBFgqZyioBFWdu/z2VutagkENELOF1Ur0MQqIPrWqvwSYJyxLIRN99AHChWk1kUhX0nU/htA1IHX+tZrLE6xEY5Z3mCVUQun48+NL9ytl5CI9f1xSU7xDs9EwpYycE9XdtXk4irZVmrwTz1E/kUkuZIxUJgwVpwTB4p7qWNk4GV0PtTUdwfiXn5H3Df5Jif0xOHNFUZCG9QV8VZIEEg1f8/sLb3uSIz8V079XMh+0tKwDjaVQ6IbsxX9uN4lpYcbroUfZvfUK63ZUqZmtATwj8epTF5cp8r7HQEJZ8lY7/9vIFBGcyA61Gxasn0zBbaH1vzaIwEHAlAQl10smQ== 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=YWIWQMx/9dXKPsHESnWuJyYm0GIbs6zDaBAuzOfttlk=; b=dztD4RZbjwNzO9aNcgnKDpkSy9wNtnoB5GA7MCePb9TsL8GP0fJVjuIjkB9SQOCWEPIMg0m/IQsMPEG2ylpYjwCjXhsuNilLTXXWWoNAvWWPwrl+V1gI28Iq0CQnkN7cC7BItvq6KQacILzkaC85barwLxIjPk3/7th9RSwWn5yZzUoufCZHLGFko5tTNT9/jyz4MsBFsjwUwvkA9DRxPy43Zf0V5+y8L5NA79e7FDQ1l3aWTSyHo5S2cTsHnZgTsNcnzBIlOJ832hc3EK2uRnUFKqrSDZZdnDSoPDzTX6Q9yA15oH1C1iWujtcxgzBwqg3jkBD85P7AkclF7j+Z8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=YWIWQMx/9dXKPsHESnWuJyYm0GIbs6zDaBAuzOfttlk=; b=fs7rzCoo7fh+tLBTSXfonR6xnGNprUgvZGaXQgwm8GN79hR5IGHOYV1OI5qA+ztG3ilFX9jFqtCa/H3jeeS/FyAXIt6hR4IfR+k/rz8/Tk69M1e1z9JUUvgqpj+GdFa9kldpJiQWqj3dAlbZVdUmc+Hs7EG4g/VghJW4wiI+Sgc= Received: from SN6PR04CA0087.namprd04.prod.outlook.com (2603:10b6:805:f2::28) by DM6PR02MB6042.namprd02.prod.outlook.com (2603:10b6:5:1f6::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.23; Sat, 26 Jun 2021 10:29:06 +0000 Received: from SN1NAM02FT0039.eop-nam02.prod.protection.outlook.com (2603:10b6:805:f2:cafe::8a) by SN6PR04CA0087.outlook.office365.com (2603:10b6:805:f2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.19 via Frontend Transport; Sat, 26 Jun 2021 10:29:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0039.mail.protection.outlook.com (10.97.5.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:29:05 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 26 Jun 2021 03:28:50 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Sat, 26 Jun 2021 03:28:50 -0700 Received: from [10.140.6.6] (port=55646 helo=xhdappanad40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lx5YP-000AWJ-3t; Sat, 26 Jun 2021 03:28:49 -0700 From: Raviteja Narayanam To: , CC: , , , , , Raviteja Narayanam Subject: [PATCH v2 09/10] i2c: xiic: Fix coding style issues Date: Sat, 26 Jun 2021 15:58:05 +0530 Message-ID: <20210626102806.15402-10-raviteja.narayanam@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> References: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9277c7f3-e31d-4209-6181-08d9388d39bb X-MS-TrafficTypeDiagnostic: DM6PR02MB6042: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:133; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b+trAFJZZPMIVP8SRpfh1zUolrcNdmCwdoqFHqvtFT13D8iasI6iz6jBkijDryeyjcpoxDg1AH4rt5cWtOv38xV7Q/QAOGkYZmIsvEtIfQIbHt0qJn4k5vnPAvrY2h/OdV7D67TL0gT7fQH0mCpuxaudLmkDi8fELtcOskyoE4mNOUqUQimE/cXHagEbhg+mSCDy/lFrhY0jWZ7StDCzJs8+Sc8csPF02w39MOO8N0Q+Jk6O0vyuqy4AESA/t9TS9AcGz2tIGKxtPSL8AsF8spAH1NVI/MIs6vCcp4XOLTV9zStVNbFxaDbOX0/eNXFfmMo85NI47y7HSC14QCpBKiFp5Mih/9hMY0zgFwwA6JKjEqPQTDdQKwBzgeW8EGcD8rG2TUTnxebadDJc+YTK/WRdHe8oJqurLHr5FPBiq2a4bokV8YX4+yViJCEz1azjMv/FnSVtXF+veUvX55ZewSyqlZsvcYsPckrRtt8C0rcHbwthScC3bh74d9w4vklOFoRWeqV5ZgDLTpFEkOi4tCa9//nhcavCDlpPrsG1S0ooDz8Iod5tWgtPxi0WhMDmK/nHqZJDNHULxBqhdov1YhjpgB0VBLaF0Z5Sh4wyZYE8Mc6lZBuLKNu6WzD5M3opqIUqIbRnY724EnivlXZVzainA0CqxeuUFW2eqtv/tUXZcv9ivv4o4nT1HZfN3qTlkN0c6+EaPDrJjFXUlU3yMhm7pbdROjoAUj9CKFPSa70= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(346002)(136003)(396003)(376002)(39860400002)(36840700001)(46966006)(36860700001)(2906002)(6636002)(70586007)(186003)(336012)(26005)(82310400003)(36906005)(316002)(5660300002)(2616005)(47076005)(44832011)(70206006)(7696005)(82740400003)(36756003)(9786002)(426003)(356005)(83380400001)(8676002)(1076003)(7636003)(8936002)(110136005)(107886003)(54906003)(6666004)(4326008)(478600001)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2021 10:29:05.8971 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9277c7f3-e31d-4209-6181-08d9388d39bb X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0039.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6042 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210626_032909_993579_8B242E38 X-CRM114-Status: GOOD ( 24.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Michal Simek Most of these stuff are reported by checkpatch. But fixes are: - Incorrect indetation - Missing blank line after variable declaration - Additional () - Missing spaces around + - Else after if with return - Missing parenthesis when if has them - Newlines - Remove MODULE_ALIAS - none is really using it - Changing msleep to usleep_range - Other trivial fixes Signed-off-by: Michal Simek Signed-off-by: Raviteja Narayanam --- drivers/i2c/busses/i2c-xiic.c | 67 ++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 3e81ec08b001..26fc174b8e95 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -72,7 +72,7 @@ struct xiic_i2c { wait_queue_head_t wait; struct i2c_adapter adap; struct i2c_msg *tx_msg; - struct mutex lock; + struct mutex lock; /* Locking between isr and new xfer */ unsigned int tx_pos; unsigned int nmsgs; struct i2c_msg *rx_msg; @@ -91,22 +91,22 @@ struct xiic_version_data { }; #define XIIC_MSB_OFFSET 0 -#define XIIC_REG_OFFSET (0x100+XIIC_MSB_OFFSET) +#define XIIC_REG_OFFSET (0x100 + XIIC_MSB_OFFSET) /* * Register offsets in bytes from RegisterBase. Three is added to the * base offset to access LSB (IBM style) of the word */ -#define XIIC_CR_REG_OFFSET (0x00+XIIC_REG_OFFSET) /* Control Register */ -#define XIIC_SR_REG_OFFSET (0x04+XIIC_REG_OFFSET) /* Status Register */ -#define XIIC_DTR_REG_OFFSET (0x08+XIIC_REG_OFFSET) /* Data Tx Register */ -#define XIIC_DRR_REG_OFFSET (0x0C+XIIC_REG_OFFSET) /* Data Rx Register */ -#define XIIC_ADR_REG_OFFSET (0x10+XIIC_REG_OFFSET) /* Address Register */ -#define XIIC_TFO_REG_OFFSET (0x14+XIIC_REG_OFFSET) /* Tx FIFO Occupancy */ -#define XIIC_RFO_REG_OFFSET (0x18+XIIC_REG_OFFSET) /* Rx FIFO Occupancy */ -#define XIIC_TBA_REG_OFFSET (0x1C+XIIC_REG_OFFSET) /* 10 Bit Address reg */ -#define XIIC_RFD_REG_OFFSET (0x20+XIIC_REG_OFFSET) /* Rx FIFO Depth reg */ -#define XIIC_GPO_REG_OFFSET (0x24+XIIC_REG_OFFSET) /* Output Register */ +#define XIIC_CR_REG_OFFSET (0x00 + XIIC_REG_OFFSET) /* Control Register */ +#define XIIC_SR_REG_OFFSET (0x04 + XIIC_REG_OFFSET) /* Status Register */ +#define XIIC_DTR_REG_OFFSET (0x08 + XIIC_REG_OFFSET) /* Data Tx Register */ +#define XIIC_DRR_REG_OFFSET (0x0C + XIIC_REG_OFFSET) /* Data Rx Register */ +#define XIIC_ADR_REG_OFFSET (0x10 + XIIC_REG_OFFSET) /* Address Register */ +#define XIIC_TFO_REG_OFFSET (0x14 + XIIC_REG_OFFSET) /* Tx FIFO Occupancy */ +#define XIIC_RFO_REG_OFFSET (0x18 + XIIC_REG_OFFSET) /* Rx FIFO Occupancy */ +#define XIIC_TBA_REG_OFFSET (0x1C + XIIC_REG_OFFSET) /* 10 Bit Address reg */ +#define XIIC_RFD_REG_OFFSET (0x20 + XIIC_REG_OFFSET) /* Rx FIFO Depth reg */ +#define XIIC_GPO_REG_OFFSET (0x24 + XIIC_REG_OFFSET) /* Output Register */ /* Control Register masks */ #define XIIC_CR_ENABLE_DEVICE_MASK 0x01 /* Device enable = 1 */ @@ -244,18 +244,21 @@ static inline int xiic_getreg32(struct xiic_i2c *i2c, int reg) static inline void xiic_irq_dis(struct xiic_i2c *i2c, u32 mask) { u32 ier = xiic_getreg32(i2c, XIIC_IIER_OFFSET); + xiic_setreg32(i2c, XIIC_IIER_OFFSET, ier & ~mask); } static inline void xiic_irq_en(struct xiic_i2c *i2c, u32 mask) { u32 ier = xiic_getreg32(i2c, XIIC_IIER_OFFSET); + xiic_setreg32(i2c, XIIC_IIER_OFFSET, ier | mask); } static inline void xiic_irq_clr(struct xiic_i2c *i2c, u32 mask) { u32 isr = xiic_getreg32(i2c, XIIC_IISR_OFFSET); + xiic_setreg32(i2c, XIIC_IISR_OFFSET, isr & mask); } @@ -425,7 +428,8 @@ static void xiic_fill_tx_fifo(struct xiic_i2c *i2c) while (len--) { u16 data = i2c->tx_msg->buf[i2c->tx_pos++]; - if ((xiic_tx_space(i2c) == 0) && (i2c->nmsgs == 1)) { + + if (!xiic_tx_space(i2c) && i2c->nmsgs == 1) { /* last message in transfer -> STOP */ data |= XIIC_TX_DYN_STOP_MASK; dev_dbg(i2c->adap.dev.parent, "%s TX STOP\n", __func__); @@ -527,8 +531,8 @@ static irqreturn_t xiic_process(int irq, void *dev_id) /* Service requesting interrupt */ if ((pend & XIIC_INTR_ARB_LOST_MASK) || - ((pend & XIIC_INTR_TX_ERROR_MASK) && - !(pend & XIIC_INTR_RX_FULL_MASK))) { + ((pend & XIIC_INTR_TX_ERROR_MASK) && + !(pend & XIIC_INTR_RX_FULL_MASK))) { /* bus arbritration lost, or... * Transmit error _OR_ RX completed * if this happens when RX_FULL is not set @@ -672,9 +676,8 @@ static int xiic_busy(struct xiic_i2c *i2c) * should ignore it, since bus will never be released and i2c will be * stuck forever. */ - if (i2c->singlemaster) { + if (i2c->singlemaster) return 0; - } /* for instance if previous transfer was terminated due to TX error * it might be that the bus is on it's way to become available @@ -682,7 +685,7 @@ static int xiic_busy(struct xiic_i2c *i2c) */ err = xiic_bus_busy(i2c); while (err && tries--) { - msleep(1); + usleep_range(1000, 2000); err = xiic_bus_busy(i2c); } @@ -874,7 +877,6 @@ static void xiic_start_send(struct xiic_i2c *i2c) xiic_std_fill_tx_fifo(i2c); if ((cr & XIIC_CR_MSMS_MASK) == 0) { - /* Start Tx by writing to CR */ cr = xiic_getreg8(i2c, XIIC_CR_REG_OFFSET); xiic_setreg8(i2c, XIIC_CR_REG_OFFSET, cr | @@ -898,9 +900,6 @@ static irqreturn_t xiic_isr(int irq, void *dev_id) /* Do not processes a devices interrupts if the device has no * interrupts pending */ - - dev_dbg(i2c->adap.dev.parent, "%s entry\n", __func__); - isr = xiic_getreg32(i2c, XIIC_IISR_OFFSET); ier = xiic_getreg32(i2c, XIIC_IIER_OFFSET); pend = isr & ier; @@ -914,6 +913,7 @@ static void __xiic_start_xfer(struct xiic_i2c *i2c) { int first = 1; int fifo_space = xiic_tx_fifo_space(i2c); + dev_dbg(i2c->adap.dev.parent, "%s entry, msg: %p, fifos space: %d\n", __func__, i2c->tx_msg, fifo_space); @@ -928,19 +928,20 @@ static void __xiic_start_xfer(struct xiic_i2c *i2c) i2c->nmsgs--; i2c->tx_msg++; i2c->tx_pos = 0; - } else + } else { first = 0; + } if (i2c->tx_msg->flags & I2C_M_RD) { /* we dont date putting several reads in the FIFO */ xiic_start_recv(i2c); return; - } else { - xiic_start_send(i2c); - if (xiic_tx_space(i2c) != 0) { - /* the message could not be completely sent */ - break; - } + } + + xiic_start_send(i2c); + if (xiic_tx_space(i2c) != 0) { + /* the message could not be completely sent */ + break; } fifo_space = xiic_tx_fifo_space(i2c); @@ -951,12 +952,12 @@ static void __xiic_start_xfer(struct xiic_i2c *i2c) */ if (i2c->nmsgs > 1 || xiic_tx_space(i2c)) xiic_irq_clr_en(i2c, XIIC_INTR_TX_HALF_MASK); - } static int xiic_start_xfer(struct xiic_i2c *i2c) { int ret; + mutex_lock(&i2c->lock); ret = xiic_reinit(i2c); @@ -1020,8 +1021,8 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) goto out; } - if (wait_event_timeout(i2c->wait, (i2c->state == STATE_ERROR) || - (i2c->state == STATE_DONE), HZ)) { + if (wait_event_timeout(i2c->wait, i2c->state == STATE_ERROR || + i2c->state == STATE_DONE, HZ)) { err = (i2c->state == STATE_DONE) ? num : -EIO; goto out; } else { @@ -1228,6 +1229,7 @@ static const struct dev_pm_ops xiic_dev_pm_ops = { SET_RUNTIME_PM_OPS(xiic_i2c_runtime_suspend, xiic_i2c_runtime_resume, NULL) }; + static struct platform_driver xiic_i2c_driver = { .probe = xiic_i2c_probe, .remove = xiic_i2c_remove, @@ -1243,4 +1245,3 @@ module_platform_driver(xiic_i2c_driver); MODULE_AUTHOR("info@mocean-labs.com"); MODULE_DESCRIPTION("Xilinx I2C bus driver"); MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:"DRIVER_NAME); From patchwork Sat Jun 26 10:28:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raviteja Narayanam X-Patchwork-Id: 12346407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4E6DC49EA5 for ; Sat, 26 Jun 2021 10:36:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 6FA4961931 for ; Sat, 26 Jun 2021 10:36:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6FA4961931 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EEeYS+PCJQcXptcUSdsNtL1YUaqkueeZ1hH6w2fLNXk=; b=MIX1Vt13czQzVT Pz4YuIZhE1E+OZNvovpnavZ3+iynj1kNOPDDpdPyzP3QbA/fC9RcOAgVnaqBEx68pICQnJSBg87O0 BV+OZGnFoV3p54zPySC9mnVOcoIkpV4iDLU6FuZQMXwtucS/EeBGZ7eIPx+VzVfN6zcp7lXkY16mO Ncn1bswXHS/ftqHB5W9aFClCwKD4gZFrPNdZbDB+dvchtQKBDcD2dHKsVCn2Nnlz4OQHuMiyLXtvM 4PXybshSH/JaSkYNJ7OBLsoazCJBSot8c813ExDBNc9ysJ8GDzadYVPOXyqf3iFnAvFsgZir6QqXd M6nyjYm65SF9rc9gQnKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5dL-003u61-9n; Sat, 26 Jun 2021 10:33:57 +0000 Received: from mail-co1nam11on2040.outbound.protection.outlook.com ([40.107.220.40] helo=NAM11-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lx5Yu-003sG2-7L for linux-arm-kernel@lists.infradead.org; Sat, 26 Jun 2021 10:29:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CcFyRGN1nwFINh4//s5OEAkbdkA7UOiroW4qbveBQorcCojMNZPE8eMWMFWGKX/ZHRII0YW4e6mF5kfceYSMQVU0x6mbc/yIGNLkFQT+XGVvaFyYr9zQ5+uQVrI4P/us4SEC5qg/3JD5sDh9fPl046eadQDCtXvox4lruDekIuTxrVhdcUpV4rknbrDbxb9ZHBYZ4muG6A3fKh0MAYqvNWsvmJ2G/XTcsH3p/vipUFzqMB0Db+PHXQrmfuroE2/OLSRNBaSUpLWihba8TtUE7ysRmlDSvbnjkLJvZcASWZkaCyx0Dg9joly0QIVQzU27n+GoWisdlz7UqCZG7Lptvg== 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=pjEPQ2Fq7OhyHg8b53LBLrS6j03OCLqfx/yZrG7v5EY=; b=NJz2LgZSqBbhEU1NBIeD8um+wLSBL6dsQYllrhTJkEvditxexMAvQ1PLJ8o2gd4eumyjlkC2Jgs6gnevjPxolbN/iZLmdW2rwETpykzsd71cBpgVIUtcc0GO+J5KcGUQbZO7rZ/yaFeIQRAyWTv95Bgdn89m9ASyauaMSbLLXnqL1kM5z87cy63fxuMGlV0aTTCpqBWIoBm1OBKtY6dvkadIYXrSaz0DjTFw0hxdyuOTsoEgqDx/s5Qhuw8cBPqgf4qgXOIGe/o4iFLt35wq4tinuu7zo0Ui/vFIQ9vd0Zzlh1IdVmFgEZaL1uL3EIs6BCaM2FIE7jLBzWDQ8hG0ug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=pjEPQ2Fq7OhyHg8b53LBLrS6j03OCLqfx/yZrG7v5EY=; b=JRtXoawPFgbz80dI5Wqrl+3r/kosfdwv/rwPTpb0vKAcDKGE44QqK4dz99GgaXxr3cjR2T4V8ywms5VfE5oETd8ErWpeQKZCxMT7Ij6oHjNAep9ufSYyrV8A/Q5fb4tPhPf81hvlU7r2u7cBJJ94O2ThV7z+gDdEp8TJXl0S6CI= Received: from SN6PR01CA0015.prod.exchangelabs.com (2603:10b6:805:b6::28) by DM6PR02MB7098.namprd02.prod.outlook.com (2603:10b6:5:251::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.23; Sat, 26 Jun 2021 10:29:18 +0000 Received: from SN1NAM02FT0033.eop-nam02.prod.protection.outlook.com (2603:10b6:805:b6:cafe::3d) by SN6PR01CA0015.outlook.office365.com (2603:10b6:805:b6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.19 via Frontend Transport; Sat, 26 Jun 2021 10:29:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0033.mail.protection.outlook.com (10.97.5.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4264.18 via Frontend Transport; Sat, 26 Jun 2021 10:29:17 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 26 Jun 2021 03:29:03 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Sat, 26 Jun 2021 03:29:03 -0700 Received: from [10.140.6.6] (port=55646 helo=xhdappanad40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lx5Yb-000AWJ-TD; Sat, 26 Jun 2021 03:29:02 -0700 From: Raviteja Narayanam To: , CC: , , , , , Raviteja Narayanam Subject: [PATCH v2 10/10] i2c: xiic: Add smbus_block_read functionality Date: Sat, 26 Jun 2021 15:58:06 +0530 Message-ID: <20210626102806.15402-11-raviteja.narayanam@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> References: <20210626102806.15402-1-raviteja.narayanam@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ccc7fc19-5a25-4549-e0fe-08d9388d40d6 X-MS-TrafficTypeDiagnostic: DM6PR02MB7098: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t95PndNEtNYswBD17tlWxm5K2WuK05Q4VzQbB89f0Wgu3nxdYeTPADMKWuLnJ31g/vL5BH+ybXNFmb+IlGOk7QjytA9K07fshcTssccCkeXRc9StconoofI2/GlNapi5xDKq9uwbOztB/dscWn6shkfC9qqEk9LJhsScM5lFt48/4/7YH96jT+ZCQ4Hfdlkq6g6Kb4cIQxrnVHRQUO+Yi8IUJcaP4XcpQT672eIA6KBw5yzmI5zjfRbP4hDaPBlCcGBtXgUryfJVZYKrM4OdX4xFCIvq6HxEpOV6chs/OFzdFtjvFkutZWKfNoo150CoKxH4UMQyU/w1vH1s0jixW8B8Ja3y+SQfT6fCLJQujoLSLU/9RBjdUBUCcw2RrJPG2CS3OmeQEmAUtgoyedExcbfuMIWONqYB8QYyy3y0mn6bzizWOvyfrXHWQhhI7poWeDrcKixiYKPCgtc7CwBu2ziyFy7pxLmfayUNVLoeJ45tVZ2+7lHk4GN4KYyfITJyNtY1fN3hGpyBuDGaK2DwPMAInq8lLBGknhT7/1oOUt8qx/YgOEXdY6s3/6yIHPylPW165YuU3abm8a3ATvOVAVPkSEuTOXc6e1mVH5zid4arjoy2RhOgzmnBsvd3BrX4mbJiGqi67npZJWbXApnIozBeIjXjjMbS39VNk5EGV4zfyAgYrSUW0BlRBU+G5vTTXvdNuvGdiJui25wA37SdQA== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(136003)(396003)(39860400002)(346002)(376002)(46966006)(36840700001)(70206006)(8676002)(70586007)(44832011)(26005)(82740400003)(43170500006)(83380400001)(7636003)(356005)(186003)(7696005)(107886003)(1076003)(4326008)(2906002)(36906005)(36756003)(336012)(316002)(8936002)(2616005)(426003)(110136005)(54906003)(9786002)(5660300002)(6636002)(47076005)(478600001)(36860700001)(82310400003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2021 10:29:17.8204 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ccc7fc19-5a25-4549-e0fe-08d9388d40d6 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0033.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB7098 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210626_032920_333118_A756E90F X-CRM114-Status: GOOD ( 22.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org smbus_block_read is added to xiic driver to read from few sensors which support this command. Since the number of bytes to read is not known prior to transfer, we are using xiic standard mode for low level control of IP. Signed-off-by: Raviteja Narayanam --- drivers/i2c/busses/i2c-xiic.c | 80 ++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 26fc174b8e95..931b9bce87fe 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -65,6 +65,7 @@ enum xiic_endian { * @dynamic: Mode of controller * @prev_msg_tx: Previous message is Tx * @quirks: To hold platform specific bug info + * @smbus_block_read: Flag to handle block read */ struct xiic_i2c { struct device *dev; @@ -84,6 +85,7 @@ struct xiic_i2c { bool dynamic; bool prev_msg_tx; u32 quirks; + bool smbus_block_read; }; struct xiic_version_data { @@ -344,6 +346,54 @@ static void xiic_deinit(struct xiic_i2c *i2c) xiic_setreg8(i2c, XIIC_CR_REG_OFFSET, cr & ~XIIC_CR_ENABLE_DEVICE_MASK); } +static void xiic_smbus_block_read_setup(struct xiic_i2c *i2c) +{ + u8 rxmsg_len; + u8 rfd_set = 0; + + /* + * Clear the I2C_M_RECV_LEN flag to avoid setting + * message length again + */ + i2c->rx_msg->flags &= ~I2C_M_RECV_LEN; + + /* Set smbus_block_read flag to identify in isr */ + i2c->smbus_block_read = true; + + /* Read byte from rx fifo and set message length */ + rxmsg_len = xiic_getreg8(i2c, XIIC_DRR_REG_OFFSET); + + i2c->rx_msg->buf[i2c->rx_pos++] = rxmsg_len; + + /* Check if received length is valid */ + if (rxmsg_len <= I2C_SMBUS_BLOCK_MAX) { + /* Set Receive fifo depth */ + if (rxmsg_len > IIC_RX_FIFO_DEPTH) { + rfd_set = IIC_RX_FIFO_DEPTH - 1; + i2c->rx_msg->len = rxmsg_len + 1; + } else if ((rxmsg_len == 1) || + (rxmsg_len == 0)) { + /* + * Minimum of 3 bytes required to exit cleanly. 1 byte + * already received, Second byte is being received. Have + * to set NACK in read_rx before receiving the last byte + */ + i2c->rx_msg->len = 3; + } else { + rfd_set = rxmsg_len - 2; + i2c->rx_msg->len = rxmsg_len + 1; + } + xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, rfd_set); + + return; + } + + /* Invalid message length, trigger STATE_ERROR with tx_msg_len in ISR */ + i2c->tx_msg->len = 3; + i2c->smbus_block_read = false; + dev_err(i2c->adap.dev.parent, "smbus_block_read Invalid msg length\n"); +} + static void xiic_read_rx(struct xiic_i2c *i2c) { u8 bytes_in_fifo, cr = 0, bytes_to_read = 0; @@ -366,6 +416,12 @@ static void xiic_read_rx(struct xiic_i2c *i2c) if (!i2c->dynamic) { bytes_rem = xiic_rx_space(i2c) - bytes_in_fifo; + /* Set msg length if smbus_block_read */ + if (i2c->rx_msg->flags & I2C_M_RECV_LEN) { + xiic_smbus_block_read_setup(i2c); + return; + } + if (bytes_rem > IIC_RX_FIFO_DEPTH) { bytes_to_read = bytes_in_fifo; } else if (bytes_rem > 1) { @@ -638,6 +694,12 @@ static irqreturn_t xiic_process(int irq, void *dev_id) /* The bus is not busy, disable BusNotBusy interrupt */ xiic_irq_dis(i2c, XIIC_INTR_BNB_MASK); + if (i2c->tx_msg && i2c->smbus_block_read) { + i2c->smbus_block_read = false; + /* Set requested message len=1 to indicate STATE_DONE */ + i2c->tx_msg->len = 1; + } + if (!i2c->tx_msg) goto out; @@ -763,8 +825,12 @@ static void xiic_start_recv(struct xiic_i2c *i2c) rfd_set = IIC_RX_FIFO_DEPTH - 1; } else if ((rx_watermark == 1) || (rx_watermark == 0)) { rfd_set = rx_watermark - 1; - /* Handle single byte transfer separately */ - cr |= XIIC_CR_NO_ACK_MASK; + + /* Set No_ACK, except for smbus_block_read */ + if (!(i2c->rx_msg->flags & I2C_M_RECV_LEN)) { + /* Handle single byte transfer separately */ + cr |= XIIC_CR_NO_ACK_MASK; + } } else { rfd_set = rx_watermark - 2; } @@ -971,7 +1037,7 @@ static int xiic_start_xfer(struct xiic_i2c *i2c) static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { - bool broken_read, max_read_len; + bool broken_read, max_read_len, smbus_blk_read; struct xiic_i2c *i2c = i2c_get_adapdata(adap); int err, count; @@ -996,20 +1062,22 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) i2c->prev_msg_tx = false; /* - * Scan through nmsgs, use dynamic mode when none of the below two + * Scan through nmsgs, use dynamic mode when none of the below three * conditions occur. We need standard mode even if one condition holds * true in the entire array of messages in a single transfer. * If read transaction as dynamic mode is broken for delayed reads * in xlnx,axi-iic-2.0 / xlnx,xps-iic-2.00.a IP versions. * If read length is > 255 bytes. + * If smbus_block_read transaction. */ for (count = 0; count < i2c->nmsgs; count++) { broken_read = (i2c->quirks & DYNAMIC_MODE_READ_BROKEN_BIT) && (i2c->tx_msg[count].flags & I2C_M_RD); max_read_len = (i2c->tx_msg[count].flags & I2C_M_RD) && (i2c->tx_msg[count].len > MAX_READ_LENGTH_DYNAMIC); + smbus_blk_read = (i2c->tx_msg[count].flags & I2C_M_RECV_LEN); - if (broken_read || max_read_len) { + if (broken_read || max_read_len || smbus_blk_read) { i2c->dynamic = false; break; } @@ -1040,7 +1108,7 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) static u32 xiic_func(struct i2c_adapter *adap) { - return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SMBUS_BLOCK_DATA; } static const struct i2c_algorithm xiic_algorithm = {