Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2171869ybl; Sun, 18 Aug 2019 20:14:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNyz7zHUCaaLwQnud1Df6rTI1SScJR2xfoCaP84rhtUtzPYYXlvVBZ7PbLjuHx5jTyDah0 X-Received: by 2002:a63:c64b:: with SMTP id x11mr17864912pgg.319.1566184469107; Sun, 18 Aug 2019 20:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566184469; cv=none; d=google.com; s=arc-20160816; b=B6Syv56I1QeZ9SkwIUF/lwg/W92Suk0k4TNbmMvFCigiLmE7DU11cD8dUK+5UExyKj 5dTNA2dD6ibX5XTxG5kPflYlCvLEsc8/SQS/PmDrvLeZ5ocspI0v0ip5Y4fr88/2VqmY l+RYKyofLs1ffEaP6RmLJddHUI8QfVVuzdYUXKm8DtNMUMVMyOOKVZEevglv2NVBSXdH 0EJziJ+IEv36QTT2zTXiBZx/+wotiMoNZL4CKrDCOrc9LFfXdhq/VFo4POcBsoy2GkWZ PQmpfp+uU5ITG1R9Iocfqo7e94AeWtJxPlQoHbIo/hEDyy8S7N3P+EtlxD5tpLLwEOAa JZNA== 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=tcRRsaPyn0yeCVE6U5KDQS+YLuWp/FlkeuTKkDjhwug=; b=oaGF/ZxWCeyRPR+0KQhdBy58TbMUbS0D6s2iZIPJe72HpxiP69/KD+2jw3TDHI7IkU EKJOP7PaG2GfspbR+ryOz72abJwc4lPXERKmlu+Ly2V+ewSyGT1rqTfc0DScUy2SvV39 quAkVVOqE8BSQwgEwdw/FN5m+CeV3VmvKnImUj4IDWGR43GugDdqwuA552o+zu4ODZgu bnPjKu2gSUT5uFD4dhZVFqSoVxxu7PBd818LvdfbYvnp5bSDYBzuVZVvgVk8chpoOmsp Xrd7nGVc1SHx0QJjM/8Hi7xS5QJJ3a+X1MOg9D8zNHkeZK1NEhr/aVgKn2VFGfbNnLLi E3uA== 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 f25si9541496pfd.157.2019.08.18.20.14.14; Sun, 18 Aug 2019 20:14:29 -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 S1726427AbfHSDN1 (ORCPT + 99 others); Sun, 18 Aug 2019 23:13:27 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:31290 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726261AbfHSDN0 (ORCPT ); Sun, 18 Aug 2019 23:13:26 -0400 X-UUID: ee80ecc5facb4d3ba5cfca1ea8ca1f48-20190819 X-UUID: ee80ecc5facb4d3ba5cfca1ea8ca1f48-20190819 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0707 with TLS) with ESMTP id 1125332097; Mon, 19 Aug 2019 11:13:19 +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, 19 Aug 2019 11:13:20 +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, 19 Aug 2019 11:13:20 +0800 Message-ID: <1566184400.6182.0.camel@mtksdaap41> Subject: Re: [PATCH v12 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, 19 Aug 2019 11:13:20 +0800 In-Reply-To: <20190819025359.11381-12-bibby.hsieh@mediatek.com> References: <20190819025359.11381-1-bibby.hsieh@mediatek.com> <20190819025359.11381-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 Mon, 2019-08-19 at 10: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. Reviewed-by: CK Hu > > 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 340a92a254e5..1bed07362b7a 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..6215d4fc4ba3 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 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); > + > /** > * cmdq_mbox_create() - create CMDQ mailbox client and channel > * @dev: device of CMDQ mailbox client