Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1964642ybi; Sun, 16 Jun 2019 18:16:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqybif4hvrPyr3I5BP492PMyctCORtY3OFNSXvl6F7g/aeUmwKhArp7x/j1bVTRgHJL3UNJ1 X-Received: by 2002:a17:902:e582:: with SMTP id cl2mr90485372plb.60.1560734181772; Sun, 16 Jun 2019 18:16:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560734181; cv=none; d=google.com; s=arc-20160816; b=n6ZIGxwX3RDuisK+CxEnnkNLVI5Q5TzoExEEDiMOz+AsSPi9uPdhq0Zzet9G6WUZPE 91Jb+7ZgKTRX96yvCCkuYXfRpGbZLFR5pbdP2d1fChPTSImyxtL4QWAeer06Sx3aRiCX s6v+4baluBjR2DZ5F3ow4ro5u7GkWYzg43NDE2Egr5GUtG9rldIQpMcaYAjxEsUN0CQf a4jcNddSa9wN4rQt4uhTLx4HuJVIdqrEhKr8AyQTL84ExnGxmErX2tCmE/2r/27lqNhX 8Hwnq4opJBG12yuPUvFbIr+m7bWaw4J1knlltsplO82KiQPVPJxMfKlcAEJpQyqATjhP SEoQ== 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=gsmC5Hdx+iGx3W4Ijb/SdA/0eG26RqQRljNuZ1oCqmA=; b=nSNiNT39hSbPgA2mlYx7oQmaE3h5JuBip/LXmKnoIGeiIoVRS+rvIF4RPyB7if5HUd 8Qw/pNIdXsKOcGfe4bB7f/p/jVnhbtf6SkBNzal+87pbUWraFXo9Pp0Qs55dK0P90VmA KaNzPiMQWLVaA0x/L0Lj9w2jr6IOkgBYafz1p7IVevVNsFDq/6Dlc7r8/+5EJpoz6mUU armkL5Kw6p+IDHkQqo+Todi5u0jq8bJhtZsGH0HbIrub57yPhAeAY8WyUK8Rcupu+Zwj Wpdvq4jqYeFuaTOFn6NVPk2OOeSDgqJataqE22NZaQT3VAIj8U2Hao4D5iWjvt5t14cO W7Xg== 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 y19si9072907pgi.587.2019.06.16.18.15.30; Sun, 16 Jun 2019 18:16:21 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727482AbfFQBOx (ORCPT + 99 others); Sun, 16 Jun 2019 21:14:53 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:27718 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727235AbfFQBOx (ORCPT ); Sun, 16 Jun 2019 21:14:53 -0400 X-UUID: 7dc4172e2c0b4428b3c477938d2bad8d-20190617 X-UUID: 7dc4172e2c0b4428b3c477938d2bad8d-20190617 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 461576476; Mon, 17 Jun 2019 09:14:44 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 17 Jun 2019 09:14:44 +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, 17 Jun 2019 09:14:43 +0800 Message-ID: <1560734084.11128.2.camel@mtksdaap41> Subject: Re: [PATCH v8 11/12] soc: mediatek: cmdq: add cmdq_dev_get_client_reg function 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 , Date: Mon, 17 Jun 2019 09:14:44 +0800 In-Reply-To: <20190612085349.21243-12-bibby.hsieh@mediatek.com> References: <20190612085349.21243-1-bibby.hsieh@mediatek.com> <20190612085349.21243-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-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Bibby: On Wed, 2019-06-12 at 16:53 +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 | 24 ++++++++++++++++++++++++ > include/linux/soc/mediatek/mtk-cmdq.h | 20 ++++++++++++++++++++ > 2 files changed, 44 insertions(+) > > diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c > index 70ad4d806fac..fac4d33fd520 100644 > --- a/drivers/soc/mediatek/mtk-cmdq-helper.c > +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c > @@ -27,6 +27,30 @@ 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; > + > + if (!client_reg) > + return -EINVAL; > + > + if (of_parse_phandle_with_args(dev->of_node, "mediatek,gce-client-reg", > + "#subsys-cells", idx, &spec)) { > + dev_err(dev, "can't parse gce-client-reg property (%d)", idx); > + > + return -EINVAL; of_parse_phandle_with_args() may return -ENOENT, why do you change it to -EINVAL? Regards, CK > + } > + > + client_reg->subsys = spec.args[0]; > + client_reg->offset = spec.args[1]; > + client_reg->size = 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..2e2a2274c231 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,18 @@ 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); > + > #endif /* __MTK_CMDQ_H__ */