Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4441027imu; Tue, 29 Jan 2019 01:24:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN4ut6MOIId9e/Qb7E1UmpaLKVxglBouGu7DPSqvPCBGjHYwNRYliFVAEePoAj8bOom7ZrK3 X-Received: by 2002:a62:5d0c:: with SMTP id r12mr26306787pfb.0.1548753866284; Tue, 29 Jan 2019 01:24:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548753866; cv=none; d=google.com; s=arc-20160816; b=VaDbWcXIefhVpdMp1Tw7Q0ldO1te4JeE1AgVsTIgEkPu+cRlhOWXamhpjI+AZGTE22 6i0zaswFcr9YCKU+AUHtYGeoGoqm/NJ7TwY2O6OmfFxILcJFFnNXadi+lRVHgIBwhnQZ KaXeF5sM53EVUuHyeITxPo77NMZmbIopU/eMjIB07OTnAvjflk04dKpVyYrj2gDa3/b2 uzpW2xrYEzz75jT6d2Hj6UKFQAUkW+6D77d3T4OhBB3VQxkuL+kOvzExZqZ6aSxML4BY jHNavUQ3X5x5812EGqRGTw97ROTSvNpmphQwiNX7qkv9fThYqiwyAnBuYLYLUgv1YLE1 azzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=Ggyi3vW2qBCob1wkpIGBkC7N65EY3tUUqG2N0icAZww=; b=ECKivu+xDY/am2ibmpOhrCNmjh+rl1/vQOL3eU4Ytvy1l710XskXYTz8dKqw2dn+I4 ysRF3bjftgoz3maNVaKLYUv/b6FopvtAV5ZpjQbEMS/hVm+J+ZnA/BGT4056VeQKznrC WK6sLQBYfJd9NzvS1zymDiUK2YxOErUrvS2A13wN/Nwaj/xNJ6tZRvK6SSnTDm8MeyQ4 /6qc+DH0Nl3lVxELNtbZqDesps+THinP1oV1+/JCltjad/CcjlmAb6rGIVcSqs1fN7Vs 0uO9TFM1g3760duUrCcd+BjH3c4WtlgE9P7q0qUvd0FQ2lhw+BOkv49mF0kAygnsLD2F fvhw== 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 d1si36183153pla.412.2019.01.29.01.24.10; Tue, 29 Jan 2019 01:24:26 -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 S1727968AbfA2JXE (ORCPT + 99 others); Tue, 29 Jan 2019 04:23:04 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:49419 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725298AbfA2JXE (ORCPT ); Tue, 29 Jan 2019 04:23:04 -0500 X-UUID: 05fc5744be63431ea482d404dfafe204-20190129 X-UUID: 05fc5744be63431ea482d404dfafe204-20190129 Received: from mtkmrs01.mediatek.inc [(172.21.131.159)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1945678748; Tue, 29 Jan 2019 17:22:57 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs03n1.mediatek.inc (172.21.101.181) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 29 Jan 2019 17:22:55 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 29 Jan 2019 17:22:56 +0800 Message-ID: <1548753776.11055.4.camel@mtksdaap41> Subject: Re: [PATCH 03/10] soc: mediatek: move the CMDQ_IRQ_MASK into cmdq driver data From: CK Hu To: Bibby Hsieh CC: Jassi Brar , Matthias Brugger , Rob Herring , Daniel Kurtz , Sascha Hauer , , , , , , Sascha Hauer , "Philipp Zabel" , Nicolas Boichat , "YT Shen" , Daoyuan Huang , Jiaguang Zhang , Dennis-YC Hsieh , Houlong Wei , , , Frederic Chen Date: Tue, 29 Jan 2019 17:22:56 +0800 In-Reply-To: <1548747128-60136-4-git-send-email-bibby.hsieh@mediatek.com> References: <1548747128-60136-1-git-send-email-bibby.hsieh@mediatek.com> <1548747128-60136-4-git-send-email-bibby.hsieh@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Bibby: On Tue, 2019-01-29 at 15:32 +0800, Bibby Hsieh wrote: > 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)) { for_each_clear_bit(bit, &irq_status, cmdq->thread_nr) { Regards, CK > 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);