Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp687230ybi; Fri, 14 Jun 2019 01:32:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNVDbCfkJKxudPBju+4KVcIdfEuIxFmU8a62lykFjoBLxPu5TRF8AwiuiPBe7EXlimmKx8 X-Received: by 2002:a63:6c87:: with SMTP id h129mr35478261pgc.427.1560501127763; Fri, 14 Jun 2019 01:32:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560501127; cv=none; d=google.com; s=arc-20160816; b=XMFGGHCRHvpMe2sls6MiqFaFqSWtLqe5OvC5MYvGnD7iI4RNWkXxAYdpLP+8p92Tff js30e+7p9wxT1f61KzXr3F4mm74L5lAkZAoMh/zkjvQltLucHC8JWK6VAup3BkR9jpSK guv54KPayZi5dNLWrfPaYHLmglq+3oQOYSLtgEBh+VIPiakR8D1baO5BGQ1B4I1yKqmX 28KUW6nxp1yjUaZXe2dznxIQjJyJyUKpkk94wUAVfJMN3aKPa/3vCfC1eibn4UNEeVpj G67hYnd1ue2oiYf2htzblq/+kMQoECoURt+EFyoVfT9O4LvYTIXwRgsT9DlKGrYVmX7O c3Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=WFDrQf4njTwrCLjFsRfgBfcro7/dqMXuf3KcCnlG7eU=; b=cPn38Ta2JqLwipQrGNhL+bdCdLLkir+bt1iT5v2e26bFKdI9gxwcUkXCzqzYXqh6cX wZHSgulPi6CSk2pORXrH6lyEPiLcXi/qzTipmMtY8mC7et8qPYsSR+KKOX7/Y1PkZdFr 2J9R+ks+FSOrd+daSlIZVxFPy1lA576kx4PzGlSm2jV4XXaHeoXE847/FofVpoHzN57c lXSCYr3K2tvyJU4Q813aa91L3Gq1kjWl2FtY2e/RnagPWV74OUX/GUjwuhvKoxl6Ob7n xoDKeMkHMbabRvCAKA9YPb2zqWNDa8U+uOWSkhCVzwqGwX7SQYAkHB/P2S2S5DqZhZAk oHow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=i23VuOuZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j88si1655885pje.35.2019.06.14.01.31.49; Fri, 14 Jun 2019 01:32:07 -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; dkim=pass header.i=@chromium.org header.s=google header.b=i23VuOuZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726551AbfFNIbi (ORCPT + 99 others); Fri, 14 Jun 2019 04:31:38 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:34639 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726259AbfFNIbi (ORCPT ); Fri, 14 Jun 2019 04:31:38 -0400 Received: by mail-qt1-f195.google.com with SMTP id m29so1570480qtu.1 for ; Fri, 14 Jun 2019 01:31:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WFDrQf4njTwrCLjFsRfgBfcro7/dqMXuf3KcCnlG7eU=; b=i23VuOuZ0hfuRp/LswwKqj7gDp6Tlmafsj4Mm0OMRl4Vx/LbKVjew4IdJyh3RXRsBS oJ/pXT42q4cyS1GSeDiksQD1bOpT84+3YUseJco/7CZjfBO5lFktZvECavHicuyZdmvD u7U+7MQWSzNnpAJaO1w7qNqlIB/B345yxOQ8k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WFDrQf4njTwrCLjFsRfgBfcro7/dqMXuf3KcCnlG7eU=; b=AkisPhYsJ8uTwuRzYFtmPTQwG8+vgZXLV6PQeoqHpQ+mWaZcUO0lJImFpp0911dp+h KKgf5tUyfoFZW4p9bpS2cM1dBJFcdABGv7nkAnhbdHXgIXJAH9cqF+FI5ilbN0So5O81 TQItPyf06eDvh+2Xf/E48n/GIZz4FeB2GB/U5H8kZOgwR0qtUMjrKXZiT+VZ1Z0CgSj+ uUkkQumLkxNzpSx77dTKt/Vyls0GZFfrAdEulepP6h9J3KDCSDW1ujZKFn9BaGVFefMS JSHrzdS1cicA40IZl6U0IlxWYXX8U8J7PpKuSokmHrgpOd/GlrXLA1tR+YZv3ysC8IYU I2EQ== X-Gm-Message-State: APjAAAWstT3D9fUNcG2/E7GGtHO1RD6z14MjQie7oOGPIRzYkqAuRDGp K94OOwkerQB9UhKAIX44YCJSOPxJqw+Ve3ch4jUOLw== X-Received: by 2002:ac8:279b:: with SMTP id w27mr7486636qtw.159.1560501096909; Fri, 14 Jun 2019 01:31:36 -0700 (PDT) MIME-Version: 1.0 References: <20190612085349.21243-1-bibby.hsieh@mediatek.com> <20190612085349.21243-12-bibby.hsieh@mediatek.com> In-Reply-To: <20190612085349.21243-12-bibby.hsieh@mediatek.com> From: Nicolas Boichat Date: Fri, 14 Jun 2019 16:31:26 +0800 Message-ID: Subject: Re: [PATCH v8 11/12] soc: mediatek: cmdq: add cmdq_dev_get_client_reg function To: Bibby Hsieh Cc: Jassi Brar , Matthias Brugger , Rob Herring , CK HU , Daniel Kurtz , Sascha Hauer , devicetree@vger.kernel.org, lkml , linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , srv_heupstream , Sascha Hauer , Philipp Zabel , YT Shen , Daoyuan Huang , Jiaguang Zhang , Dennis-YC Hsieh , Houlong Wei , ginny.chen@mediatek.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 12, 2019 at 4:53 PM 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; > + } > + > + 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 Minor nit: this line is over 80 chars. > + * @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__ */ > -- > 2.18.0 >