From mboxrd@z Thu Jan 1 00:00:00 1970 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=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED 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 9708EC282E1 for ; Mon, 22 Apr 2019 03:52:06 +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 656E920811 for ; Mon, 22 Apr 2019 03:52:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PsNY6T0Z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 656E920811 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IXc5kfMTKiBxQPj/0Moi4SSgIibsDp4Pa3GH71ZHF9I=; b=PsNY6T0Z1teN5C PHc9oMX1oLga/0ASQoU/8YabyWXU0HBetTaiJ7ZvZATajwoeupGpiWEkx2jvO7tcPGiE8g8hAhaGY QQ+f+tDRMDmCaYLfDcrsIvKBBEYNyOgb1Iikf6UFsqv/7gYkcSrAnp+EbYKOkmx81iO/xqmAVkDi/ 3ZAavK22+nnkY+D6Q+yr5ruKGI+wpv9t1cvQui1e7b5+BJfTehw/lGv5b6GT9lferU2JlVLrlIOZR pv4ZJGn8oGxk1mz7jP03sQiBH3rey58k/RrkG7GlKwP09N3vDxINiki2Jk/Wyj3kaW5iG/VgD5jxg xuyPgB8OrJkDCu81SStg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hIPzx-0002di-C7; Mon, 22 Apr 2019 03:52:05 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hIPzt-0002dI-6t; Mon, 22 Apr 2019 03:52:03 +0000 X-UUID: fb33e9094a82417db9bd18c95f0eca08-20190421 X-UUID: fb33e9094a82417db9bd18c95f0eca08-20190421 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1834890628; Sun, 21 Apr 2019 19:51:47 -0800 Received: from MTKMBS02N1.mediatek.inc (172.21.101.77) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sun, 21 Apr 2019 20:51:46 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 22 Apr 2019 11:51:38 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 22 Apr 2019 11:51:38 +0800 Message-ID: <1555905098.25149.0.camel@mtksdaap41> Subject: Re: [PATCH v4 05/12] soc: mediatek: cmdq: move the CMDQ_IRQ_MASK into cmdq driver data From: CK Hu To: Bibby Hsieh Date: Mon, 22 Apr 2019 11:51:38 +0800 In-Reply-To: <20190415125833.38704-6-bibby.hsieh@mediatek.com> References: <20190415125833.38704-1-bibby.hsieh@mediatek.com> <20190415125833.38704-6-bibby.hsieh@mediatek.com> X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190421_205201_252556_4A571FCB X-CRM114-Status: GOOD ( 15.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Nicolas Boichat , Philipp Zabel , srv_heupstream@mediatek.com, kendrick.hsu@mediatek.com, Daoyuan Huang , Sascha Hauer , Jassi Brar , linux-kernel@vger.kernel.org, Daniel Kurtz , Dennis-YC Hsieh , YT Shen , Rob Herring , linux-mediatek@lists.infradead.org, Houlong Wei , Sascha Hauer , Matthias Brugger , Jiaguang Zhang , Frederic Chen , linux-arm-kernel@lists.infradead.org, ginny.chen@mediatek.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, Bibby: On Mon, 2019-04-15 at 20:58 +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. Reviewed-by: CK Hu > > Signed-off-by: Bibby Hsieh > --- > drivers/mailbox/mtk-cmdq-mailbox.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c > index 22811784dc7d..87617dc7504d 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, cmdq->thread_nr) { > 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) { > @@ -488,7 +491,6 @@ static int cmdq_probe(struct platform_device *pdev) > return PTR_ERR(cmdq->clock); > } > > - cmdq->thread_nr = (u32)(unsigned long)of_device_get_match_data(dev); > cmdq->mbox.dev = dev; > cmdq->mbox.chans = devm_kcalloc(dev, cmdq->thread_nr, > sizeof(*cmdq->mbox.chans), GFP_KERNEL); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel