Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4356070imu; Mon, 28 Jan 2019 23:32:57 -0800 (PST) X-Google-Smtp-Source: ALg8bN7n0BjTu/EQC5PTbUpnGPADKEsqfJmj+wDibOBlbRwclGQrjcC1dVyAieMOic8cvZ1pJkzG X-Received: by 2002:a62:5444:: with SMTP id i65mr25894265pfb.193.1548747177680; Mon, 28 Jan 2019 23:32:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548747177; cv=none; d=google.com; s=arc-20160816; b=MdisuqJ7B9LUUP6lmba1zqCj6VQ/GI/bQHTykPFlN3t5w5g7T0LehwLlvYIEmr/qaF LWzMIsrfOK8aG0dw9DtOTVCquKRlEqCZ9UlEbRf1ep5yMlRyaAsu3gpS9X2FzjXrQWQu HQhRK3COfSHHCcpDfKs46a05BpX5aJCr7f7XAnQ+JUpvsw5P7+TgSyYeLdL7QX/ROWU+ VtRe505NGBxTGyzQDOpfyhSnlKLEl75c1LUiZ4AsWXgC++HsYDDnnjzlLp8X0zbNvTg2 RBa5Qz2wyDNwqMPIXOKlelHKClOKzeinuKnvCwvKmSe3/NLxLoaG8Z8+Uw1ExfM9bo4M RUdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=sA40iYSy0xSFamtcugG51PWj4xgdEZWQohLRLIsNynQ=; b=s/CEAeJr6ewaNpouyO6+g3hyYBd3FEK2roVHiPK0jRcvJGqTb5Y0VWPlByWX8wA6oi V6+7mDMT+Nnu4BG4wXXRknL9LUOorX/i6yxKMZ9DJZ3UOlzzh/8ycmr5BvJ54JeGmdqN Pd9Jwe30/pflM7AWWJV8bfiapZGja3HIhTtNI+HEFlT9Dg0kwogmrZ8hbQymoXuxo/Ct vabilG2iWn+Z8cstFG+Shz6NDXMDD8CUXb0T7DWY1jbBdr4qG17UuVjSKYxja4KUhaDj lKLvTGgvdHG9b1kc/2oh2uEyFnzAkvyHgmyeHM7/W4Elfiodpbtl8U1rzlH8bWBqKwMz pvPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m39si35495328plg.315.2019.01.28.23.32.41; Mon, 28 Jan 2019 23:32:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727178AbfA2Hca (ORCPT + 99 others); Tue, 29 Jan 2019 02:32:30 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:20119 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726957AbfA2HcZ (ORCPT ); Tue, 29 Jan 2019 02:32:25 -0500 X-UUID: b50b04ceea4744839563f89db9d74c1c-20190129 X-UUID: b50b04ceea4744839563f89db9d74c1c-20190129 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 775472094; Tue, 29 Jan 2019 15:32:11 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 29 Jan 2019 15:32:11 +0800 Received: from mtkslt302.mediatek.inc (10.21.14.115) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 29 Jan 2019 15:32:11 +0800 From: Bibby Hsieh To: Jassi Brar , Matthias Brugger , Rob Herring , CK HU CC: Daniel Kurtz , Sascha Hauer , , , , , , Sascha Hauer , Philipp Zabel , Nicolas Boichat , Bibby Hsieh , YT Shen , Daoyuan Huang , Jiaguang Zhang , Dennis-YC Hsieh , Houlong Wei , , , Frederic Chen Subject: [PATCH 03/10] soc: mediatek: move the CMDQ_IRQ_MASK into cmdq driver data Date: Tue, 29 Jan 2019 15:32:00 +0800 Message-ID: <1548747128-60136-4-git-send-email-bibby.hsieh@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1548747128-60136-1-git-send-email-bibby.hsieh@mediatek.com> References: <1548747128-60136-1-git-send-email-bibby.hsieh@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The interrupt mask and thread number has positive correlation, so we move the CMDQ_IRQ_MASK into cmdq driver data and calculate it by thread number. Signed-off-by: Bibby Hsieh --- drivers/mailbox/mtk-cmdq-mailbox.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c index 909eb23..f6174ca 100644 --- a/drivers/mailbox/mtk-cmdq-mailbox.c +++ b/drivers/mailbox/mtk-cmdq-mailbox.c @@ -17,7 +17,6 @@ #include #define CMDQ_OP_CODE_MASK (0xff << CMDQ_OP_CODE_SHIFT) -#define CMDQ_IRQ_MASK 0xffff #define CMDQ_NUM_CMD(t) (t->cmd_buf_size / CMDQ_INST_SIZE) #define CMDQ_CURR_IRQ_STATUS 0x10 @@ -71,6 +70,7 @@ struct cmdq { void __iomem *base; u32 irq; u32 thread_nr; + u32 irq_mask; struct cmdq_thread *thread; struct clk *clock; bool suspended; @@ -284,11 +284,11 @@ static irqreturn_t cmdq_irq_handler(int irq, void *dev) unsigned long irq_status, flags = 0L; int bit; - irq_status = readl(cmdq->base + CMDQ_CURR_IRQ_STATUS) & CMDQ_IRQ_MASK; - if (!(irq_status ^ CMDQ_IRQ_MASK)) + irq_status = readl(cmdq->base + CMDQ_CURR_IRQ_STATUS) & cmdq->irq_mask; + if (!(irq_status ^ cmdq->irq_mask)) return IRQ_NONE; - for_each_clear_bit(bit, &irq_status, fls(CMDQ_IRQ_MASK)) { + for_each_clear_bit(bit, &irq_status, fls(cmdq->irq_mask)) { struct cmdq_thread *thread = &cmdq->thread[bit]; spin_lock_irqsave(&thread->chan->lock, flags); @@ -472,6 +472,9 @@ static int cmdq_probe(struct platform_device *pdev) dev_err(dev, "failed to get irq\n"); return -EINVAL; } + + cmdq->thread_nr = (u32)(unsigned long)of_device_get_match_data(dev); + cmdq->irq_mask = GENMASK(cmdq->thread_nr - 1, 0); err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED, "mtk_cmdq", cmdq); if (err < 0) { @@ -489,6 +492,7 @@ static int cmdq_probe(struct platform_device *pdev) } cmdq->thread_nr = (u32)(unsigned long)of_device_get_match_data(dev); + cmdq->irq_mask = GENMASK(cmdq->thread_nr - 1, 0); cmdq->mbox.dev = dev; cmdq->mbox.chans = devm_kcalloc(dev, cmdq->thread_nr, sizeof(*cmdq->mbox.chans), GFP_KERNEL); -- 1.9.1