Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1760089ybl; Sat, 10 Aug 2019 09:19:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqxEUeNLSBnMRh1eAkOjMHdn7KtP4J5udBbn5Evne8PJvFfAm7oyzVBbqtXzpZz/F+Uqhj X-Received: by 2002:a17:90a:37a7:: with SMTP id v36mr9669439pjb.3.1565453996875; Sat, 10 Aug 2019 09:19:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565453996; cv=none; d=google.com; s=arc-20160816; b=U5oe9w2+gLa6HKPQ9d3+UYqaE/22NMZxBSodewraJyvWGEWGkUiQ3M4tNTewc0zB9B fU366JM5Um5go0HYlQ1czeh3hMRpuLCBkAcboqdWBlxv/KezreqdJberApibk5cUkgUX d3tXTaSs0zf1bd9T5bgpGynMx4uRnweENufFn2XNzW7cpmcYM2iChNy/SJ3wmHVuS8J3 RO/MHHfapAgA51WzNPwSOrmmzMGnnCKM1YR/s/sancgFlF2YgkT63+C6SxE7pc8KDaaf GCDyInGPPpRhCYifQMKOcOHmsZaw8NAz48ZBwKfo+SAGXCIWt+Geu5HO8c444Nc5StcS 6sSg== 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=MZzBgHy15DnW/u45yj4b3GCMoVGYjEnndK9v08CRtmg=; b=BUZ5Xitm9GIYAvoydZh8X9eYcFn2lZ+XTll6DZgCo0REwWKQYTlFuqCw2xxA9wtsx/ O5830Q22vDpoLnifOF0Cmw6GhhH4K5P9GkAIUlntaZ6GUudS4zId7gi7WHFhZlAYHwNl tYPGn/oYWUHps/tcDZH6AP3Bd/erzFB/U5K1M/00YhsUJTPQheCKLVAJgAf1by2TU8X+ rnh9Gv/p5W6BJ4//FiFpU/z3QbGUF/ycQn1x4/4xTseN2uuCslAekiqtsn5KY371Op3V Q6kqj6jK8MWAekQxYrJHZlqk+ovcLGkoOKcJWLoX5yttlLGydm/bGZ+0Hymx+GaDaNpW GJbA== 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 cl14si27679188plb.341.2019.08.10.09.19.39; Sat, 10 Aug 2019 09:19:56 -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 S1726210AbfHJQTD (ORCPT + 99 others); Sat, 10 Aug 2019 12:19:03 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:34010 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726145AbfHJQTD (ORCPT ); Sat, 10 Aug 2019 12:19:03 -0400 X-UUID: 28109f23a6cf4bdca3640e9cdf0141d1-20190811 X-UUID: 28109f23a6cf4bdca3640e9cdf0141d1-20190811 Received: from mtkcas36.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 409275998; Sun, 11 Aug 2019 00:18:50 +0800 Received: from MTKCAS32.mediatek.inc (172.27.4.184) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sun, 11 Aug 2019 00:18:48 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS32.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sun, 11 Aug 2019 00:18:47 +0800 Message-ID: <1565453927.19079.23.camel@mhfsdcap03> Subject: Re: [PATCH v11 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: Sun, 11 Aug 2019 00:18:47 +0800 In-Reply-To: <20190729070106.9332-12-bibby.hsieh@mediatek.com> References: <20190729070106.9332-1-bibby.hsieh@mediatek.com> <20190729070106.9332-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: C3705F6F8AF89EBF99549C59C9D18348FEAB5FDC70176A53E720F21CC93205CA2000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-07-29 at 15:01 +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 > --- > 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 70ad4d806fac..9695b75cfc89 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 = spec.args[0]; > + client_reg->offset = spec.args[1]; > + client_reg->size = spec.args[2]; Maybe we need add type conversion to avoid compiling warnings. 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..be402c4c740e 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; > @@ -142,4 +148,19 @@ int cmdq_pkt_flush_async(struct cmdq_pkt *pkt, cmdq_async_flush_cb cb, > */ > int cmdq_pkt_flush(struct cmdq_pkt *pkt); > > +/** > + * cmdq_dev_get_client_reg() - parse cmdq client reg from the device > + * node of CMDQ client > + * @dev: device of CMDQ mailbox clienti > + * @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 pasing 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); > + Could we keep the same order of function declaration and implementation? > #endif /* __MTK_CMDQ_H__ */