Add SC7180 interconnect provider driver
Subsystems (5)
v2 cover Add SC7180 interconnect provider driver
Add driver to support scaling of the on-chip interconnects on the SC7180-based platforms.
Depends-on: interconnect: qcom: sdm845: Walk the list safely on node removal
Depends-on: Walk the list safely on node removal
Depends-on: Add device tree support for sc7180
Odelu Kukatla (3):
dt-bindings: interconnect: Add Qualcomm SC7180 DT bindings
interconnect: qcom: Add SC7180 interconnect provider driver
arm64: dts: sc7180: Add interconnect provider DT nodes
.../bindings/interconnect/qcom,bcm-voter.yaml | 1 + .../bindings/interconnect/qcom,sc7180.yaml | 155 ++++ arch/arm64/boot/dts/qcom/sc7180.dtsi | 96 +++ drivers/interconnect/qcom/Kconfig | 10 + drivers/interconnect/qcom/Makefile | 2 + drivers/interconnect/qcom/bcm-voter.c | 1 + drivers/interconnect/qcom/sc7180.c | 787 +++++++++++++++++++++ include/dt-bindings/interconnect/qcom,sc7180.h | 161 +++++ 8 files changed, 1213 insertions(+) create mode 100644 Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml create mode 100644 drivers/interconnect/qcom/sc7180.c create mode 100644 include/dt-bindings/interconnect/qcom,sc7180.h
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v2 1/3 dt-bindings: interconnect: Add Qualcomm SC7180 DT bindings
The Qualcomm SC7180 platform has several bus fabrics that could be controlled and tuned dynamically according to the bandwidth demand.
--- .../bindings/interconnect/qcom,bcm-voter.yaml | 1 + .../bindings/interconnect/qcom,sc7180.yaml | 155 ++++++++++++++++++++ include/dt-bindings/interconnect/qcom,sc7180.h | 161 +++++++++++++++++++++ 3 files changed, 317 insertions(+) create mode 100644 Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml create mode 100644 include/dt-bindings/interconnect/qcom,sc7180.h
Documentation/devicetree/bindings/interconnect/qcom,bcm-voter.yaml +1 -0
@@ -19,6 +19,7 @@ description: | properties: compatible: enum: + - qcom,sc7180-bcm-voter - qcom,sdm845-bcm-voter required:
Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml new file +155 -0
155 lines not on this page · raw message
include/dt-bindings/interconnect/qcom,sc7180.h new file +161 -0
161 lines not on this page · raw message
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v2 2/3 interconnect: qcom: Add SC7180 interconnect provider driver
In reply to Odelu KukatlaAdd driver for the Qualcomm interconnect buses found in SC7180 based platforms. The topology consists of several NoCs that are controlled by a remote processor that collects the aggregated bandwidth for each master-slave pairs.
--- drivers/interconnect/qcom/Kconfig | 10 + drivers/interconnect/qcom/Makefile | 2 + drivers/interconnect/qcom/bcm-voter.c | 1 + drivers/interconnect/qcom/sc7180.c | 788 ++++++++++++++++++++++++++++++++++ 4 files changed, 801 insertions(+) create mode 100644 drivers/interconnect/qcom/sc7180.c
drivers/interconnect/qcom/Kconfig +10 -0
@@ -23,6 +23,16 @@ config INTERCONNECT_QCOM_QCS404 This is a driver for the Qualcomm Network-on-Chip on qcs404-based platforms. +config INTERCONNECT_QCOM_SC7180 + tristate "Qualcomm SC7180 interconnect driver" + depends on INTERCONNECT_QCOM + depends on (QCOM_RPMH && QCOM_COMMAND_DB && OF) || COMPILE_TEST + select INTERCONNECT_QCOM_RPMH + select INTERCONNECT_QCOM_BCM_VOTER + help + This is a driver for the Qualcomm Network-on-Chip on sc7180-based + platforms. + config INTERCONNECT_QCOM_SDM845 tristate "Qualcomm SDM845 interconnect driver" depends on INTERCONNECT_QCOM
drivers/interconnect/qcom/Makefile +2 -0
@@ -2,6 +2,7 @@ qnoc-msm8974-objs := msm8974.o qnoc-qcs404-objs := qcs404.o +qnoc-sc7180-objs := sc7180.o qnoc-sdm845-objs := sdm845.o icc-smd-rpm-objs := smd-rpm.o icc-bcm-voter-objs := bcm-voter.o
@@ -13,5 +14,6 @@ obj-$(CONFIG_INTERCONNECT_QCOM_MSM8916) += qnoc-msm8916.o obj-$(CONFIG_INTERCONNECT_QCOM_MSM8974) += qnoc-msm8974.o obj-$(CONFIG_INTERCONNECT_QCOM_QCS404) += qnoc-qcs404.o obj-$(CONFIG_INTERCONNECT_QCOM_RPMH) += icc-rpmh.o +obj-$(CONFIG_INTERCONNECT_QCOM_SC7180) += qnoc-sc7180.o obj-$(CONFIG_INTERCONNECT_QCOM_SDM845) += qnoc-sdm845.o obj-$(CONFIG_INTERCONNECT_QCOM_SMD_RPM) += icc-smd-rpm.o
drivers/interconnect/qcom/bcm-voter.c +1 -0
@@ -338,6 +338,7 @@ static int qcom_icc_bcm_voter_probe(struct platform_device *pdev) }static const struct of_device_id bcm_voter_of_match[] = { + { .compatible ="qcom,sc7180-bcm-voter" }, { .compatible ="qcom,sdm845-bcm-voter" }, { }, };
drivers/interconnect/qcom/sc7180.c new file +788 -0
788 lines not on this page · raw message
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v2 3/3 arm64: dts: sc7180: Add interconnect provider DT nodes
In reply to Odelu KukatlaAdd the DT nodes for the network-on-chip interconnect buses found on sc7180-based platforms.
--- arch/arm64/boot/dts/qcom/sc7180.dtsi | 96 ++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+)
arch/arm64/boot/dts/qcom/sc7180.dtsi +96 -0
@@ -8,6 +8,7 @@ #include <dt-bindings/clock/qcom,gcc-sc7180.h> #include <dt-bindings/clock/qcom,rpmh.h> #include <dt-bindings/interrupt-controller/arm-gic.h> +#include <dt-bindings/interconnect/qcom,sc7180.h> #include <dt-bindings/phy/phy-qcom-qusb2.h> #include <dt-bindings/soc/qcom,rpmh-rsc.h>
@@ -1286,6 +1287,10 @@ clock-names = "xo"; #clock-cells = <1>; }; + + apps_bcm_voter: bcm_voter { + compatible = "qcom,sc7180-bcm-voter"; + }; }; cpufreq_hw: cpufreq@18323000 {
@@ -1298,6 +1303,97 @@ #freq-domain-cells = <1>; }; + + config_noc: interconnect@1500000 { + compatible = "qcom,sc7180-config-noc"; + reg = <0 0x01500000 0 0x28000>; + #interconnect-cells = <1>; + qcom,bcm-voters = <&apps_bcm_voter>; + }; + + system_noc: interconnect@1620000 { + compatible = "qcom,sc7180-system-noc"; + reg = <0 0x01620000 0 0x17080>; + #interconnect-cells = <1>; + qcom,bcm-voters = <&apps_bcm_voter>; + }; + + mc_virt: interconnect@1630000 { + compatible = "qcom,sc7180-mc-virt"; + reg = <0 0x01630000 0 0x4000>; + #interconnect-cells = <1>; + qcom,bcm-voters = <&apps_bcm_voter>; + }; + + qup_virt: interconnect@1650000 { + compatible = "qcom,sc7180-qup-virt"; + reg = <0 0x01650000 0 0x4000>; + #interconnect-cells = <1>; + qcom,bcm-voters = <&apps_bcm_voter>; + }; + + aggre1_noc: interconnect@16e0000 { + compatible = "qcom,sc7180-aggre1-noc"; + reg = <0 0x016e0000 0 0x15080>; + #interconnect-cells = <1>; + qcom,bcm-voters = <&apps_bcm_voter>; + }; + + aggre2_noc: interconnect@1700000 { + compatible = "qcom,sc7180-aggre2-noc"; + reg = <0 0x01700000 0 0x1f880>; + #interconnect-cells = <1>; + qcom,bcm-voters = <&apps_bcm_voter>; + }; + + compute_noc: interconnect@170e000 { + compatible = "qcom,sc7180-compute-noc"; + reg = <0 0x0170e000 0 0x11880>; + #interconnect-cells = <1>; + qcom,bcm-voters = <&apps_bcm_voter>; + }; + + mmss_noc: interconnect@1740000 { + compatible = "qcom,sc7180-mmss-noc"; + reg = <0 0x01740000 0 0x1c100>; + #interconnect-cells = <1>; + qcom,bcm-voters = <&apps_bcm_voter>; + }; + + ipa_virt: interconnect@1e00000 { + compatible = "qcom,sc7180-ipa-virt"; + reg = <0 0x01e00000 0 0x4000>; + #interconnect-cells = <1>; + qcom,bcm-voters = <&apps_bcm_voter>; + }; + + dc_noc: interconnect@9160000 { + compatible = "qcom,sc7180-dc-noc"; + reg = <0 0x09160000 0 0x03200>; + #interconnect-cells = <1>; + qcom,bcm-voters = <&apps_bcm_voter>; + }; + + gem_noc: interconnect@9680000 { + compatible = "qcom,sc7180-gem-noc"; + reg = <0 0x09680000 0 0x3e200>; + #interconnect-cells = <1>; + qcom,bcm-voters = <&apps_bcm_voter>; + }; + + npu_noc: interconnect@9990000 { + compatible = "qcom,sc7180-npu-noc"; + reg = <0 0x09990000 0 0x1600>; + #interconnect-cells = <1>; + qcom,bcm-voters = <&apps_bcm_voter>; + }; + + camnoc_virt: interconnect@ac00000 { + compatible = "qcom,sc7180-camnoc-virt"; + reg = <0 0x0ac00000 0 0x4000>; + #interconnect-cells = <1>; + qcom,bcm-voters = <&apps_bcm_voter>; + }; }; thermal-zones {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [V2, 1/3] dt-bindings: interconnect: Add Qualcomm SC7180 DT bindings
In reply to Odelu KukatlaQuoted 30 lines · Odelu Kukatla
The Qualcomm SC7180 platform has several bus fabrics that could be controlled and tuned dynamically according to the bandwidth demand.
Signed-off-by Odelu Kukatla <[email protected]>--- .../bindings/interconnect/qcom,bcm-voter.yaml | 1 + .../bindings/interconnect/qcom,sc7180.yaml | 155 ++++++++++++++++++++ include/dt-bindings/interconnect/qcom,sc7180.h | 161 +++++++++++++++++++++ 3 files changed, 317 insertions(+) create mode 100644 Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml create mode 100644 include/dt-bindings/interconnect/qcom,sc7180.hDocumentation/devicetree/bindings/interconnect/qcom,bcm-voter.yaml +1
-0@@ -19,6 +19,7 @@ description: | properties: compatible: enum: + - qcom,sc7180-bcm-voter - qcom,sdm845-bcm-voter required:Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml new file +0
-0
Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml line 1
Quoted 1 line
Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml new file +1
-0@@ -0,0 +1,155 @@ +# SPDX-License-Identifier: GPL-2.0
Dual license new bindings:
(GPL-2.0-only OR BSD-2-Clause)
With that,
Re: [V2, 1/3] dt-bindings: interconnect: Add Qualcomm SC7180 DT bindings
Hi,
Quoted 11 lines · Rob Herring
Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml line 1
Quoted 7 lines · Odelu Kukatla
Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml new file +1
-0@@ -0,0 +1,155 @@ +# SPDX-License-Identifier: GPL-2.0Dual license new bindings:
Quoted 1 line
(GPL-2.0-only OR BSD-2-Clause)
Just curious, is that mandatory for any new bindings?
A.
Re: [V2, 2/3] interconnect: qcom: Add SC7180 interconnect provider driver
In reply to Odelu KukatlaQuoting Odelu Kukatla (2019-12-31 00:58:56)
drivers/interconnect/qcom/sc7180.c line 7
Quoted 13 lines
drivers/interconnect/qcom/sc7180.c new file +7
-0@@ -0,0 +1,788 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2019, The Linux Foundation. All rights reserved. +* +*/ + +#include <dt-bindings/interconnect/qcom,sc7180.h>
Can you include this after linux/ headers? That is the "preferred" way to include headers.
drivers/interconnect/qcom/sc7180.c line 12
Quoted 5 lines
drivers/interconnect/qcom/sc7180.c new file +5
-0+#include <linux/device.h> +#include <linux/interconnect.h> +#include <linux/interconnect-provider.h> +#include <linux/module.h> +#include <linux/of_device.h>
Hopefully this include isn't used and can be removed.
drivers/interconnect/qcom/sc7180.c line 13
Quoted 1 line
drivers/interconnect/qcom/sc7180.c new file +1
-0+#include <linux/of_platform.h>
Is this include used?
Quoted 5 lines
drivers/interconnect/qcom/sc7180.c new file +5
-0+#include <linux/platform_device.h> + +#include "icc-rpmh.h" +#include "bcm-voter.h" +
[...]
Quoted 9 lines
drivers/interconnect/qcom/sc7180.c new file +9
-0+ +static struct qcom_icc_node *system_noc_nodes[] = { + [MASTER_SNOC_CFG ] = &qhm_snoc_cfg, + [MASTER_A1NOC_SNOC ] = &qnm_aggre1_noc, + [MASTER_A2NOC_SNOC ] = &qnm_aggre2_noc, + [MASTER_GEM_NOC_SNOC ] = &qnm_gemnoc, + [MASTER_PIMEM ] = &qxm_pimem, + [SLAVE_APPSS ] = &qhs_apss, + [SLAVE_SNOC_CNOC ] = &qns_cnoc,
drivers/interconnect/qcom/sc7180.c line 641
Quoted 10 lines
drivers/interconnect/qcom/sc7180.c new file +10
-0+ [SLAVE_SNOC_GEM_NOC_GC] = &qns_gemnoc_gc, + [SLAVE_SNOC_GEM_NOC_SF] = &qns_gemnoc_sf, + [SLAVE_IMEM] = &qxs_imem, + [SLAVE_PIMEM] = &qxs_pimem, + [SLAVE_SERVICE_SNOC] = &srvc_snoc, + [SLAVE_QDSS_STM] = &xs_qdss_stm, + [SLAVE_TCU] = &xs_sys_tcu_cfg, +}; + +static struct qcom_icc_desc sc7180_system_noc = {
Can this be const? And the other ones?
Quoted 8 lines
drivers/interconnect/qcom/sc7180.c new file +8
-0+ .nodes = system_noc_nodes, + .num_nodes = ARRAY_SIZE(system_noc_nodes), + .bcms = system_noc_bcms, + .num_bcms = ARRAY_SIZE(system_noc_bcms), +}; + +static int qnoc_probe (struct platform_device *pdev) +{
drivers/interconnect/qcom/sc7180.c line 659
Quoted 10 lines
drivers/interconnect/qcom/sc7180.c new file +10
-0+const struct qcom_icc_desc *desc; +struct icc_onecell_data *data; +struct icc_provider *provider; +struct qcom_icc_node **qnodes; +struct qcom_icc_provider *qp; +struct icc_node *node; +size_t num_nodes, i; +int ret; + + desc =of_device_get_match_data (&pdev->dev);
Use device_get_match_data() instead?
Quoted 45 lines
drivers/interconnect/qcom/sc7180.c new file +45
-0+if (!desc) +return -EINVAL ; + + qnodes = desc->nodes; + num_nodes = desc->num_nodes; + + qp =devm_kzalloc (&pdev->dev,sizeof (*qp),GFP_KERNEL ); +if (!qp) +return -ENOMEM ; + + data =devm_kcalloc (&pdev->dev, num_nodes,sizeof (*node),GFP_KERNEL ); +if (!data) +return -ENOMEM ; + + provider = &qp->provider; + provider->dev = &pdev->dev; + provider->set = qcom_icc_set; + provider->pre_aggregate = qcom_icc_pre_aggregate; + provider->aggregate = qcom_icc_aggregate; + provider->xlate = of_icc_xlate_onecell; +INIT_LIST_HEAD (&provider->nodes); + provider->data = data; + + qp->dev = &pdev->dev; + qp->bcms = desc->bcms; + qp->num_bcms = desc->num_bcms; + + qp->voter =of_bcm_voter_get (qp->dev,NULL ); +if (IS_ERR (qp->voter)) +return PTR_ERR (qp->voter); + + ret =icc_provider_add (provider); +if (ret) { +dev_err (&pdev->dev,"error adding interconnect provider\n" ); +return ret; + } + +for (i =0 ; i < num_nodes; i++) { +size_t j; + +if (!qnodes[i]) +continue ; + + node =icc_node_create (qnodes[i]->id); +if (IS_ERR (node)) {
drivers/interconnect/qcom/sc7180.c line 714
Quoted 10 lines
drivers/interconnect/qcom/sc7180.c new file +10
-0+ ret =PTR_ERR (node); + goto err; + } + + node->name = qnodes[i]->name; + node->data = qnodes[i]; +icc_node_add (node, provider); + +dev_dbg (&pdev->dev,"registered node %pK %s %d\n" , node, + qnodes[i]->name, node->id);
Is this more debug junk? Maybe if it is useful it can be part of the core framework instead of in this driver?
drivers/interconnect/qcom/sc7180.c line 716
Quoted 2 lines
drivers/interconnect/qcom/sc7180.c new file +2
-0+ +/* populate links */
Useless comment.
drivers/interconnect/qcom/sc7180.c line 729
Quoted 13 lines
drivers/interconnect/qcom/sc7180.c new file +13
-0+for (j =0 ; j < qnodes[i]->num_links; j++) +icc_link_create (node, qnodes[i]->links[j]); + + data->nodes[i] = node; + } + data->num_nodes = num_nodes; + +for (i =0 ; i < qp->num_bcms; i++) +qcom_icc_bcm_init (qp->bcms[i], &pdev->dev); + +platform_set_drvdata (pdev, qp); + +dev_dbg (&pdev->dev,"Registered SC7180 ICC\n" );
This driver debug message is pretty useless. Please remove it.
drivers/interconnect/qcom/sc7180.c
Quoted 2 lines
drivers/interconnect/qcom/sc7180.c new file +2
-0+ +return ret;
return 0?
Quoted 32 lines
drivers/interconnect/qcom/sc7180.c new file +32
-0+err: +icc_nodes_remove (provider); +icc_provider_del (provider); +return ret; +} + +static int qnoc_remove (struct platform_device *pdev) +{ +struct qcom_icc_provider *qp =platform_get_drvdata (pdev); + +icc_nodes_remove (&qp->provider); +return icc_provider_del (&qp->provider); +} + +static const struct of_device_id qnoc_of_match[] = { + { .compatible ="qcom,sc7180-aggre1-noc" , + .data = &sc7180_aggre1_noc}, + { .compatible ="qcom,sc7180-aggre2-noc" , + .data = &sc7180_aggre2_noc}, + { .compatible ="qcom,sc7180-camnoc-virt" , + .data = &sc7180_camnoc_virt}, + { .compatible ="qcom,sc7180-compute-noc" , + .data = &sc7180_compute_noc}, + { .compatible ="qcom,sc7180-config-noc" , + .data = &sc7180_config_noc}, + { .compatible ="qcom,sc7180-dc-noc" , + .data = &sc7180_dc_noc}, + { .compatible ="qcom,sc7180-gem-noc" , + .data = &sc7180_gem_noc}, + { .compatible ="qcom,sc7180-ipa-virt" , + .data = &sc7180_ipa_virt}, + { .compatible ="qcom,sc7180-mc-virt" ,
drivers/interconnect/qcom/sc7180.c line 773
Quoted 10 lines
drivers/interconnect/qcom/sc7180.c new file +10
-0+ .data = &sc7180_mc_virt}, + { .compatible = "qcom,sc7180-mmss-noc", + .data = &sc7180_mmss_noc}, + { .compatible = "qcom,sc7180-npu-noc", + .data = &sc7180_npu_noc}, + { .compatible = "qcom,sc7180-qup-virt", + .data = &sc7180_qup_virt}, + { .compatible = "qcom,sc7180-system-noc", + .data = &sc7180_system_noc}, + { },
Nitpick: Drop the comma as it's the sentinel and nothing can come after.
Quoted 2 lines
drivers/interconnect/qcom/sc7180.c new file +2
-0+}; +MODULE_DEVICE_TABLE (of, qnoc_of_match);
Rob Herring
maintainerRe: [V2, 1/3] dt-bindings: interconnect: Add Qualcomm SC7180 DT bindings
In reply to Aaro KoskinenQuoted 15 lines · Aaro Koskinen
Hi,
Quoted 11 lines · Rob Herring
Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml line 1
Quoted 7 lines · Odelu Kukatla
Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml new file +1
-0@@ -0,0 +1,155 @@ +# SPDX-License-Identifier: GPL-2.0Dual license new bindings:
Quoted 3 lines
Quoted 1 line
(GPL-2.0-only OR BSD-2-Clause)
Just curious, is that mandatory for any new bindings?
Yes.
Rob
Re: [V2, 3/3] arm64: dts: sc7180: Add interconnect provider DT nodes
In reply to Odelu KukatlaQuoted 11 lines · Odelu Kukatla
Add the DT nodes for the network-on-chip interconnect buses found on sc7180-based platforms.
--- arch/arm64/boot/dts/qcom/sc7180.dtsi | 96 ++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+)arch/arm64/boot/dts/qcom/sc7180.dtsi +0
-0
arch/arm64/boot/dts/qcom/sc7180.dtsi line 11
Quoted 4 lines
arch/arm64/boot/dts/qcom/sc7180.dtsi +1
-0@@ -8,6 +8,7 @@ #include <dt-bindings/clock/qcom,gcc-sc7180.h> #include <dt-bindings/clock/qcom,rpmh.h> #include <dt-bindings/interrupt-controller/arm-gic.h> +#include <dt-bindings/interconnect/qcom,sc7180.h>
This should be moved one line up if we want to keep the headers sorted.
Quoted 15 lines
arch/arm64/boot/dts/qcom/sc7180.dtsi +4
-0#include <dt-bindings/phy/phy-qcom-qusb2.h> #include <dt-bindings/soc/qcom,rpmh-rsc.h>@@ -1286,6 +1287,10 @@ clock-names = "xo"; #clock-cells = <1>; }; + + apps_bcm_voter: bcm_voter { + compatible = "qcom,sc7180-bcm-voter"; + }; }; cpufreq_hw: cpufreq@18323000 {
arch/arm64/boot/dts/qcom/sc7180.dtsi line 1306
Quoted 4 lines
arch/arm64/boot/dts/qcom/sc7180.dtsi +1
-0@@ -1298,6 +1303,97 @@ #freq-domain-cells = <1>; }; + > + config_noc: interconnect@1500000 {
All DT nodes in this file are ordered by their address. Please move these up to keep it consistent.
Thanks,
Georgi
Re: [V2, 3/3] arm64: dts: sc7180: Add interconnect provider DT nodes
In reply to Odelu KukatlaQuoted 4 lines · Odelu Kukatla
Add the DT nodes for the network-on-chip interconnect buses found on sc7180-based platforms.
---
Hi Odelu,
Are you going to spin this series?
-Evan
Re: [V2, 1/3] dt-bindings: interconnect: Add Qualcomm SC7180 DT bindings
In reply to Rob HerringQuoted 40 lines · Rob Herring
Quoted 35 lines · Odelu Kukatla
The Qualcomm SC7180 platform has several bus fabrics that could be controlled and tuned dynamically according to the bandwidth demand.
Signed-off-by Odelu Kukatla <[email protected]>--- .../bindings/interconnect/qcom,bcm-voter.yaml | 1 + .../bindings/interconnect/qcom,sc7180.yaml | 155 ++++++++++++++++++++ include/dt-bindings/interconnect/qcom,sc7180.h | 161 +++++++++++++++++++++ 3 files changed, 317 insertions(+) create mode 100644 Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml create mode 100644 include/dt-bindings/interconnect/qcom,sc7180.hDocumentation/devicetree/bindings/interconnect/qcom,bcm-voter.yaml +0
-1---
a/Documentation/devicetree/bindings/interconnect/qcom,bcm-voter.yaml
+++b/Documentation/devicetree/bindings/interconnect/qcom,bcm-voter.yamlDocumentation/devicetree/bindings/interconnect/qcom,bcm-voter.yaml +1
-0@@ -19,6 +19,7 @@ description: | properties: compatible: enum: + - qcom,sc7180-bcm-voter - qcom,sdm845-bcm-voter required:Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml new file +0
-0Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml line 1
Quoted 1 line
Documentation/devicetree/bindings/interconnect/qcom,sc7180.yaml new file +1
-0@@ -0,0 +1,155 @@ +# SPDX-License-Identifier: GPL-2.0Dual license new bindings:
Quoted 2 lines
(GPL-2.0-only OR BSD-2-Clause)
Thanks Rob!
I will update it.
Quoted 3 lines
With that,
Reviewed-by Rob Herring <[email protected]>
Re: [V2, 2/3] interconnect: qcom: Add SC7180 interconnect provider driver
In reply to Stephen BoydQuoted 18 lines · Stephen Boyd
Quoting Odelu Kukatla (2019-12-31 00:58:56)
drivers/interconnect/qcom/sc7180.c line 7
Quoted 13 lines
drivers/interconnect/qcom/sc7180.c new file +7
-0@@ -0,0 +1,788 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2019, The Linux Foundation. All rights reserved. +* +*/ + +#include <dt-bindings/interconnect/qcom,sc7180.h> Can you include this after linux/ headers? That is the "preferred" way to include headers.
done.
Quoted 8 lines
drivers/interconnect/qcom/sc7180.c line 12
Quoted 5 lines
drivers/interconnect/qcom/sc7180.c new file +5
-0+#include <linux/device.h> +#include <linux/interconnect.h> +#include <linux/interconnect-provider.h> +#include <linux/module.h> +#include <linux/of_device.h> Hopefully this include isn't used and can be removed.
I will remove it.
Quoted 4 lines
drivers/interconnect/qcom/sc7180.c line 13
Quoted 1 line
drivers/interconnect/qcom/sc7180.c new file +1
-0+#include <linux/of_platform.h> Is this include used?
I will remove it.
Quoted 40 lines
Quoted 5 lines
drivers/interconnect/qcom/sc7180.c new file +5
-0+#include <linux/platform_device.h> + +#include "icc-rpmh.h" +#include "bcm-voter.h" +[...]
Quoted 9 lines
drivers/interconnect/qcom/sc7180.c new file +9
-0+ +static struct qcom_icc_node *system_noc_nodes[] = { + [MASTER_SNOC_CFG ] = &qhm_snoc_cfg, + [MASTER_A1NOC_SNOC ] = &qnm_aggre1_noc, + [MASTER_A2NOC_SNOC ] = &qnm_aggre2_noc, + [MASTER_GEM_NOC_SNOC ] = &qnm_gemnoc, + [MASTER_PIMEM ] = &qxm_pimem, + [SLAVE_APPSS ] = &qhs_apss, + [SLAVE_SNOC_CNOC ] = &qns_cnoc,drivers/interconnect/qcom/sc7180.c line 641
Quoted 10 lines
drivers/interconnect/qcom/sc7180.c new file +10
-0+ [SLAVE_SNOC_GEM_NOC_GC] = &qns_gemnoc_gc, + [SLAVE_SNOC_GEM_NOC_SF] = &qns_gemnoc_sf, + [SLAVE_IMEM] = &qxs_imem, + [SLAVE_PIMEM] = &qxs_pimem, + [SLAVE_SERVICE_SNOC] = &srvc_snoc, + [SLAVE_QDSS_STM] = &xs_qdss_stm, + [SLAVE_TCU] = &xs_sys_tcu_cfg, +}; + +static struct qcom_icc_desc sc7180_system_noc = {Can this be const? And the other ones?
yes, will change it.Quoted 12 lines
drivers/interconnect/qcom/sc7180.c new file +12
-0+ .nodes = system_noc_nodes, + .num_nodes = ARRAY_SIZE(system_noc_nodes), + .bcms = system_noc_bcms, + .num_bcms = ARRAY_SIZE(system_noc_bcms), +}; + +static int qnoc_probe (struct platform_device *pdev) +{ +const struct qcom_icc_desc *desc; +struct icc_onecell_data *data; +struct icc_provider *provider; +struct qcom_icc_node **qnodes;
Quoted 9 lines
drivers/interconnect/qcom/sc7180.c line 659
Quoted 6 lines
drivers/interconnect/qcom/sc7180.c new file +6
-0+struct qcom_icc_provider *qp; +struct icc_node *node; +size_t num_nodes, i; +int ret; + + desc =of_device_get_match_data (&pdev->dev);Use
device_get_match_data()instead?
will update it.
Quoted 135 lines
Quoted 56 lines
drivers/interconnect/qcom/sc7180.c new file +11
-0+if (!desc) +return -EINVAL ; + + qnodes = desc->nodes; + num_nodes = desc->num_nodes; + + qp =devm_kzalloc (&pdev->dev,sizeof (*qp),GFP_KERNEL ); +if (!qp) +return -ENOMEM ; + + data = devm_kcalloc(&pdev->dev, num_nodes, sizeof(*node),
GFP_KERNEL);drivers/interconnect/qcom/sc7180.c new file +23
-0+if (!data) +return -ENOMEM ; + + provider = &qp->provider; + provider->dev = &pdev->dev; + provider->set = qcom_icc_set; + provider->pre_aggregate = qcom_icc_pre_aggregate; + provider->aggregate = qcom_icc_aggregate; + provider->xlate = of_icc_xlate_onecell; +INIT_LIST_HEAD (&provider->nodes); + provider->data = data; + + qp->dev = &pdev->dev; + qp->bcms = desc->bcms; + qp->num_bcms = desc->num_bcms; + + qp->voter =of_bcm_voter_get (qp->dev,NULL ); +if (IS_ERR (qp->voter)) +return PTR_ERR (qp->voter); + + ret =icc_provider_add (provider); +if (ret) { + dev_err(&pdev->dev, "error adding interconnectprovider\n");
drivers/interconnect/qcom/sc7180.c new file +20
-0+return ret; + } + +for (i =0 ; i < num_nodes; i++) { +size_t j; + +if (!qnodes[i]) +continue ; + + node =icc_node_create (qnodes[i]->id); +if (IS_ERR (node)) { + ret =PTR_ERR (node); + goto err; + } + + node->name = qnodes[i]->name; + node->data = qnodes[i]; +icc_node_add (node, provider); + + dev_dbg(&pdev->dev, "registered node %pK %s %d\n",Quoted 2 lines
node,
+ qnodes[i]->name,node->id);Is this more debug junk? Maybe if it is useful it can be part of the core framework instead of in this driver?
drivers/interconnect/qcom/sc7180.c line 716
Quoted 2 lines
drivers/interconnect/qcom/sc7180.c new file +2
-0+ +/* populate links */ Useless comment.
i will clean up this.drivers/interconnect/qcom/sc7180.c line 729
Quoted 13 lines
drivers/interconnect/qcom/sc7180.c new file +13
-0+for (j =0 ; j < qnodes[i]->num_links; j++) +icc_link_create (node, qnodes[i]->links[j]); + + data->nodes[i] = node; + } + data->num_nodes = num_nodes; + +for (i =0 ; i < qp->num_bcms; i++) +qcom_icc_bcm_init (qp->bcms[i], &pdev->dev); + +platform_set_drvdata (pdev, qp); + +dev_dbg (&pdev->dev,"Registered SC7180 ICC\n" );This driver debug message is pretty useless. Please remove it. i will removr it.
drivers/interconnect/qcom/sc7180.c
Quoted 2 lines
drivers/interconnect/qcom/sc7180.c new file +2
-0+ +return ret;return 0?
Quoted 32 lines
drivers/interconnect/qcom/sc7180.c new file +32
-0+err: +icc_nodes_remove (provider); +icc_provider_del (provider); +return ret; +} + +static int qnoc_remove (struct platform_device *pdev) +{ +struct qcom_icc_provider *qp =platform_get_drvdata (pdev); + +icc_nodes_remove (&qp->provider); +return icc_provider_del (&qp->provider); +} + +static const struct of_device_id qnoc_of_match[] = { + { .compatible ="qcom,sc7180-aggre1-noc" , + .data = &sc7180_aggre1_noc}, + { .compatible ="qcom,sc7180-aggre2-noc" , + .data = &sc7180_aggre2_noc}, + { .compatible ="qcom,sc7180-camnoc-virt" , + .data = &sc7180_camnoc_virt}, + { .compatible ="qcom,sc7180-compute-noc" , + .data = &sc7180_compute_noc}, + { .compatible ="qcom,sc7180-config-noc" , + .data = &sc7180_config_noc}, + { .compatible ="qcom,sc7180-dc-noc" , + .data = &sc7180_dc_noc}, + { .compatible ="qcom,sc7180-gem-noc" , + .data = &sc7180_gem_noc}, + { .compatible ="qcom,sc7180-ipa-virt" , + .data = &sc7180_ipa_virt}, + { .compatible ="qcom,sc7180-mc-virt" ,drivers/interconnect/qcom/sc7180.c line 773
Quoted 10 lines
drivers/interconnect/qcom/sc7180.c new file +10
-0+ .data = &sc7180_mc_virt}, + { .compatible = "qcom,sc7180-mmss-noc", + .data = &sc7180_mmss_noc}, + { .compatible = "qcom,sc7180-npu-noc", + .data = &sc7180_npu_noc}, + { .compatible = "qcom,sc7180-qup-virt", + .data = &sc7180_qup_virt}, + { .compatible = "qcom,sc7180-system-noc", + .data = &sc7180_system_noc}, + { },Nitpick: Drop the comma as it's the sentinel and nothing can come after. will remove it.
Quoted 2 lines
drivers/interconnect/qcom/sc7180.c new file +2
-0+}; +MODULE_DEVICE_TABLE (of, qnoc_of_match);