From patchwork Mon Nov 2 03:54:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rayagonda Kokatanur X-Patchwork-Id: 11872935 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 5B302C388F2 for ; Mon, 2 Nov 2020 03: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 DD6D721D91 for ; Mon, 2 Nov 2020 03: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="024HBn9E"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="HIn/1lFz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD6D721D91 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=0V3CfeAxfY9Mb79EEVgDQsk1wthkF02hCCWqCkhjtUA=; b=024HBn9EU+O/6XsfvG8cdbrg2 ZqEg/eIrVSQAyB22rNKZSmHVhFT4JlMDJmUy+pCuGV3R+52GKcHpxi2aQlSyvzvp/PS0vz3RdzVni 7rWLpOM02IylA7rCWP/9CtoN3fAov0Zy8YWgBOiXzvR7Vhtsfr4rHuCzicTc9lmWGiYc+8waChWGg Hc6+nCv1VN34BG442abQgtofeiDWqTvOSeOinxrLQ5VmQGZ60T9NdCcwd60wksd/gerY0gjkqqnuq eb90qWTDjIpmbQHsobaBlVlXeNqK3pz6wmRUeA2X7X2WhIsyfgFEHNB47649eo/34n7B+tRpZzw4I B6Et+dFMg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZQw0-0000iW-9i; Mon, 02 Nov 2020 03:55:08 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZQvt-0000gt-BG for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2020 03:55:02 +0000 Received: by mail-pg1-x542.google.com with SMTP id z24so9647868pgk.3 for ; Sun, 01 Nov 2020 19:55:01 -0800 (PST) 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=gGO1DDi3EjuU8NFu0y+9rn5dT96uaytbf7fKXxQz45c=; b=HIn/1lFzplJDw1nh/rlhCbroQ+IkpvzIKfwVFxX+jlaxhHOqulggAM585A89eo8fJO 8Opjj7CjjPqQzgQwu7MF9MZD11pgtjbv4AnQEDajPyJIhgCEBcb5zv6k0BcE5KZCesgw Ai+Nsi0xAOLrATyMB2bwlJvZha8jY/idkRAOk= 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=gGO1DDi3EjuU8NFu0y+9rn5dT96uaytbf7fKXxQz45c=; b=C4Ce/NeMl9myS7i8bQ0MK1wqlv1+GyHfLUyxJN0hyo+C1Pay2JTA8fhLTx8ekIK+yt /OvQ7xovP32BLQoL8DTX1X2ZIxnUrCzxenkm07Q329Xav7HVc0jnfj/OHifUPmocwy5m HpYzwnM+/MAtjcB3kvmAOSQg0dBsPXOo1KXWANSHdurbpriSlblLy2G7e54sHzpf+C/A X9d8N0364ldkzWtq9mfx+np8gqNBLrtKsIc07v+aPXm4k7EAdFiSVl3QXFa459VZZ2gx eDjUvmTiKZQHhPkDDb6wH9ud18piPbJRG17t3caqT6MurezZ0HYWZSQunCm/k6Gx6rTH iO/w== X-Gm-Message-State: AOAM5338h885XvbbqH/KAizkP0cuPfi5jQ+/yDw5xzzbI5xxEenTHKu0 1RoMZTWclN89+0SNrdznOcgWDg== X-Google-Smtp-Source: ABdhPJxxxFUbd1NTgK6ygQCEHCgCT85kN2fmMUT5stR1NptLqeOlY87efKK0yNg/eA+QCHkHM/o/Bg== X-Received: by 2002:a17:90a:9f82:: with SMTP id o2mr9638483pjp.52.1604289299521; Sun, 01 Nov 2020 19:54:59 -0800 (PST) Received: from rayagonda.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id y5sm5655711pfc.165.2020.11.01.19.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Nov 2020 19:54:58 -0800 (PST) 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 v3 2/6] i2c: iproc: handle only slave interrupts which are enabled Date: Mon, 2 Nov 2020 09:24:29 +0530 Message-Id: <20201102035433.6774-3-rayagonda.kokatanur@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201102035433.6774-1-rayagonda.kokatanur@broadcom.com> References: <20201102035433.6774-1-rayagonda.kokatanur@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201101_225501_565992_33A5B4AB X-CRM114-Status: GOOD ( 12.94 ) 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 Acked-by: Ray Jui --- 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