From patchwork Fri Oct 30 06:53:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rayagonda Kokatanur X-Patchwork-Id: 11868601 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,T_TVD_MIME_NO_HEADERS, 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 789DEC56201 for ; Fri, 30 Oct 2020 06:55:42 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CDE1422202 for ; Fri, 30 Oct 2020 06:55:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="d7ixaVRe"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="NfrFaBPY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CDE1422202 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=broadcom.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=merlin.20170209; h=Sender:Content-Type:MIME-Version: Cc:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: References:In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MJaCi30fCn8Sjly7PDBtdK25fdrUFFiM7cqYDObYMbY=; b=d7ixaVRetVcMfi3iKgL/K1vIa A7znVHduKn7d1fGhDRiHseObX54e8gvSwPEgpCz0hcea6Nl/NSFoI44hoVn49IVUbmVrXQpcdGFDC INL18GNwbnlT4UNRVL8J9sVhtgACZ79vgyzUYN2R7j0JzFxm3zu7eJdIKkoHKHEyucSWqsnjeS/pr WLrnGygfAOTT5pOfogMmkRQahY0gbX4Mfz+C87JG52ZFg06QCYHC5Nbx2IbgSlW0rEIoFNhSOGGRS RXVwmtlXT30PG9QgaIfSeI7tpzTKVpgWUZY93YiB221BctHdNXZZBueN57V536ZaFhOAXBYpuc5YL AFTQWgCNw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYOIi-0000as-0r; Fri, 30 Oct 2020 06:54:16 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYOId-0000ZJ-QR for linux-arm-kernel@lists.infradead.org; Fri, 30 Oct 2020 06:54:13 +0000 Received: by mail-pf1-x442.google.com with SMTP id c20so4429661pfr.8 for ; Thu, 29 Oct 2020 23:54:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=udAGh6cz86p5DhNevzM5M6XRNxRpeBaRm4O3FxrSPj8=; b=NfrFaBPYIZK1/kyf3bxnv0z+t/NvxvR+3RdcSOj1QMClwqvL3G7Okqc4QMuExn+vEE gC+sk18mTlWGb513rNHOkLS/dLr5R22miD1CZNKn/dCwZzQU5mTjO5DBfqGjV6ptQy2f XRXqdStZE+G7ogPhsQxBW6i19ZNINAAajHT/A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=udAGh6cz86p5DhNevzM5M6XRNxRpeBaRm4O3FxrSPj8=; b=OiI1e5QlAhF4F3Od8OIkHwrrAqYaYXmgNHDuxrMxJRealv1agBG7wXh9Vqg34IaZJu wC/0OHWuJ0OnjpOpc3zyE2ALGe0ZdULOh8//D4KMArON4Z2DJ20k8oDCFjk7vHGabQBC n8aJRhP53hrCET9xoEP29YsvGLmL6IOPILWAKDAuf2BfDHZ+SL4JmjKXngyexkW5XrbS F0iaDyAauoBWF0yXrww31EyajHWHREYVul7DtNf/QIR16Gaiuwq6Da5Q2QUOw33XGN3b Yf5tX9+SfUmxlQB7sX+O+UHAR8Dtr1sMI/5iUnvycclvZ83LyNFojGOX15edavlkQtRf nN1A== X-Gm-Message-State: AOAM530O2MW7ggE7qatGPEunVQYJaLdl9dDvTeYth6EoWdpO16SKlb+I EZaGc9eQ1Pl4RT7Pgz8BHFs21g== X-Google-Smtp-Source: ABdhPJx9Pl0YKzvpetBQyxAqlLKMo4hM1UpQz91kf1g4mlUh9rKjlsELeCiB2D4Z2eYYm7+ge6y0WQ== X-Received: by 2002:a17:90a:318d:: with SMTP id j13mr1119830pjb.209.1604040849906; Thu, 29 Oct 2020 23:54:09 -0700 (PDT) Received: from rayagonda.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id n1sm4561547pgl.31.2020.10.29.23.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 23:54:09 -0700 (PDT) From: Rayagonda Kokatanur To: Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Wolfram Sang , Florian Fainelli , Brendan Higgins , Andy Shevchenko , Lori Hikichi , Dhananjay Phadke , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/6] i2c: iproc: handle only slave interrupts which are enabled Date: Fri, 30 Oct 2020 12:23:35 +0530 Message-Id: <20201030065339.955-3-rayagonda.kokatanur@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201030065339.955-1-rayagonda.kokatanur@broadcom.com> References: <20201030065339.955-1-rayagonda.kokatanur@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201030_025411_917812_2A17090C X-CRM114-Status: GOOD ( 11.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rayagonda Kokatanur MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Handle only slave interrupts which are enabled. The IS_OFFSET register contains the interrupt status bits which will be set regardless of the enabling of the corresponding interrupt condition. One must therefore look at both IS_OFFSET and IE_OFFSET to determine whether an interrupt condition is set and enabled. Fixes: c245d94ed106 ("i2c: iproc: Add multi byte read-write support for slave mode") Signed-off-by: Rayagonda Kokatanur --- drivers/i2c/busses/i2c-bcm-iproc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index 834a98caeada..b54f5130d246 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -507,12 +507,17 @@ static void bcm_iproc_i2c_process_m_event(struct bcm_iproc_i2c_dev *iproc_i2c, static irqreturn_t bcm_iproc_i2c_isr(int irq, void *data) { struct bcm_iproc_i2c_dev *iproc_i2c = data; - u32 status = iproc_i2c_rd_reg(iproc_i2c, IS_OFFSET); + u32 slave_status; + u32 status; bool ret; - u32 sl_status = status & ISR_MASK_SLAVE; - if (sl_status) { - ret = bcm_iproc_i2c_slave_isr(iproc_i2c, sl_status); + status = iproc_i2c_rd_reg(iproc_i2c, IS_OFFSET); + /* process only slave interrupt which are enabled */ + slave_status = status & iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET) & + ISR_MASK_SLAVE; + + if (slave_status) { + ret = bcm_iproc_i2c_slave_isr(iproc_i2c, slave_status); if (ret) return IRQ_HANDLED; else