Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3821454ybl; Tue, 20 Aug 2019 02:48:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLUONmF+KRT3JIS5v+JlatJZrb/eP8BdyEUKXDNfhaXTe0ONPyKgTGtbAh2Tj7Ts01HNLc X-Received: by 2002:a17:902:e613:: with SMTP id cm19mr19677097plb.299.1566294530397; Tue, 20 Aug 2019 02:48:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566294530; cv=none; d=google.com; s=arc-20160816; b=v4EtgC4+YK2aWDNlB4DL3tccqG2RTe7szv7PO4h9joCOuEykyzTR+RT3FHgEbd6FJ1 iBoF1JzwBvJa9xYc8klUbDjPqhERQn9aHkYqX93oXH0kAV6m5x9Xng8j5PW8tcf4zxq2 mR8Qb8yn3DSEjCKVd4z6JkeF4zXoNgpdF/a1XWpChu4ZaCFqrJRO09CMpPYGkgWa4JsN WOav8wBYQNsI8FnLU7EEG4/ZpqicxxpXuf9ohhnJKGRM+yNC+qXUuUZuZynRRmD360k9 3+Mm6cyzY1G0G75qUE1zTCwAQE6VbsyFWyVeMZJuhdmkMYjh2hwHD7/JYjqsPLATokjH 9pAA== 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=u9ovrurQ+7Dp7YXXQeRVLuAM4lutefV1MJkS1FZ65t0=; b=pU/XvqmP6fY92MTA450Tprwkp5oXaFIRRk8yIRzk9mdnXNNRs2BkrR3jo8ghN3XUWG AYUE4OZ6Y8W/r9ixaPxvCOIe2yQUK8nLbmJ/TD29CDQGlDuBgYF1GmMuZs5UDWwtO3l/ cf8Ty1HtLTOl5cWDM7Xryb/be/GtAUga3BWoMQJuRz9uXC/4c3fTUYb+zhRv+fqNeJCj JfZEXsk5l8nWVM1M62JGb8g1iPeiEZcYHOKA+3GOY1Plrs+hFWSm4l13sxBFs4q2F/Yz H6AmGehiwWBU8/iPHnJaSy9D/Pfxi1b5wqQpJ9K5bHepxRowleOdmL3N2UPzEDPX2xKc KIvQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l186si11515750pgd.455.2019.08.20.02.48.35; Tue, 20 Aug 2019 02:48:50 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729497AbfHTJra (ORCPT + 99 others); Tue, 20 Aug 2019 05:47:30 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:47179 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728771AbfHTJra (ORCPT ); Tue, 20 Aug 2019 05:47:30 -0400 X-UUID: 35c9006ec5fb4bbe89972341c253ab9b-20190820 X-UUID: 35c9006ec5fb4bbe89972341c253ab9b-20190820 Received: from mtkcas35.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 556568846; Tue, 20 Aug 2019 17:47:18 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 20 Aug 2019 17:47:12 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 20 Aug 2019 17:47:11 +0800 Message-ID: <1566294433.24117.19.camel@mhfsdcap03> Subject: Re: [RESEND, PATCH v13 11/12] soc: mediatek: cmdq: add cmdq_dev_get_client_reg function From: houlong wei To: Bibby Hsieh CC: Jassi Brar , Matthias Brugger , Rob Herring , CK Hu =?UTF-8?Q?=28=E8=83=A1=E4=BF=8A=E5=85=89=29?= , "Daniel Kurtz" , Sascha Hauer , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mediatek@lists.infradead.org" , srv_heupstream , Sascha Hauer , Philipp Zabel , "Nicolas Boichat" , YT Shen =?UTF-8?Q?=28=E6=B2=88=E5=B2=B3=E9=9C=86=29?= , Daoyuan Huang =?UTF-8?Q?=28=E9=BB=83=E9=81=93=E5=8E=9F=29?= , Jiaguang Zhang =?UTF-8?Q?=28=E5=BC=A0=E5=8A=A0=E5=B9=BF=29?= , Dennis-YC Hsieh =?UTF-8?Q?=28=E8=AC=9D=E5=AE=87=E5=93=B2=29?= , Ginny Chen =?UTF-8?Q?=28=E9=99=B3=E6=B2=BB=E5=82=91=29?= , Date: Tue, 20 Aug 2019 17:47:13 +0800 In-Reply-To: <20190820084932.22282-12-bibby.hsieh@mediatek.com> References: <20190820084932.22282-1-bibby.hsieh@mediatek.com> <20190820084932.22282-12-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-TM-SNTS-SMTP: 19F0B51F11D00E4BF64D21CFC255C9982F54076338FC708A02C7A792C47C71E82000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-08-20 at 16:49 +0800, Bibby Hsieh wrote: > GCE cannot know the register base address, this function > can help cmdq client to get the cmdq_client_reg structure. > > Signed-off-by: Bibby Hsieh > Reviewed-by: CK Hu > --- > drivers/soc/mediatek/mtk-cmdq-helper.c | 29 ++++++++++++++++++++++++++ > include/linux/soc/mediatek/mtk-cmdq.h | 21 +++++++++++++++++++ > 2 files changed, 50 insertions(+) > > diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c > index c53f8476c68d..80f75a1075b4 100644 > --- a/drivers/soc/mediatek/mtk-cmdq-helper.c > +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c > @@ -27,6 +27,35 @@ struct cmdq_instruction { > u8 op; > }; > > +int cmdq_dev_get_client_reg(struct device *dev, > + struct cmdq_client_reg *client_reg, int idx) > +{ > + struct of_phandle_args spec; > + int err; > + > + if (!client_reg) > + return -ENOENT; > + > + err = of_parse_phandle_with_fixed_args(dev->of_node, > + "mediatek,gce-client-reg", > + 3, idx, &spec); > + if (err < 0) { > + dev_err(dev, > + "error %d can't parse gce-client-reg property (%d)", > + err, idx); > + > + return err; > + } > + > + client_reg->subsys = (u8)spec.args[0]; > + client_reg->offset = (u16)spec.args[1]; > + client_reg->size = (u16)spec.args[2]; > + of_node_put(spec.np); > + > + return 0; > +} > +EXPORT_SYMBOL(cmdq_dev_get_client_reg); > + > static void cmdq_client_timeout(struct timer_list *t) > { > struct cmdq_client *client = from_timer(client, t, timer); > diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h > index a345870a6d10..02ddd60b212f 100644 > --- a/include/linux/soc/mediatek/mtk-cmdq.h > +++ b/include/linux/soc/mediatek/mtk-cmdq.h > @@ -15,6 +15,12 @@ > > struct cmdq_pkt; > > +struct cmdq_client_reg { > + u8 subsys; > + u16 offset; > + u16 size; > +}; > + > struct cmdq_client { > spinlock_t lock; > u32 pkt_cnt; > @@ -24,6 +30,21 @@ struct cmdq_client { > u32 timeout_ms; /* in unit of microsecond */ > }; > > +/** > + * cmdq_dev_get_client_reg() - parse cmdq client reg from the device > + * node of CMDQ client > + * @dev: device of CMDQ mailbox client > + * @client_reg: CMDQ client reg pointer > + * @idx: the index of desired reg > + * > + * Return: 0 for success; else the error code is returned > + * > + * Help CMDQ client parsing the cmdq client reg > + * from the device node of CMDQ client. > + */ > +int cmdq_dev_get_client_reg(struct device *dev, > + struct cmdq_client_reg *client_reg, int idx); > + > /** > * cmdq_mbox_create() - create CMDQ mailbox client and channel > * @dev: device of CMDQ mailbox client Reviewed-by: Houlong Wei