From patchwork Fri Aug 23 14:36:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 11111855 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD31313A4 for ; Fri, 23 Aug 2019 14:37:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BB8912054F for ; Fri, 23 Aug 2019 14:37:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sBJ7OfrO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB8912054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=RaxeliEWskiaQON+3bEegNqyOiP4CHFaKJwClTzGqYE=; b=sBJ7OfrOwIBHkqwdvJ3Ub5Sfue rvzftAf0C4S7E9vqRNCsaP8J2iRRGVmUa7eqmfsUIeA9tMi3j9P1RVwylCXnZsOzlOZz5P7c4NLyD TR0ONJvSNCYOGYUX0cLcjK1SHH9Xlnhjy43v+WrqRuXNEcwAM+SM8fxtmRfnhOgWiBk+2IpsHnVkl Su9cyby4YLjDc02R2OZARgeRCzKJYiINE5+F81JIGnGkMEtJyWyQxeHgRtbDzOgLKR0YZXVCo2D7A BZxML2bvpYlHLQa82WCyvDgx/RxhSJU2KCLehnOoDNeLlJnk+bdl0wQVugi9BQCnCd2+CP+dBXYkA ZgVg9Jyw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1Agf-0001sm-F1; Fri, 23 Aug 2019 14:37:09 +0000 Received: from inva020.nxp.com ([92.121.34.13]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1Agb-0001qt-NU for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2019 14:37:07 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 0CD751A06D9; Fri, 23 Aug 2019 16:37:04 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E986B1A06D1; Fri, 23 Aug 2019 16:37:03 +0200 (CEST) Received: from fsr-ub1864-112.ea.freescale.net (fsr-ub1864-112.ea.freescale.net [10.171.82.98]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id D8C45205D9; Fri, 23 Aug 2019 16:37:02 +0200 (CEST) From: Leonard Crestez To: Georgi Djakov , Rob Herring , =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , Chanwoo Choi Subject: [RFCv4 1/7] PM / devfreq: Add devfreq_get_devfreq_by_node Date: Fri, 23 Aug 2019 17:36:54 +0300 Message-Id: <71a13730eee8744d8468aee8fa355958706035dd.1566570260.git.leonard.crestez@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190823_073706_040999_41B25C63 X-CRM114-Status: GOOD ( 11.83 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [92.121.34.13 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Dong Aisheng , linux-arm-kernel@lists.infradead.org, Saravana Kannan , linux-pm@vger.kernel.org, Stephen Boyd , Viresh Kumar , Michael Turquette , Krzysztof Kozlowski , Kyungmin Park , MyungJoo Ham , Alexandre Bailon , kernel@pengutronix.de, Fabio Estevam , Shawn Guo , devicetree@vger.kernel.org, linux-imx@nxp.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Split off part of devfreq_get_devfreq_by_phandle into a separate function. This allows callers to fetch devfreq instances by enumerating devicetree instead of explicit phandles. Signed-off-by: Leonard Crestez --- drivers/devfreq/devfreq.c | 42 +++++++++++++++++++++++++++++---------- include/linux/devfreq.h | 1 + 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 687deadd08ed..57352a757d79 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -907,10 +907,33 @@ struct devfreq *devm_devfreq_add_device(struct device *dev, return devfreq; } EXPORT_SYMBOL(devm_devfreq_add_device); #ifdef CONFIG_OF +/* + * devfreq_get_devfreq_by_node - Get the devfreq device from devicetree + * @np - pointer to device_node + * + * return the instance of devfreq device + */ +struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node) +{ + struct devfreq *devfreq; + + mutex_lock(&devfreq_list_lock); + list_for_each_entry(devfreq, &devfreq_list, node) { + if (devfreq->dev.parent + && devfreq->dev.parent->of_node == node) { + mutex_unlock(&devfreq_list_lock); + return devfreq; + } + } + mutex_unlock(&devfreq_list_lock); + + return ERR_PTR(-EPROBE_DEFER); +} + /* * devfreq_get_devfreq_by_phandle - Get the devfreq device from devicetree * @dev - instance to the given device * @index - index into list of devfreq * @@ -929,25 +952,22 @@ struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index) node = of_parse_phandle(dev->of_node, "devfreq", index); if (!node) return ERR_PTR(-ENODEV); - mutex_lock(&devfreq_list_lock); - list_for_each_entry(devfreq, &devfreq_list, node) { - if (devfreq->dev.parent - && devfreq->dev.parent->of_node == node) { - mutex_unlock(&devfreq_list_lock); - of_node_put(node); - return devfreq; - } - } - mutex_unlock(&devfreq_list_lock); + devfreq = devfreq_get_devfreq_by_node(node); of_node_put(node); - return ERR_PTR(-EPROBE_DEFER); + return devfreq; } + #else +struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node) +{ + return ERR_PTR(-ENODEV); +} + struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index) { return ERR_PTR(-ENODEV); } #endif /* CONFIG_OF */ diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index d2c5bb7add0a..4b5cc80abbe3 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -242,10 +242,11 @@ extern int devm_devfreq_register_notifier(struct device *dev, unsigned int list); extern void devm_devfreq_unregister_notifier(struct device *dev, struct devfreq *devfreq, struct notifier_block *nb, unsigned int list); +extern struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node); extern struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index); #if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND) /** From patchwork Fri Aug 23 14:36:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 11111867 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7DB5F112C for ; Fri, 23 Aug 2019 14:37:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D5742054F for ; Fri, 23 Aug 2019 14:37:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YaqmyyWm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D5742054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=VIw777DsqiGW2u3bAyxAiXNojCT915FlKz21Sjmr/sQ=; b=YaqmyyWmmVfcYwV/At89qYoP+L NuPnHKWuD+N1vdLjxYbqisaADy5UDExfwOc4lk7gm/7FswgFsRtZVDEP5kvbt8TNjXN78OKM5PWQx n2cpNLP63760LL33OAHyK9wQ8lEf6HqItLrlVUsgTloLVLMPjBotfmJJhBsQM944iJT2a5RBOOPW4 MZVD8u/SsazI/Cb23GBzahqQEKwBRXOXMvw1685W6cJ2fURjE3ruQIHfOEBdNeLoqdKbQqf4IHFHM o+Ixm6Ux5mVGMJpzMTl9F0sGDCEVwpA+u0ieghqUAXYogUCkDDyJF8/c6GT8S+XnYfWVJ5wfS6b4q HhnTyFzA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1Agz-0002IT-2p; Fri, 23 Aug 2019 14:37:29 +0000 Received: from inva021.nxp.com ([92.121.34.21]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1Agc-0001qw-EW for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2019 14:37:08 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 3EAE4200749; Fri, 23 Aug 2019 16:37:05 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 2FE3120073F; Fri, 23 Aug 2019 16:37:05 +0200 (CEST) Received: from fsr-ub1864-112.ea.freescale.net (fsr-ub1864-112.ea.freescale.net [10.171.82.98]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 0BA86205D9; Fri, 23 Aug 2019 16:37:04 +0200 (CEST) From: Leonard Crestez To: Georgi Djakov , Rob Herring , =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , Chanwoo Choi Subject: [RFCv4 2/7] interconnect: Add of_icc_add_proxy Date: Fri, 23 Aug 2019 17:36:55 +0300 Message-Id: <022a38c6c1d461b6e0b0337a1364888cfa7aa8cc.1566570260.git.leonard.crestez@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190823_073706_764519_F543BF6D X-CRM114-Status: GOOD ( 15.39 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [92.121.34.21 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Dong Aisheng , linux-arm-kernel@lists.infradead.org, Saravana Kannan , linux-pm@vger.kernel.org, Stephen Boyd , Viresh Kumar , Michael Turquette , Krzysztof Kozlowski , Kyungmin Park , MyungJoo Ham , Alexandre Bailon , kernel@pengutronix.de, Fabio Estevam , Shawn Guo , devicetree@vger.kernel.org, linux-imx@nxp.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On many SOCs there is no single node that describes the "interconnect", instead are multiple pieces of bus fabric which already support scaling. Add support for mapping multiple device nodes to the same icc_provider (likely a platform-level singleton). This is implemented at the devicetree parsing level: just add more device nodes which map to the same icc_provider instead. Signed-off-by: Leonard Crestez --- drivers/interconnect/core.c | 88 ++++++++++++++++++++++++--- include/linux/interconnect-provider.h | 7 +++ 2 files changed, 88 insertions(+), 7 deletions(-) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 7b971228df38..01109e335baf 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -17,12 +17,19 @@ #include #include #include #include +struct of_icc_proxy { + struct device_node *of_node; + struct icc_provider *provider; + struct list_head list_node; +}; + static DEFINE_IDR(icc_idr); static LIST_HEAD(icc_providers); +static LIST_HEAD(icc_proxy_list); static DEFINE_MUTEX(icc_lock); static struct dentry *icc_debugfs_dir; /** * struct icc_req - constraints that are attached to each node @@ -267,10 +274,61 @@ struct icc_node *of_icc_xlate_onecell(struct of_phandle_args *spec, return icc_data->nodes[idx]; } EXPORT_SYMBOL_GPL(of_icc_xlate_onecell); +struct icc_provider *__of_icc_get_provider(struct device_node *np) +{ + struct of_icc_proxy *proxy; + + lockdep_assert_held(&icc_lock); + list_for_each_entry(proxy, &icc_proxy_list, list_node) + if (proxy->of_node == np) + return proxy->provider; + + return NULL; +} + +static int __of_icc_add_proxy(struct device_node *np, + struct icc_provider *provider) +{ + struct of_icc_proxy *proxy; + + lockdep_assert_held(&icc_lock); + proxy = kmalloc(sizeof(*proxy), GFP_KERNEL); + if (!proxy) + return -ENOMEM; + proxy->of_node = np; + proxy->provider = provider; + list_add_tail(&proxy->list_node, &icc_proxy_list); + + return 0; +} + +/** + * of_icc_add_proxy() - Add another device_node for a provider + * @np: OF node to alias from + * @provider: Interconnect provider to map to + * + * Make another device_node map to the same provider. + * + * This lasts until icc_provider_del. + */ +int of_icc_add_proxy(struct device_node *np, struct icc_provider *provider) +{ + int ret; + + mutex_lock(&icc_lock); + + ret = __of_icc_add_proxy(np, provider); + + mutex_unlock(&icc_lock); + + return ret; +} +EXPORT_SYMBOL_GPL(of_icc_add_proxy); + /** * of_icc_get_from_provider() - Look-up interconnect node * @spec: OF phandle args to use for look-up * * Looks for interconnect provider under the node specified by @spec and if @@ -279,23 +337,22 @@ EXPORT_SYMBOL_GPL(of_icc_xlate_onecell); * Returns a valid pointer to struct icc_node on success or ERR_PTR() * on failure. */ static struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec) { - struct icc_node *node = ERR_PTR(-EPROBE_DEFER); struct icc_provider *provider; + struct icc_node *node; if (!spec || spec->args_count != 1) return ERR_PTR(-EINVAL); mutex_lock(&icc_lock); - list_for_each_entry(provider, &icc_providers, provider_list) { - if (provider->dev->of_node == spec->np) - node = provider->xlate(spec, provider->data); - if (!IS_ERR(node)) - break; - } + provider = __of_icc_get_provider(spec->np); + if (provider) + node = provider->xlate(spec, provider->data); + else + node = ERR_PTR(-EPROBE_DEFER); mutex_unlock(&icc_lock); return node; } @@ -744,17 +801,26 @@ EXPORT_SYMBOL_GPL(icc_node_del); * * Return: 0 on success, or an error code otherwise */ int icc_provider_add(struct icc_provider *provider) { + int ret; + if (WARN_ON(!provider->set)) return -EINVAL; if (WARN_ON(!provider->xlate)) return -EINVAL; mutex_lock(&icc_lock); + if (provider->dev) { + ret = __of_icc_add_proxy(provider->dev->of_node, provider); + if (ret) { + mutex_unlock(&icc_lock); + return ret; + } + } INIT_LIST_HEAD(&provider->nodes); list_add_tail(&provider->provider_list, &icc_providers); mutex_unlock(&icc_lock); @@ -770,10 +836,12 @@ EXPORT_SYMBOL_GPL(icc_provider_add); * * Return: 0 on success, or an error code otherwise */ int icc_provider_del(struct icc_provider *provider) { + struct of_icc_proxy *proxy, *tmp; + mutex_lock(&icc_lock); if (provider->users) { pr_warn("interconnect provider still has %d users\n", provider->users); mutex_unlock(&icc_lock); @@ -785,10 +853,16 @@ int icc_provider_del(struct icc_provider *provider) mutex_unlock(&icc_lock); return -EBUSY; } list_del(&provider->provider_list); + list_for_each_entry_safe(proxy, tmp, &icc_proxy_list, list_node) + if (proxy->provider == provider) { + list_del(&proxy->list_node); + of_node_put(proxy->of_node); + kfree(proxy); + } mutex_unlock(&icc_lock); return 0; } EXPORT_SYMBOL_GPL(icc_provider_del); diff --git a/include/linux/interconnect-provider.h b/include/linux/interconnect-provider.h index b16f9effa555..e6773ecac164 100644 --- a/include/linux/interconnect-provider.h +++ b/include/linux/interconnect-provider.h @@ -98,10 +98,11 @@ int icc_link_create(struct icc_node *node, const int dst_id); int icc_link_destroy(struct icc_node *src, struct icc_node *dst); void icc_node_add(struct icc_node *node, struct icc_provider *provider); void icc_node_del(struct icc_node *node); int icc_provider_add(struct icc_provider *provider); int icc_provider_del(struct icc_provider *provider); +int of_icc_add_proxy(struct device_node *np, struct icc_provider *provider); #else static inline struct icc_node *icc_node_create(int id) { @@ -138,8 +139,14 @@ static inline int icc_provider_add(struct icc_provider *provider) static inline int icc_provider_del(struct icc_provider *provider) { return -ENOTSUPP; } +static inline int of_icc_add_proxy(struct device_node *np, + struct icc_provider *provider) +{ + return -ENOTSUPP; +} + #endif /* CONFIG_INTERCONNECT */ #endif /* __LINUX_INTERCONNECT_PROVIDER_H */ From patchwork Fri Aug 23 14:36:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 11111869 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B639513A4 for ; Fri, 23 Aug 2019 14:37:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 90DF421848 for ; Fri, 23 Aug 2019 14:37:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="D2UgW0h0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90DF421848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=0S0PYZFkUef5i08foKjq7ZG3ensFZdZRTVQlJpUcmn0=; b=D2UgW0h0u8+YIAw2jHv54UFP/o poumc1dFZneIrCGumzt8C0hihYVvVXKX8+VzNzPAMlEhO5/rHPKJkXRDFIAIMpcKRTwjr6dqfYRqr r7RjcmdTJHBLhpQSmKL602peGd7E2jVfBgxRIwLUhVWUWs82O8qgJnleUCNSsPTt4JWA+K+puopq7 2WppxRItgmLam3YLimf/UZdkWc5xd6m35M0YuKJFRICkFHv131jk5VL0ALyElzCogpg3Jw6/8TMaG AxSrBLRHCepccy2oSqaEPHdC6xzaZhPsxNPdMjtA+OV+FzgMs+ySoGnFrspS3txcfUk2tflLd7uXS ++GtMkkQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1AhD-0002gn-RK; Fri, 23 Aug 2019 14:37:43 +0000 Received: from inva021.nxp.com ([92.121.34.21]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1Agd-0001s1-Mk for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2019 14:37:09 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 7B5D3200743; Fri, 23 Aug 2019 16:37:06 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 6D20920073F; Fri, 23 Aug 2019 16:37:06 +0200 (CEST) Received: from fsr-ub1864-112.ea.freescale.net (fsr-ub1864-112.ea.freescale.net [10.171.82.98]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 47C3D205D9; Fri, 23 Aug 2019 16:37:05 +0200 (CEST) From: Leonard Crestez To: Georgi Djakov , Rob Herring , =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , Chanwoo Choi Subject: [RFCv4 3/7] dt-bindings: devfreq: imx: Describe interconnect properties Date: Fri, 23 Aug 2019 17:36:56 +0300 Message-Id: <3f27038292c09c8bf07a086eac759132c100aedb.1566570260.git.leonard.crestez@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190823_073707_875951_36CD85EF X-CRM114-Status: UNSURE ( 7.18 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [92.121.34.21 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Dong Aisheng , linux-arm-kernel@lists.infradead.org, Saravana Kannan , linux-pm@vger.kernel.org, Stephen Boyd , Viresh Kumar , Michael Turquette , Krzysztof Kozlowski , Kyungmin Park , MyungJoo Ham , Alexandre Bailon , kernel@pengutronix.de, Fabio Estevam , Shawn Guo , devicetree@vger.kernel.org, linux-imx@nxp.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The interconnect-node-id property is parsed by the imx interconnect driver to find nodes on which frequencies can be adjusted. Add #interconnect-cells so that device drivers can request paths from bus nodes instead of requiring a separate "virtual" node to represent the interconnect itself. Signed-off-by: Leonard Crestez --- Documentation/devicetree/bindings/devfreq/imx-ddrc.yaml | 5 +++++ Documentation/devicetree/bindings/devfreq/imx.yaml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/devfreq/imx-ddrc.yaml b/Documentation/devicetree/bindings/devfreq/imx-ddrc.yaml index 31db204e6845..014449a9dd01 100644 --- a/Documentation/devicetree/bindings/devfreq/imx-ddrc.yaml +++ b/Documentation/devicetree/bindings/devfreq/imx-ddrc.yaml @@ -31,10 +31,15 @@ properties: - const: dram_alt - const: dram_apb operating-points-v2: true + interconnect-node-id: + $ref: /schemas/types.yaml#/definitions/uint32 + '#interconnect-cells': + const: 1 + devfreq-events: description: Phandle of PMU node $ref: "/schemas/types.yaml#/definitions/phandle" required: diff --git a/Documentation/devicetree/bindings/devfreq/imx.yaml b/Documentation/devicetree/bindings/devfreq/imx.yaml index 634870496d5e..f2f9b76c752f 100644 --- a/Documentation/devicetree/bindings/devfreq/imx.yaml +++ b/Documentation/devicetree/bindings/devfreq/imx.yaml @@ -43,10 +43,15 @@ properties: clocks: maxItems: 1 operating-points-v2: true + interconnect-node-id: + $ref: /schemas/types.yaml#/definitions/uint32 + '#interconnect-cells': + const: 1 + devfreq: description: | Phandle to another devfreq device to match OPPs with by using the passive governor. $ref: "/schemas/types.yaml#/definitions/phandle" From patchwork Fri Aug 23 14:36:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 11111871 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB35313A4 for ; Fri, 23 Aug 2019 14:37:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A509D2054F for ; Fri, 23 Aug 2019 14:37:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tvLzBWgd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A509D2054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=O5ppJorvLJgKhZtJA6WFdqMY5Weq3M+Ll9WAfJlGxiA=; b=tvLzBWgdg5ygNEkGrKiOcp04Ix DIDfxYvsynEprAZci2nH2WFjlOey2a5jD5IB7LOl1veLWw/+xBmLWkh4h8x13PqEI1Jj26cWU0v7B bgvjhIFckcp/xVODYeNg8khVYc0x8Z4wXyNZX+Nzy6yIvtN9QSsIqPKdKidaO1FyetKiczX27HZcB JDv24CVskQwtL/CGTbaIDB52BibjsGsODz1f55FH1boJbP4xdm+cRnhtWicjXOGISRzaXxDMieRh/ otg2/HvauM+7qITU9jp1SQ5Pufbvkvq+OnSjYw6YPpcSZ0EfRQVWYT1FfnkUeQ8J+GpTJX6YW2Va1 jCGVAOuA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1AhN-0002uY-8L; Fri, 23 Aug 2019 14:37:53 +0000 Received: from inva021.nxp.com ([92.121.34.21]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1Age-0001sX-St for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2019 14:37:11 +0000 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id AC9D0200757; Fri, 23 Aug 2019 16:37:07 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 92EA520073F; Fri, 23 Aug 2019 16:37:07 +0200 (CEST) Received: from fsr-ub1864-112.ea.freescale.net (fsr-ub1864-112.ea.freescale.net [10.171.82.98]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 80DFC205D9; Fri, 23 Aug 2019 16:37:06 +0200 (CEST) From: Leonard Crestez To: Georgi Djakov , Rob Herring , =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , Chanwoo Choi Subject: [RFCv4 4/7] interconnect: Add imx core driver Date: Fri, 23 Aug 2019 17:36:57 +0300 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190823_073709_208297_0231F015 X-CRM114-Status: GOOD ( 18.87 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [92.121.34.21 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Dong Aisheng , linux-arm-kernel@lists.infradead.org, Saravana Kannan , linux-pm@vger.kernel.org, Stephen Boyd , Viresh Kumar , Michael Turquette , Krzysztof Kozlowski , Kyungmin Park , MyungJoo Ham , Alexandre Bailon , kernel@pengutronix.de, Fabio Estevam , Shawn Guo , devicetree@vger.kernel.org, linux-imx@nxp.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This adds support for i.MX SoC family to interconnect framework. Platform drivers can describe the interconnect graph and several adjustment knobs where icc node bandwidth is converted to a DEV_PM_QOS_MIN_FREQUENCY request. The adjustable nodes are found based on an "interconnect-node-id" property by scanning the entire device tree. The interconnect provider doesn't need an virtual OF node, instead those same adjustable nodes are registered as proxies which xlate to the platform-level provider. The platform device for the interconnect needs to be registered from a SOC driver (similar to cpufreq). Signed-off-by: Alexandre Bailon Signed-off-by: Leonard Crestez --- drivers/interconnect/Kconfig | 1 + drivers/interconnect/Makefile | 1 + drivers/interconnect/imx/Kconfig | 5 + drivers/interconnect/imx/Makefile | 1 + drivers/interconnect/imx/imx.c | 279 ++++++++++++++++++++++++++++++ drivers/interconnect/imx/imx.h | 60 +++++++ 6 files changed, 347 insertions(+) create mode 100644 drivers/interconnect/imx/Kconfig create mode 100644 drivers/interconnect/imx/Makefile create mode 100644 drivers/interconnect/imx/imx.c create mode 100644 drivers/interconnect/imx/imx.h diff --git a/drivers/interconnect/Kconfig b/drivers/interconnect/Kconfig index bfa4ca3ab7a9..e61802230f90 100644 --- a/drivers/interconnect/Kconfig +++ b/drivers/interconnect/Kconfig @@ -10,7 +10,8 @@ menuconfig INTERCONNECT If unsure, say no. if INTERCONNECT source "drivers/interconnect/qcom/Kconfig" +source "drivers/interconnect/imx/Kconfig" endif diff --git a/drivers/interconnect/Makefile b/drivers/interconnect/Makefile index 28f2ab0824d5..20a13b7eb37f 100644 --- a/drivers/interconnect/Makefile +++ b/drivers/interconnect/Makefile @@ -2,5 +2,6 @@ icc-core-objs := core.o obj-$(CONFIG_INTERCONNECT) += icc-core.o obj-$(CONFIG_INTERCONNECT_QCOM) += qcom/ +obj-$(CONFIG_INTERCONNECT_IMX) += imx/ diff --git a/drivers/interconnect/imx/Kconfig b/drivers/interconnect/imx/Kconfig new file mode 100644 index 000000000000..7d81d3c83a61 --- /dev/null +++ b/drivers/interconnect/imx/Kconfig @@ -0,0 +1,5 @@ +config INTERCONNECT_IMX + bool "i.MX interconnect drivers" + depends on ARCH_MXC || COMPILE_TEST + help + Generic interconnect driver for i.MX SOCs diff --git a/drivers/interconnect/imx/Makefile b/drivers/interconnect/imx/Makefile new file mode 100644 index 000000000000..bb92fd9fe4a5 --- /dev/null +++ b/drivers/interconnect/imx/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_INTERCONNECT_IMX) += imx.o diff --git a/drivers/interconnect/imx/imx.c b/drivers/interconnect/imx/imx.c new file mode 100644 index 000000000000..0a04ac723c15 --- /dev/null +++ b/drivers/interconnect/imx/imx.c @@ -0,0 +1,279 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Interconnect framework driver for i.MX SoC + * + * Copyright (c) 2019, BayLibre + * Copyright (c) 2019, NXP + * Author: Alexandre Bailon + * Author: Leonard Crestez + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "imx.h" + +/* private icc_provider data */ +struct imx_icc_provider { + struct device *dev; +}; + +/* private icc_node data */ +struct imx_icc_node { + const struct imx_icc_node_desc *desc; + struct devfreq *devfreq; + struct dev_pm_qos_request qos_req; +}; + +static int imx_icc_aggregate(struct icc_node *node, u32 tag, + u32 avg_bw, u32 peak_bw, + u32 *agg_avg, u32 *agg_peak) +{ + *agg_avg += avg_bw; + *agg_peak = max(*agg_peak, peak_bw); + + return 0; +} + +static struct icc_node *imx_icc_xlate(struct of_phandle_args *spec, void *data) +{ + struct imx_icc_provider *desc = data; + struct icc_provider *provider = dev_get_drvdata(desc->dev); + unsigned int id = spec->args[0]; + struct icc_node *node; + + list_for_each_entry(node, &provider->nodes, node_list) + if (node->id == id) + return node; + + return ERR_PTR(-EINVAL); +} + +static int imx_icc_node_set(struct icc_node *node) +{ + struct device *dev = node->provider->dev; + struct imx_icc_node *node_data = node->data; + u64 freq; + + if (!node_data->devfreq) + return 0; + + freq = (node->avg_bw + node->peak_bw) * node_data->desc->adj->bw_mul; + do_div(freq, node_data->desc->adj->bw_div); + dev_dbg(dev, "%s avg_bw %ukBps peak_bw %ukBps min_freq %llukHz\n", + node->name, node->avg_bw, node->peak_bw, freq); + + if (freq > S32_MAX) { + dev_err(dev, "%s can't request more S32_MAX freq\n", + node->name); + return -ERANGE; + } + + dev_pm_qos_update_request(&node_data->qos_req, freq); + + return 0; +} + +static int imx_icc_set(struct icc_node *src, struct icc_node *dst) +{ + return imx_icc_node_set(dst); +} + +static const struct of_device_id imx_icc_node_of_match[] = { + { .compatible = "fsl,imx8m-nic" }, + { .compatible = "fsl,imx8m-noc" }, + { .compatible = "fsl,imx8m-ddrc" }, + {}, +}; + +static int imx_icc_node_init_devfreq(struct device *dev, + struct icc_node *node) +{ + struct imx_icc_node *node_data = node->data; + struct device_node *dn; + u32 node_id; + int ret; + + for_each_matching_node(dn, imx_icc_node_of_match) { + ret = of_property_read_u32(dn, "interconnect-node-id", + &node_id); + if (ret != 0) + continue; + + if (node_id == node->id) { + of_node_get(dn); + break; + } + } + + if (!dn) + return 0; + + dev_info(dev, "node %s[%d] has device node %pOF\n", + node->name, node->id, dn); + node_data->devfreq = devfreq_get_devfreq_by_node(dn); + if (IS_ERR(node_data->devfreq)) { + of_node_put(dn); + ret = PTR_ERR(node_data->devfreq); + dev_err(dev, "failed to fetch devfreq for %s: %d\n", + node->name, ret); + return ret; + } + + of_icc_add_proxy(dn, node->provider); + of_node_put(dn); + + return dev_pm_qos_add_request(node_data->devfreq->dev.parent, + &node_data->qos_req, + DEV_PM_QOS_MIN_FREQUENCY, 0); +} + +static struct icc_node *imx_icc_node_add(struct icc_provider *provider, + const struct imx_icc_node_desc *node_desc) +{ + struct imx_icc_provider *provider_data = provider->data; + struct device *dev = provider_data->dev; + struct imx_icc_node *node_data; + struct icc_node *node; + int ret; + + node = icc_node_create(node_desc->id); + if (IS_ERR(node)) { + dev_err(dev, "failed to create node %d\n", node_desc->id); + return node; + } + + if (node->data) { + dev_err(dev, "already created node %s id=%d\n", + node_desc->name, node_desc->id); + return ERR_PTR(-EEXIST); + } + + node_data = devm_kzalloc(dev, sizeof(*node_data), GFP_KERNEL); + if (!node_data) { + icc_node_destroy(node->id); + return ERR_PTR(-ENOMEM); + } + + node->name = node_desc->name; + node->data = node_data; + node_data->desc = node_desc; + icc_node_add(node, provider); + + if (node_desc->adj) { + ret = imx_icc_node_init_devfreq(dev, node); + if (ret < 0) { + icc_node_del(node); + icc_node_destroy(node->id); + return ERR_PTR(ret); + } + } + + return node; +} + +static void imx_icc_unregister_nodes(struct icc_provider *provider) +{ + struct icc_node *node, *tmp; + + list_for_each_entry_safe(node, tmp, &provider->nodes, node_list) { + struct imx_icc_node *node_data = node->data; + + icc_node_del(node); + icc_node_destroy(node->id); + if (dev_pm_qos_request_active(&node_data->qos_req)) + dev_pm_qos_remove_request(&node_data->qos_req); + } +} + +static int imx_icc_register_nodes(struct icc_provider *provider, + const struct imx_icc_node_desc *descs, + int count) +{ + int ret; + int i; + + for (i = 0; i < count; i++) { + struct icc_node *node; + const struct imx_icc_node_desc *node_desc = &descs[i]; + size_t j; + + node = imx_icc_node_add(provider, node_desc); + if (IS_ERR(node)) { + ret = PTR_ERR(node); + if (ret != -EPROBE_DEFER) + dev_err(provider->dev, "failed to add %s: %d\n", + node_desc->name, ret); + goto err; + } + + for (j = 0; j < node_desc->num_links; j++) + icc_link_create(node, node_desc->links[j]); + } + + return 0; + +err: + imx_icc_unregister_nodes(provider); + + return ret; +} + +int imx_icc_register(struct platform_device *pdev, + struct imx_icc_node_desc *nodes, int nodes_count) +{ + struct device *dev = &pdev->dev; + struct imx_icc_provider *provider_data; + struct icc_provider *provider; + int ret; + + provider_data = devm_kzalloc(dev, sizeof(*provider_data), GFP_KERNEL); + if (!provider_data) + return -ENOMEM; + provider_data->dev = dev; + + provider = devm_kzalloc(dev, sizeof(*provider), GFP_KERNEL); + if (!provider) + return -ENOMEM; + provider->set = imx_icc_set; + provider->aggregate = imx_icc_aggregate; + provider->xlate = imx_icc_xlate; + provider->data = provider_data; + provider->dev = dev; + platform_set_drvdata(pdev, provider); + + ret = icc_provider_add(provider); + if (ret) { + dev_err(dev, "error adding interconnect provider: %d\n", ret); + return ret; + } + + ret = imx_icc_register_nodes(provider, nodes, nodes_count); + if (ret) + goto provider_del; + + pr_info("registered %s\n", pdev->name); + + return 0; + +provider_del: + icc_provider_del(provider); + return ret; +} +EXPORT_SYMBOL_GPL(imx_icc_register); + +int imx_icc_unregister(struct platform_device *pdev) +{ + struct icc_provider *provider = platform_get_drvdata(pdev); + + icc_provider_del(provider); + imx_icc_unregister_nodes(provider); + + return 0; +} +EXPORT_SYMBOL_GPL(imx_icc_unregister); diff --git a/drivers/interconnect/imx/imx.h b/drivers/interconnect/imx/imx.h new file mode 100644 index 000000000000..9299b8d941f0 --- /dev/null +++ b/drivers/interconnect/imx/imx.h @@ -0,0 +1,60 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Interconnect framework driver for i.MX SoC + * + * Copyright (c) 2019, BayLibre + * Copyright (c) 2019, NXP + * Author: Alexandre Bailon + * Author: Leonard Crestez + */ +#ifndef __DRIVERS_INTERCONNECT_IMX_H +#define __DRIVERS_INTERCONNECT_IMX_H + +#include + +#define IMX_ICC_MAX_LINKS 4 + +/* + * struct imx_icc_node_adj - Describe a dynamic adjustment knob + */ +struct imx_icc_node_adj_desc { + unsigned int bw_mul, bw_div; +}; + +/* + * struct imx_icc_node - Describe an interconnect node + * @name: name of the node + * @id: an unique id to identify the node + * @links: an array of slaves' node id + * @num_links: number of id defined in links + */ +struct imx_icc_node_desc { + const char *name; + u16 id; + u16 links[IMX_ICC_MAX_LINKS]; + u16 num_links; + + const struct imx_icc_node_adj_desc *adj; +}; + +#define DEFINE_BUS_INTERCONNECT(_name, _id, _adj, ...) \ + { \ + .id = _id, \ + .name = _name, \ + .adj = _adj, \ + .num_links = ARRAY_SIZE(((int[]){ __VA_ARGS__ })), \ + .links = { __VA_ARGS__ }, \ + } + +#define DEFINE_BUS_MASTER(_name, _id, _dest_id) \ + DEFINE_BUS_INTERCONNECT(_name, _id, NULL, 1, _dest_id) + +#define DEFINE_BUS_SLAVE(_name, _id, _adj) \ + DEFINE_BUS_INTERCONNECT(_name, _id, _adj, 0) + +int imx_icc_register(struct platform_device *pdev, + struct imx_icc_node_desc *nodes, + int nodes_count); +int imx_icc_unregister(struct platform_device *pdev); + +#endif /* __DRIVERS_INTERCONNECT_IMX_H */ From patchwork Fri Aug 23 14:36:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 11111873 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 81252112C for ; Fri, 23 Aug 2019 14:38:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5C9E62054F for ; Fri, 23 Aug 2019 14:38:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Y9NA0jIs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C9E62054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=7hnvkTfzzVnvbwNfVvq9fUH5R3H8yzenq1TJciWPO+w=; b=Y9NA0jIspYkQwoLNFMuMh684zO S+pOqcmtNcIXG5HMrIntWtKAHysZkOrAcbcLd3enm/EX1Cvx0iPFV5LRHAvUPqkX51gLKfduNq13E W2EPeBL8Fqe50zkGpRuJZ6zQtMajpbaqvf4wBDxUEi+bE2LsCCbBCRw2FhK/+GNw7s1KvSp6Qxjm7 +dUleN2eyHrtWYuBgOMAc9bQCn5V+YC0Pndz8Yy59PRMLfcHTE0t/mLGIG9jikpHHGOq6xJOV2FCj mhO7eVb+B5lA7qEtLJ0MynaXrNIq8P4RK+VxKLdBDgZs8L91P9OZw20P17qFiN/lfu0j0da8Kmbtd uuw5yELQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1AhY-00037N-4G; Fri, 23 Aug 2019 14:38:04 +0000 Received: from inva020.nxp.com ([92.121.34.13]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1Agf-0001sl-S8 for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2019 14:37:11 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id A6DA41A00C2; Fri, 23 Aug 2019 16:37:08 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 987791A0030; Fri, 23 Aug 2019 16:37:08 +0200 (CEST) Received: from fsr-ub1864-112.ea.freescale.net (fsr-ub1864-112.ea.freescale.net [10.171.82.98]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id A5C9E205D9; Fri, 23 Aug 2019 16:37:07 +0200 (CEST) From: Leonard Crestez To: Georgi Djakov , Rob Herring , =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , Chanwoo Choi Subject: [RFCv4 5/7] interconnect: imx: Add platform driver for imx8mm Date: Fri, 23 Aug 2019 17:36:58 +0300 Message-Id: <63d586f9a79b174dc46153a90d3d223ba7abc285.1566570260.git.leonard.crestez@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190823_073710_184613_85E342A2 X-CRM114-Status: GOOD ( 13.13 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [92.121.34.13 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Dong Aisheng , linux-arm-kernel@lists.infradead.org, Saravana Kannan , linux-pm@vger.kernel.org, Stephen Boyd , Viresh Kumar , Michael Turquette , Krzysztof Kozlowski , Kyungmin Park , MyungJoo Ham , Alexandre Bailon , kernel@pengutronix.de, Fabio Estevam , Shawn Guo , devicetree@vger.kernel.org, linux-imx@nxp.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add a platform driver for the i.MX8MM SoC describing bus topology. Bandwidth adjustments is currently only supported on the DDRC and main NOC. Scaling for the vpu/gpu/display NICs could be added in the future. Signed-off-by: Alexandre Bailon Signed-off-by: Leonard Crestez --- drivers/interconnect/imx/Kconfig | 4 + drivers/interconnect/imx/Makefile | 1 + drivers/interconnect/imx/imx8mm.c | 105 ++++++++++++++++++++++ include/dt-bindings/interconnect/imx8mm.h | 49 ++++++++++ 4 files changed, 159 insertions(+) create mode 100644 drivers/interconnect/imx/imx8mm.c create mode 100644 include/dt-bindings/interconnect/imx8mm.h diff --git a/drivers/interconnect/imx/Kconfig b/drivers/interconnect/imx/Kconfig index 7d81d3c83a61..15671fe7f600 100644 --- a/drivers/interconnect/imx/Kconfig +++ b/drivers/interconnect/imx/Kconfig @@ -1,5 +1,9 @@ config INTERCONNECT_IMX bool "i.MX interconnect drivers" depends on ARCH_MXC || COMPILE_TEST help Generic interconnect driver for i.MX SOCs + +config INTERCONNECT_IMX8MM + def_bool y + depends on INTERCONNECT_IMX diff --git a/drivers/interconnect/imx/Makefile b/drivers/interconnect/imx/Makefile index bb92fd9fe4a5..5f658c1608a6 100644 --- a/drivers/interconnect/imx/Makefile +++ b/drivers/interconnect/imx/Makefile @@ -1 +1,2 @@ obj-$(CONFIG_INTERCONNECT_IMX) += imx.o +obj-$(CONFIG_INTERCONNECT_IMX8MM) += imx8mm.o diff --git a/drivers/interconnect/imx/imx8mm.c b/drivers/interconnect/imx/imx8mm.c new file mode 100644 index 000000000000..acc002153729 --- /dev/null +++ b/drivers/interconnect/imx/imx8mm.c @@ -0,0 +1,105 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Interconnect framework driver for i.MX SoC + * + * Copyright (c) 2019, BayLibre + * Copyright (c) 2019, NXP + * Author: Alexandre Bailon + * Author: Leonard Crestez + */ + +#include +#include +#include +#include + +#include + +#include "imx.h" + +static const struct imx_icc_node_adj_desc imx8mm_dram_adj = { + .bw_mul = 1, + .bw_div = 16, +}; + +static const struct imx_icc_node_adj_desc imx8mm_noc_adj = { + .bw_mul = 1, + .bw_div = 16, +}; + +/* + * Describe bus masters, slaves and connections between them + * + * This is a simplified subset of the bus diagram, there are several other + * PL301 nics which are skipped/merged into PL301_MAIN + */ +static struct imx_icc_node_desc nodes[] = { + DEFINE_BUS_INTERCONNECT("NOC", IMX8MM_ICN_NOC, &imx8mm_noc_adj, + IMX8MM_ICS_DRAM, IMX8MM_ICN_MAIN), + + DEFINE_BUS_SLAVE("DRAM", IMX8MM_ICS_DRAM, &imx8mm_dram_adj), + DEFINE_BUS_SLAVE("OCRAM", IMX8MM_ICS_OCRAM, NULL), + DEFINE_BUS_MASTER("A53", IMX8MM_ICM_A53, IMX8MM_ICN_NOC), + + /* VPUMIX */ + DEFINE_BUS_MASTER("VPU H1", IMX8MM_ICM_VPU_H1, IMX8MM_ICN_VIDEO), + DEFINE_BUS_MASTER("VPU G1", IMX8MM_ICM_VPU_G1, IMX8MM_ICN_VIDEO), + DEFINE_BUS_MASTER("VPU G2", IMX8MM_ICM_VPU_G2, IMX8MM_ICN_VIDEO), + DEFINE_BUS_INTERCONNECT("PL301_VIDEO", IMX8MM_ICN_VIDEO, NULL, IMX8MM_ICN_NOC), + + /* GPUMIX */ + DEFINE_BUS_MASTER("GPU 2D", IMX8MM_ICM_GPU2D, IMX8MM_ICN_GPU), + DEFINE_BUS_MASTER("GPU 3D", IMX8MM_ICM_GPU3D, IMX8MM_ICN_GPU), + DEFINE_BUS_INTERCONNECT("PL301_GPU", IMX8MM_ICN_GPU, NULL, IMX8MM_ICN_NOC), + + /* DISPLAYMIX */ + DEFINE_BUS_MASTER("CSI", IMX8MM_ICM_CSI, IMX8MM_ICN_MIPI), + DEFINE_BUS_MASTER("LCDIF", IMX8MM_ICM_LCDIF, IMX8MM_ICN_MIPI), + DEFINE_BUS_INTERCONNECT("PL301_MIPI", IMX8MM_ICN_MIPI, NULL, IMX8MM_ICN_NOC), + + /* HSIO */ + DEFINE_BUS_MASTER("USB1", IMX8MM_ICM_USB1, IMX8MM_ICN_HSIO), + DEFINE_BUS_MASTER("USB2", IMX8MM_ICM_USB2, IMX8MM_ICN_HSIO), + DEFINE_BUS_MASTER("PCIE", IMX8MM_ICM_PCIE, IMX8MM_ICN_HSIO), + DEFINE_BUS_INTERCONNECT("PL301_HSIO", IMX8MM_ICN_HSIO, NULL, IMX8MM_ICN_NOC), + + /* Audio */ + DEFINE_BUS_MASTER("SDMA2", IMX8MM_ICM_SDMA2, IMX8MM_ICN_AUDIO), + DEFINE_BUS_MASTER("SDMA3", IMX8MM_ICM_SDMA3, IMX8MM_ICN_AUDIO), + DEFINE_BUS_INTERCONNECT("PL301_AUDIO", IMX8MM_ICN_AUDIO, NULL, IMX8MM_ICN_MAIN), + + /* Ethernet */ + DEFINE_BUS_MASTER("ENET", IMX8MM_ICM_ENET, IMX8MM_ICN_ENET), + DEFINE_BUS_INTERCONNECT("PL301_ENET", IMX8MM_ICN_ENET, NULL, IMX8MM_ICN_MAIN), + + /* Other */ + DEFINE_BUS_MASTER("SDMA1", IMX8MM_ICM_SDMA1, IMX8MM_ICN_MAIN), + DEFINE_BUS_MASTER("NAND", IMX8MM_ICM_NAND, IMX8MM_ICN_MAIN), + DEFINE_BUS_MASTER("USDHC1", IMX8MM_ICM_USDHC1, IMX8MM_ICN_MAIN), + DEFINE_BUS_MASTER("USDHC2", IMX8MM_ICM_USDHC2, IMX8MM_ICN_MAIN), + DEFINE_BUS_MASTER("USDHC3", IMX8MM_ICM_USDHC3, IMX8MM_ICN_MAIN), + DEFINE_BUS_INTERCONNECT("PL301_MAIN", IMX8MM_ICN_MAIN, NULL, + IMX8MM_ICN_NOC, IMX8MM_ICS_OCRAM), +}; + +static int imx8mm_icc_probe(struct platform_device *pdev) +{ + return imx_icc_register(pdev, nodes, ARRAY_SIZE(nodes)); +} + +static int imx8mm_icc_remove(struct platform_device *pdev) +{ + return imx_icc_unregister(pdev); +} + +static struct platform_driver imx8mm_icc_driver = { + .probe = imx8mm_icc_probe, + .remove = imx8mm_icc_remove, + .driver = { + .name = "imx8mm-interconnect", + }, +}; + +module_platform_driver(imx8mm_icc_driver); +MODULE_AUTHOR("Alexandre Bailon "); +MODULE_LICENSE("GPL v2"); diff --git a/include/dt-bindings/interconnect/imx8mm.h b/include/dt-bindings/interconnect/imx8mm.h new file mode 100644 index 000000000000..5404f2af15c3 --- /dev/null +++ b/include/dt-bindings/interconnect/imx8mm.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Interconnect framework driver for i.MX SoC + * + * Copyright (c) 2019, BayLibre + * Author: Alexandre Bailon + */ + +#ifndef __IMX8MM_ICM_INTERCONNECT_IDS_H +#define __IMX8MM_ICM_INTERCONNECT_IDS_H + +#define IMX8MM_ICN_NOC 1 +#define IMX8MM_ICS_DRAM 2 +#define IMX8MM_ICS_OCRAM 3 +#define IMX8MM_ICM_A53 4 + +#define IMX8MM_ICM_VPU_H1 5 +#define IMX8MM_ICM_VPU_G1 6 +#define IMX8MM_ICM_VPU_G2 7 +#define IMX8MM_ICN_VIDEO 8 + +#define IMX8MM_ICM_GPU2D 9 +#define IMX8MM_ICM_GPU3D 10 +#define IMX8MM_ICN_GPU 11 + +#define IMX8MM_ICM_CSI 12 +#define IMX8MM_ICM_LCDIF 13 +#define IMX8MM_ICN_MIPI 14 + +#define IMX8MM_ICM_USB1 15 +#define IMX8MM_ICM_USB2 16 +#define IMX8MM_ICM_PCIE 17 +#define IMX8MM_ICN_HSIO 18 + +#define IMX8MM_ICM_SDMA2 19 +#define IMX8MM_ICM_SDMA3 20 +#define IMX8MM_ICN_AUDIO 21 + +#define IMX8MM_ICN_ENET 22 +#define IMX8MM_ICM_ENET 23 + +#define IMX8MM_ICN_MAIN 24 +#define IMX8MM_ICM_NAND 25 +#define IMX8MM_ICM_SDMA1 26 +#define IMX8MM_ICM_USDHC1 27 +#define IMX8MM_ICM_USDHC2 28 +#define IMX8MM_ICM_USDHC3 29 + +#endif /* __IMX8MM_ICM_INTERCONNECT_IDS_H */ From patchwork Fri Aug 23 14:36:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 11111877 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2591B13A4 for ; Fri, 23 Aug 2019 14:38:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 00214206BA for ; Fri, 23 Aug 2019 14:38:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sIdcq3xA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 00214206BA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=zfv+mOJESqoaTMPVJ8kdJ4t7Z0FARpyOD90EZ/aJxeI=; b=sIdcq3xAJCWwaaOqbTgJRq9H88 tiNcCBhyiiix6hPdkmppEw1GUAUBehHeC5w94NK0k38TOXzk3Y9IJdFIMZryaI+0zUGfYrlyQNgTd 5V+KJRJCax5b/pgs9Bvmo1gR/ovZkYoG1xUHcJ6jrhcVAjznL6r9LFrAyoR5diSxWA5d5L/PANqCh Cxu4qb14ToFZvxMlJjOYagWauOuHhQIAdbxNuSdY9SH6mspj7a1bdeBr+cuuWf+F/wWLU1avrFbNn 6y97ANCHkS20YxpdQKqPpzx7hOj1AydsuidQVEIhFp4DwPhi8NerK4tEgR98I449k5PfPDd33xJ+t 47R7My5g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1Ahf-0003Ko-JT; Fri, 23 Aug 2019 14:38:11 +0000 Received: from inva020.nxp.com ([92.121.34.13]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1Agg-0001tX-SV for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2019 14:37:12 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 948681A06D1; Fri, 23 Aug 2019 16:37:09 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 87C8B1A0130; Fri, 23 Aug 2019 16:37:09 +0200 (CEST) Received: from fsr-ub1864-112.ea.freescale.net (fsr-ub1864-112.ea.freescale.net [10.171.82.98]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id A9873205D9; Fri, 23 Aug 2019 16:37:08 +0200 (CEST) From: Leonard Crestez To: Georgi Djakov , Rob Herring , =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , Chanwoo Choi Subject: [RFCv4 6/7] soc: imx8mm: Register interconnect platform device Date: Fri, 23 Aug 2019 17:36:59 +0300 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190823_073711_072645_86D86F01 X-CRM114-Status: UNSURE ( 9.78 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [92.121.34.13 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Dong Aisheng , linux-arm-kernel@lists.infradead.org, Saravana Kannan , linux-pm@vger.kernel.org, Stephen Boyd , Viresh Kumar , Michael Turquette , Krzysztof Kozlowski , Kyungmin Park , MyungJoo Ham , Alexandre Bailon , kernel@pengutronix.de, Fabio Estevam , Shawn Guo , devicetree@vger.kernel.org, linux-imx@nxp.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Since there is no virtual devicetree node representing the interconnect we need to probe the icc device externally. Probing this from the SOC driver allows the interconnect device to be built as a module. This is very similar to imx-cpufreq-dt. Signed-off-by: Leonard Crestez --- drivers/soc/imx/soc-imx8.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/soc/imx/soc-imx8.c b/drivers/soc/imx/soc-imx8.c index b9831576dd25..24d515a9fdb2 100644 --- a/drivers/soc/imx/soc-imx8.c +++ b/drivers/soc/imx/soc-imx8.c @@ -22,10 +22,11 @@ /* Same as ANADIG_DIGPROG_IMX7D */ #define ANADIG_DIGPROG_IMX8MM 0x800 struct imx8_soc_data { char *name; + char *icc_driver; u32 (*soc_revision)(void); }; static u64 soc_uid; @@ -115,10 +116,11 @@ static const struct imx8_soc_data imx8mq_soc_data = { }; static const struct imx8_soc_data imx8mm_soc_data = { .name = "i.MX8MM", .soc_revision = imx8mm_soc_revision, + .icc_driver = "imx8mm-interconnect", }; static const struct imx8_soc_data imx8mn_soc_data = { .name = "i.MX8MN", .soc_revision = imx8mm_soc_revision, @@ -185,10 +187,12 @@ static int __init imx8_soc_init(void) if (ret) goto free_rev; if (IS_ENABLED(CONFIG_ARM_IMX_CPUFREQ_DT)) platform_device_register_simple("imx-cpufreq-dt", -1, NULL, 0); + if (IS_ENABLED(CONFIG_INTERCONNECT_IMX)) + platform_device_register_simple(data->icc_driver, -1, NULL, 0); return 0; free_rev: if (strcmp(soc_dev_attr->revision, "unknown")) From patchwork Fri Aug 23 14:37:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 11111881 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA4E713A4 for ; Fri, 23 Aug 2019 14:38:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C523B2054F for ; Fri, 23 Aug 2019 14:38:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="M9MyGNdE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C523B2054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=zmTeqcurKVr38Ll73do7XXlOdiPpNcnSKeiLk2M3eTU=; b=M9MyGNdEcMKDRHEN5DA9jZ1KL9 Biunt1XTGgpKAGtJiBIt8ThtMqRzz8rYYv7a2YUG+EeitUXkzTiuvbFsgwLrSvfK6XfgH4hl95rn5 nuTrgjgm7SWXdacdiX4NsgJHQOrlZOmHBc6DIOGlBX3Y3msh39ygou/CHVyhrNBt3jxrSagp8OMyC 1W85GxX/VHInMKGJCoGETiGE3A+8Itm3ql4olq5WgB8Z2fpgVfYbrjsHK6dFJFVGTesCHx8K619mR M+Cf4x6XMFquZAyuW3UAeDhQtGmPhNNlEo/Eso7n/PutYm77tQ5P+FTjyWmyYYaXWaaMDNbsw4XQV lXuDTN0g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i1Ahy-0003jl-VP; Fri, 23 Aug 2019 14:38:30 +0000 Received: from inva020.nxp.com ([92.121.34.13]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i1Agh-0001v4-M0 for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2019 14:37:13 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 83E9D1A06DE; Fri, 23 Aug 2019 16:37:10 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 774DB1A06D9; Fri, 23 Aug 2019 16:37:10 +0200 (CEST) Received: from fsr-ub1864-112.ea.freescale.net (fsr-ub1864-112.ea.freescale.net [10.171.82.98]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 98D90205D9; Fri, 23 Aug 2019 16:37:09 +0200 (CEST) From: Leonard Crestez To: Georgi Djakov , Rob Herring , =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , Chanwoo Choi Subject: [RFCv4 7/7] arm64: dts: imx8mm: Add interconnect properties Date: Fri, 23 Aug 2019 17:37:00 +0300 Message-Id: <8c3fb831b3c146cf3267c05e4b1f6c88613dceed.1566570260.git.leonard.crestez@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190823_073711_868020_65633454 X-CRM114-Status: UNSURE ( 7.60 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [92.121.34.13 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Dong Aisheng , linux-arm-kernel@lists.infradead.org, Saravana Kannan , linux-pm@vger.kernel.org, Stephen Boyd , Viresh Kumar , Michael Turquette , Krzysztof Kozlowski , Kyungmin Park , MyungJoo Ham , Alexandre Bailon , kernel@pengutronix.de, Fabio Estevam , Shawn Guo , devicetree@vger.kernel.org, linux-imx@nxp.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add #interconnect-cells and interconnect-node-id properties on devfreq nodes. The imx interconnect provider will scan these. Signed-off-by: Leonard Crestez --- arch/arm64/boot/dts/freescale/imx8mm.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mm.dtsi b/arch/arm64/boot/dts/freescale/imx8mm.dtsi index 5474c50784c2..8b5442d8b1b2 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mm.dtsi @@ -6,10 +6,11 @@ #include #include #include #include #include +#include #include "imx8mm-pinfunc.h" / { compatible = "fsl,imx8mm"; @@ -806,10 +807,12 @@ noc: noc@32700000 { compatible = "fsl,imx8mm-noc", "fsl,imx8m-noc"; reg = <0x32700000 0x100000>; clocks = <&clk IMX8MM_CLK_NOC>; devfreq = <&ddrc>; + #interconnect-cells = <1>; + interconnect-node-id = ; operating-points-v2 = <&noc_opp_table>; }; aips4: bus@32c00000 { compatible = "fsl,aips-bus", "simple-bus"; @@ -896,10 +899,12 @@ }; ddrc: dram-controller@3d400000 { compatible = "fsl,imx8mm-ddrc", "fsl,imx8m-ddrc"; reg = <0x3d400000 0x400000>; + #interconnect-cells = <1>; + interconnect-node-id = ; clock-names = "dram_core", "dram_pll", "dram_alt", "dram_apb"; clocks = <&clk IMX8MM_CLK_DRAM_CORE>,