1b5d2f741SDavid Dai // SPDX-License-Identifier: GPL-2.0
2b5d2f741SDavid Dai /*
3aae57773SDavid Dai  * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
4b5d2f741SDavid Dai  */
5b5d2f741SDavid Dai 
6b5d2f741SDavid Dai #include <linux/device.h>
7b5d2f741SDavid Dai #include <linux/interconnect.h>
8b5d2f741SDavid Dai #include <linux/interconnect-provider.h>
9b5d2f741SDavid Dai #include <linux/module.h>
10b5d2f741SDavid Dai #include <linux/of_device.h>
11b5d2f741SDavid Dai 
12aae57773SDavid Dai #include <dt-bindings/interconnect/qcom,sdm845.h>
13b5d2f741SDavid Dai 
14aae57773SDavid Dai #include "bcm-voter.h"
15aae57773SDavid Dai #include "icc-rpmh.h"
1678465b0dSSibi Sankar #include "sdm845.h"
17b5d2f741SDavid Dai 
18aae57773SDavid Dai DEFINE_QNODE(qhm_a1noc_cfg, SDM845_MASTER_A1NOC_CFG, 1, 4, SDM845_SLAVE_SERVICE_A1NOC);
19aae57773SDavid Dai DEFINE_QNODE(qhm_qup1, SDM845_MASTER_BLSP_1, 1, 4, SDM845_SLAVE_A1NOC_SNOC);
20aae57773SDavid Dai DEFINE_QNODE(qhm_tsif, SDM845_MASTER_TSIF, 1, 4, SDM845_SLAVE_A1NOC_SNOC);
21aae57773SDavid Dai DEFINE_QNODE(xm_sdc2, SDM845_MASTER_SDCC_2, 1, 8, SDM845_SLAVE_A1NOC_SNOC);
22aae57773SDavid Dai DEFINE_QNODE(xm_sdc4, SDM845_MASTER_SDCC_4, 1, 8, SDM845_SLAVE_A1NOC_SNOC);
23aae57773SDavid Dai DEFINE_QNODE(xm_ufs_card, SDM845_MASTER_UFS_CARD, 1, 8, SDM845_SLAVE_A1NOC_SNOC);
24aae57773SDavid Dai DEFINE_QNODE(xm_ufs_mem, SDM845_MASTER_UFS_MEM, 1, 8, SDM845_SLAVE_A1NOC_SNOC);
25aae57773SDavid Dai DEFINE_QNODE(xm_pcie_0, SDM845_MASTER_PCIE_0, 1, 8, SDM845_SLAVE_ANOC_PCIE_A1NOC_SNOC);
26aae57773SDavid Dai DEFINE_QNODE(qhm_a2noc_cfg, SDM845_MASTER_A2NOC_CFG, 1, 4, SDM845_SLAVE_SERVICE_A2NOC);
27aae57773SDavid Dai DEFINE_QNODE(qhm_qdss_bam, SDM845_MASTER_QDSS_BAM, 1, 4, SDM845_SLAVE_A2NOC_SNOC);
28aae57773SDavid Dai DEFINE_QNODE(qhm_qup2, SDM845_MASTER_BLSP_2, 1, 4, SDM845_SLAVE_A2NOC_SNOC);
29aae57773SDavid Dai DEFINE_QNODE(qnm_cnoc, SDM845_MASTER_CNOC_A2NOC, 1, 8, SDM845_SLAVE_A2NOC_SNOC);
30aae57773SDavid Dai DEFINE_QNODE(qxm_crypto, SDM845_MASTER_CRYPTO, 1, 8, SDM845_SLAVE_A2NOC_SNOC);
31aae57773SDavid Dai DEFINE_QNODE(qxm_ipa, SDM845_MASTER_IPA, 1, 8, SDM845_SLAVE_A2NOC_SNOC);
32aae57773SDavid Dai DEFINE_QNODE(xm_pcie3_1, SDM845_MASTER_PCIE_1, 1, 8, SDM845_SLAVE_ANOC_PCIE_SNOC);
33aae57773SDavid Dai DEFINE_QNODE(xm_qdss_etr, SDM845_MASTER_QDSS_ETR, 1, 8, SDM845_SLAVE_A2NOC_SNOC);
34aae57773SDavid Dai DEFINE_QNODE(xm_usb3_0, SDM845_MASTER_USB3_0, 1, 8, SDM845_SLAVE_A2NOC_SNOC);
35aae57773SDavid Dai DEFINE_QNODE(xm_usb3_1, SDM845_MASTER_USB3_1, 1, 8, SDM845_SLAVE_A2NOC_SNOC);
36aae57773SDavid Dai DEFINE_QNODE(qxm_camnoc_hf0_uncomp, SDM845_MASTER_CAMNOC_HF0_UNCOMP, 1, 32, SDM845_SLAVE_CAMNOC_UNCOMP);
37aae57773SDavid Dai DEFINE_QNODE(qxm_camnoc_hf1_uncomp, SDM845_MASTER_CAMNOC_HF1_UNCOMP, 1, 32, SDM845_SLAVE_CAMNOC_UNCOMP);
38aae57773SDavid Dai DEFINE_QNODE(qxm_camnoc_sf_uncomp, SDM845_MASTER_CAMNOC_SF_UNCOMP, 1, 32, SDM845_SLAVE_CAMNOC_UNCOMP);
39aae57773SDavid Dai DEFINE_QNODE(qhm_spdm, SDM845_MASTER_SPDM, 1, 4, SDM845_SLAVE_CNOC_A2NOC);
40aae57773SDavid Dai DEFINE_QNODE(qhm_tic, SDM845_MASTER_TIC, 1, 4, SDM845_SLAVE_A1NOC_CFG, SDM845_SLAVE_A2NOC_CFG, SDM845_SLAVE_AOP, SDM845_SLAVE_AOSS, SDM845_SLAVE_CAMERA_CFG, SDM845_SLAVE_CLK_CTL, SDM845_SLAVE_CDSP_CFG, SDM845_SLAVE_RBCPR_CX_CFG, SDM845_SLAVE_CRYPTO_0_CFG, SDM845_SLAVE_DCC_CFG, SDM845_SLAVE_CNOC_DDRSS, SDM845_SLAVE_DISPLAY_CFG, SDM845_SLAVE_GLM, SDM845_SLAVE_GFX3D_CFG, SDM845_SLAVE_IMEM_CFG, SDM845_SLAVE_IPA_CFG, SDM845_SLAVE_CNOC_MNOC_CFG, SDM845_SLAVE_PCIE_0_CFG, SDM845_SLAVE_PCIE_1_CFG, SDM845_SLAVE_PDM, SDM845_SLAVE_SOUTH_PHY_CFG, SDM845_SLAVE_PIMEM_CFG, SDM845_SLAVE_PRNG, SDM845_SLAVE_QDSS_CFG, SDM845_SLAVE_BLSP_2, SDM845_SLAVE_BLSP_1, SDM845_SLAVE_SDCC_2, SDM845_SLAVE_SDCC_4, SDM845_SLAVE_SNOC_CFG, SDM845_SLAVE_SPDM_WRAPPER, SDM845_SLAVE_SPSS_CFG, SDM845_SLAVE_TCSR, SDM845_SLAVE_TLMM_NORTH, SDM845_SLAVE_TLMM_SOUTH, SDM845_SLAVE_TSIF, SDM845_SLAVE_UFS_CARD_CFG, SDM845_SLAVE_UFS_MEM_CFG, SDM845_SLAVE_USB3_0, SDM845_SLAVE_USB3_1, SDM845_SLAVE_VENUS_CFG, SDM845_SLAVE_VSENSE_CTRL_CFG, SDM845_SLAVE_CNOC_A2NOC, SDM845_SLAVE_SERVICE_CNOC);
41aae57773SDavid Dai DEFINE_QNODE(qnm_snoc, SDM845_MASTER_SNOC_CNOC, 1, 8, SDM845_SLAVE_A1NOC_CFG, SDM845_SLAVE_A2NOC_CFG, SDM845_SLAVE_AOP, SDM845_SLAVE_AOSS, SDM845_SLAVE_CAMERA_CFG, SDM845_SLAVE_CLK_CTL, SDM845_SLAVE_CDSP_CFG, SDM845_SLAVE_RBCPR_CX_CFG, SDM845_SLAVE_CRYPTO_0_CFG, SDM845_SLAVE_DCC_CFG, SDM845_SLAVE_CNOC_DDRSS, SDM845_SLAVE_DISPLAY_CFG, SDM845_SLAVE_GLM, SDM845_SLAVE_GFX3D_CFG, SDM845_SLAVE_IMEM_CFG, SDM845_SLAVE_IPA_CFG, SDM845_SLAVE_CNOC_MNOC_CFG, SDM845_SLAVE_PCIE_0_CFG, SDM845_SLAVE_PCIE_1_CFG, SDM845_SLAVE_PDM, SDM845_SLAVE_SOUTH_PHY_CFG, SDM845_SLAVE_PIMEM_CFG, SDM845_SLAVE_PRNG, SDM845_SLAVE_QDSS_CFG, SDM845_SLAVE_BLSP_2, SDM845_SLAVE_BLSP_1, SDM845_SLAVE_SDCC_2, SDM845_SLAVE_SDCC_4, SDM845_SLAVE_SNOC_CFG, SDM845_SLAVE_SPDM_WRAPPER, SDM845_SLAVE_SPSS_CFG, SDM845_SLAVE_TCSR, SDM845_SLAVE_TLMM_NORTH, SDM845_SLAVE_TLMM_SOUTH, SDM845_SLAVE_TSIF, SDM845_SLAVE_UFS_CARD_CFG, SDM845_SLAVE_UFS_MEM_CFG, SDM845_SLAVE_USB3_0, SDM845_SLAVE_USB3_1, SDM845_SLAVE_VENUS_CFG, SDM845_SLAVE_VSENSE_CTRL_CFG, SDM845_SLAVE_SERVICE_CNOC);
42aae57773SDavid Dai DEFINE_QNODE(xm_qdss_dap, SDM845_MASTER_QDSS_DAP, 1, 8, SDM845_SLAVE_A1NOC_CFG, SDM845_SLAVE_A2NOC_CFG, SDM845_SLAVE_AOP, SDM845_SLAVE_AOSS, SDM845_SLAVE_CAMERA_CFG, SDM845_SLAVE_CLK_CTL, SDM845_SLAVE_CDSP_CFG, SDM845_SLAVE_RBCPR_CX_CFG, SDM845_SLAVE_CRYPTO_0_CFG, SDM845_SLAVE_DCC_CFG, SDM845_SLAVE_CNOC_DDRSS, SDM845_SLAVE_DISPLAY_CFG, SDM845_SLAVE_GLM, SDM845_SLAVE_GFX3D_CFG, SDM845_SLAVE_IMEM_CFG, SDM845_SLAVE_IPA_CFG, SDM845_SLAVE_CNOC_MNOC_CFG, SDM845_SLAVE_PCIE_0_CFG, SDM845_SLAVE_PCIE_1_CFG, SDM845_SLAVE_PDM, SDM845_SLAVE_SOUTH_PHY_CFG, SDM845_SLAVE_PIMEM_CFG, SDM845_SLAVE_PRNG, SDM845_SLAVE_QDSS_CFG, SDM845_SLAVE_BLSP_2, SDM845_SLAVE_BLSP_1, SDM845_SLAVE_SDCC_2, SDM845_SLAVE_SDCC_4, SDM845_SLAVE_SNOC_CFG, SDM845_SLAVE_SPDM_WRAPPER, SDM845_SLAVE_SPSS_CFG, SDM845_SLAVE_TCSR, SDM845_SLAVE_TLMM_NORTH, SDM845_SLAVE_TLMM_SOUTH, SDM845_SLAVE_TSIF, SDM845_SLAVE_UFS_CARD_CFG, SDM845_SLAVE_UFS_MEM_CFG, SDM845_SLAVE_USB3_0, SDM845_SLAVE_USB3_1, SDM845_SLAVE_VENUS_CFG, SDM845_SLAVE_VSENSE_CTRL_CFG, SDM845_SLAVE_CNOC_A2NOC, SDM845_SLAVE_SERVICE_CNOC);
43aae57773SDavid Dai DEFINE_QNODE(qhm_cnoc, SDM845_MASTER_CNOC_DC_NOC, 1, 4, SDM845_SLAVE_LLCC_CFG, SDM845_SLAVE_MEM_NOC_CFG);
44aae57773SDavid Dai DEFINE_QNODE(acm_l3, SDM845_MASTER_APPSS_PROC, 1, 16, SDM845_SLAVE_GNOC_SNOC, SDM845_SLAVE_GNOC_MEM_NOC, SDM845_SLAVE_SERVICE_GNOC);
45aae57773SDavid Dai DEFINE_QNODE(pm_gnoc_cfg, SDM845_MASTER_GNOC_CFG, 1, 4, SDM845_SLAVE_SERVICE_GNOC);
46aae57773SDavid Dai DEFINE_QNODE(llcc_mc, SDM845_MASTER_LLCC, 4, 4, SDM845_SLAVE_EBI1);
47aae57773SDavid Dai DEFINE_QNODE(acm_tcu, SDM845_MASTER_TCU_0, 1, 8, SDM845_SLAVE_MEM_NOC_GNOC, SDM845_SLAVE_LLCC, SDM845_SLAVE_MEM_NOC_SNOC);
48aae57773SDavid Dai DEFINE_QNODE(qhm_memnoc_cfg, SDM845_MASTER_MEM_NOC_CFG, 1, 4, SDM845_SLAVE_MSS_PROC_MS_MPU_CFG, SDM845_SLAVE_SERVICE_MEM_NOC);
49aae57773SDavid Dai DEFINE_QNODE(qnm_apps, SDM845_MASTER_GNOC_MEM_NOC, 2, 32, SDM845_SLAVE_LLCC);
50aae57773SDavid Dai DEFINE_QNODE(qnm_mnoc_hf, SDM845_MASTER_MNOC_HF_MEM_NOC, 2, 32, SDM845_SLAVE_MEM_NOC_GNOC, SDM845_SLAVE_LLCC);
51aae57773SDavid Dai DEFINE_QNODE(qnm_mnoc_sf, SDM845_MASTER_MNOC_SF_MEM_NOC, 1, 32, SDM845_SLAVE_MEM_NOC_GNOC, SDM845_SLAVE_LLCC, SDM845_SLAVE_MEM_NOC_SNOC);
52aae57773SDavid Dai DEFINE_QNODE(qnm_snoc_gc, SDM845_MASTER_SNOC_GC_MEM_NOC, 1, 8, SDM845_SLAVE_LLCC);
53aae57773SDavid Dai DEFINE_QNODE(qnm_snoc_sf, SDM845_MASTER_SNOC_SF_MEM_NOC, 1, 16, SDM845_SLAVE_MEM_NOC_GNOC, SDM845_SLAVE_LLCC);
54aae57773SDavid Dai DEFINE_QNODE(qxm_gpu, SDM845_MASTER_GFX3D, 2, 32, SDM845_SLAVE_MEM_NOC_GNOC, SDM845_SLAVE_LLCC, SDM845_SLAVE_MEM_NOC_SNOC);
55aae57773SDavid Dai DEFINE_QNODE(qhm_mnoc_cfg, SDM845_MASTER_CNOC_MNOC_CFG, 1, 4, SDM845_SLAVE_SERVICE_MNOC);
56aae57773SDavid Dai DEFINE_QNODE(qxm_camnoc_hf0, SDM845_MASTER_CAMNOC_HF0, 1, 32, SDM845_SLAVE_MNOC_HF_MEM_NOC);
57aae57773SDavid Dai DEFINE_QNODE(qxm_camnoc_hf1, SDM845_MASTER_CAMNOC_HF1, 1, 32, SDM845_SLAVE_MNOC_HF_MEM_NOC);
58aae57773SDavid Dai DEFINE_QNODE(qxm_camnoc_sf, SDM845_MASTER_CAMNOC_SF, 1, 32, SDM845_SLAVE_MNOC_SF_MEM_NOC);
59aae57773SDavid Dai DEFINE_QNODE(qxm_mdp0, SDM845_MASTER_MDP0, 1, 32, SDM845_SLAVE_MNOC_HF_MEM_NOC);
60aae57773SDavid Dai DEFINE_QNODE(qxm_mdp1, SDM845_MASTER_MDP1, 1, 32, SDM845_SLAVE_MNOC_HF_MEM_NOC);
61aae57773SDavid Dai DEFINE_QNODE(qxm_rot, SDM845_MASTER_ROTATOR, 1, 32, SDM845_SLAVE_MNOC_SF_MEM_NOC);
62aae57773SDavid Dai DEFINE_QNODE(qxm_venus0, SDM845_MASTER_VIDEO_P0, 1, 32, SDM845_SLAVE_MNOC_SF_MEM_NOC);
63aae57773SDavid Dai DEFINE_QNODE(qxm_venus1, SDM845_MASTER_VIDEO_P1, 1, 32, SDM845_SLAVE_MNOC_SF_MEM_NOC);
64aae57773SDavid Dai DEFINE_QNODE(qxm_venus_arm9, SDM845_MASTER_VIDEO_PROC, 1, 8, SDM845_SLAVE_MNOC_SF_MEM_NOC);
65aae57773SDavid Dai DEFINE_QNODE(qhm_snoc_cfg, SDM845_MASTER_SNOC_CFG, 1, 4, SDM845_SLAVE_SERVICE_SNOC);
66aae57773SDavid Dai DEFINE_QNODE(qnm_aggre1_noc, SDM845_MASTER_A1NOC_SNOC, 1, 16, SDM845_SLAVE_APPSS, SDM845_SLAVE_SNOC_CNOC, SDM845_SLAVE_SNOC_MEM_NOC_SF, SDM845_SLAVE_IMEM, SDM845_SLAVE_PIMEM, SDM845_SLAVE_QDSS_STM);
67aae57773SDavid Dai DEFINE_QNODE(qnm_aggre2_noc, SDM845_MASTER_A2NOC_SNOC, 1, 16, SDM845_SLAVE_APPSS, SDM845_SLAVE_SNOC_CNOC, SDM845_SLAVE_SNOC_MEM_NOC_SF, SDM845_SLAVE_IMEM, SDM845_SLAVE_PCIE_0, SDM845_SLAVE_PCIE_1, SDM845_SLAVE_PIMEM, SDM845_SLAVE_QDSS_STM, SDM845_SLAVE_TCU);
68aae57773SDavid Dai DEFINE_QNODE(qnm_gladiator_sodv, SDM845_MASTER_GNOC_SNOC, 1, 8, SDM845_SLAVE_APPSS, SDM845_SLAVE_SNOC_CNOC, SDM845_SLAVE_IMEM, SDM845_SLAVE_PCIE_0, SDM845_SLAVE_PCIE_1, SDM845_SLAVE_PIMEM, SDM845_SLAVE_QDSS_STM, SDM845_SLAVE_TCU);
69aae57773SDavid Dai DEFINE_QNODE(qnm_memnoc, SDM845_MASTER_MEM_NOC_SNOC, 1, 8, SDM845_SLAVE_APPSS, SDM845_SLAVE_SNOC_CNOC, SDM845_SLAVE_IMEM, SDM845_SLAVE_PIMEM, SDM845_SLAVE_QDSS_STM);
70aae57773SDavid Dai DEFINE_QNODE(qnm_pcie_anoc, SDM845_MASTER_ANOC_PCIE_SNOC, 1, 16, SDM845_SLAVE_APPSS, SDM845_SLAVE_SNOC_CNOC, SDM845_SLAVE_SNOC_MEM_NOC_SF, SDM845_SLAVE_IMEM, SDM845_SLAVE_QDSS_STM);
71aae57773SDavid Dai DEFINE_QNODE(qxm_pimem, SDM845_MASTER_PIMEM, 1, 8, SDM845_SLAVE_SNOC_MEM_NOC_GC, SDM845_SLAVE_IMEM);
72aae57773SDavid Dai DEFINE_QNODE(xm_gic, SDM845_MASTER_GIC, 1, 8, SDM845_SLAVE_SNOC_MEM_NOC_GC, SDM845_SLAVE_IMEM);
73aae57773SDavid Dai DEFINE_QNODE(qns_a1noc_snoc, SDM845_SLAVE_A1NOC_SNOC, 1, 16, SDM845_MASTER_A1NOC_SNOC);
74aae57773SDavid Dai DEFINE_QNODE(srvc_aggre1_noc, SDM845_SLAVE_SERVICE_A1NOC, 1, 4, 0);
75aae57773SDavid Dai DEFINE_QNODE(qns_pcie_a1noc_snoc, SDM845_SLAVE_ANOC_PCIE_A1NOC_SNOC, 1, 16, SDM845_MASTER_ANOC_PCIE_SNOC);
76aae57773SDavid Dai DEFINE_QNODE(qns_a2noc_snoc, SDM845_SLAVE_A2NOC_SNOC, 1, 16, SDM845_MASTER_A2NOC_SNOC);
77aae57773SDavid Dai DEFINE_QNODE(qns_pcie_snoc, SDM845_SLAVE_ANOC_PCIE_SNOC, 1, 16, SDM845_MASTER_ANOC_PCIE_SNOC);
78aae57773SDavid Dai DEFINE_QNODE(srvc_aggre2_noc, SDM845_SLAVE_SERVICE_A2NOC, 1, 4);
79aae57773SDavid Dai DEFINE_QNODE(qns_camnoc_uncomp, SDM845_SLAVE_CAMNOC_UNCOMP, 1, 32);
80aae57773SDavid Dai DEFINE_QNODE(qhs_a1_noc_cfg, SDM845_SLAVE_A1NOC_CFG, 1, 4, SDM845_MASTER_A1NOC_CFG);
81aae57773SDavid Dai DEFINE_QNODE(qhs_a2_noc_cfg, SDM845_SLAVE_A2NOC_CFG, 1, 4, SDM845_MASTER_A2NOC_CFG);
82aae57773SDavid Dai DEFINE_QNODE(qhs_aop, SDM845_SLAVE_AOP, 1, 4);
83aae57773SDavid Dai DEFINE_QNODE(qhs_aoss, SDM845_SLAVE_AOSS, 1, 4);
84aae57773SDavid Dai DEFINE_QNODE(qhs_camera_cfg, SDM845_SLAVE_CAMERA_CFG, 1, 4);
85aae57773SDavid Dai DEFINE_QNODE(qhs_clk_ctl, SDM845_SLAVE_CLK_CTL, 1, 4);
86aae57773SDavid Dai DEFINE_QNODE(qhs_compute_dsp_cfg, SDM845_SLAVE_CDSP_CFG, 1, 4);
87aae57773SDavid Dai DEFINE_QNODE(qhs_cpr_cx, SDM845_SLAVE_RBCPR_CX_CFG, 1, 4);
88aae57773SDavid Dai DEFINE_QNODE(qhs_crypto0_cfg, SDM845_SLAVE_CRYPTO_0_CFG, 1, 4);
89aae57773SDavid Dai DEFINE_QNODE(qhs_dcc_cfg, SDM845_SLAVE_DCC_CFG, 1, 4, SDM845_MASTER_CNOC_DC_NOC);
90aae57773SDavid Dai DEFINE_QNODE(qhs_ddrss_cfg, SDM845_SLAVE_CNOC_DDRSS, 1, 4);
91aae57773SDavid Dai DEFINE_QNODE(qhs_display_cfg, SDM845_SLAVE_DISPLAY_CFG, 1, 4);
92aae57773SDavid Dai DEFINE_QNODE(qhs_glm, SDM845_SLAVE_GLM, 1, 4);
93aae57773SDavid Dai DEFINE_QNODE(qhs_gpuss_cfg, SDM845_SLAVE_GFX3D_CFG, 1, 8);
94aae57773SDavid Dai DEFINE_QNODE(qhs_imem_cfg, SDM845_SLAVE_IMEM_CFG, 1, 4);
95aae57773SDavid Dai DEFINE_QNODE(qhs_ipa, SDM845_SLAVE_IPA_CFG, 1, 4);
96aae57773SDavid Dai DEFINE_QNODE(qhs_mnoc_cfg, SDM845_SLAVE_CNOC_MNOC_CFG, 1, 4, SDM845_MASTER_CNOC_MNOC_CFG);
97aae57773SDavid Dai DEFINE_QNODE(qhs_pcie0_cfg, SDM845_SLAVE_PCIE_0_CFG, 1, 4);
98aae57773SDavid Dai DEFINE_QNODE(qhs_pcie_gen3_cfg, SDM845_SLAVE_PCIE_1_CFG, 1, 4);
99aae57773SDavid Dai DEFINE_QNODE(qhs_pdm, SDM845_SLAVE_PDM, 1, 4);
100aae57773SDavid Dai DEFINE_QNODE(qhs_phy_refgen_south, SDM845_SLAVE_SOUTH_PHY_CFG, 1, 4);
101aae57773SDavid Dai DEFINE_QNODE(qhs_pimem_cfg, SDM845_SLAVE_PIMEM_CFG, 1, 4);
102aae57773SDavid Dai DEFINE_QNODE(qhs_prng, SDM845_SLAVE_PRNG, 1, 4);
103aae57773SDavid Dai DEFINE_QNODE(qhs_qdss_cfg, SDM845_SLAVE_QDSS_CFG, 1, 4);
104aae57773SDavid Dai DEFINE_QNODE(qhs_qupv3_north, SDM845_SLAVE_BLSP_2, 1, 4);
105aae57773SDavid Dai DEFINE_QNODE(qhs_qupv3_south, SDM845_SLAVE_BLSP_1, 1, 4);
106aae57773SDavid Dai DEFINE_QNODE(qhs_sdc2, SDM845_SLAVE_SDCC_2, 1, 4);
107aae57773SDavid Dai DEFINE_QNODE(qhs_sdc4, SDM845_SLAVE_SDCC_4, 1, 4);
108aae57773SDavid Dai DEFINE_QNODE(qhs_snoc_cfg, SDM845_SLAVE_SNOC_CFG, 1, 4, SDM845_MASTER_SNOC_CFG);
109aae57773SDavid Dai DEFINE_QNODE(qhs_spdm, SDM845_SLAVE_SPDM_WRAPPER, 1, 4);
110aae57773SDavid Dai DEFINE_QNODE(qhs_spss_cfg, SDM845_SLAVE_SPSS_CFG, 1, 4);
111aae57773SDavid Dai DEFINE_QNODE(qhs_tcsr, SDM845_SLAVE_TCSR, 1, 4);
112aae57773SDavid Dai DEFINE_QNODE(qhs_tlmm_north, SDM845_SLAVE_TLMM_NORTH, 1, 4);
113aae57773SDavid Dai DEFINE_QNODE(qhs_tlmm_south, SDM845_SLAVE_TLMM_SOUTH, 1, 4);
114aae57773SDavid Dai DEFINE_QNODE(qhs_tsif, SDM845_SLAVE_TSIF, 1, 4);
115aae57773SDavid Dai DEFINE_QNODE(qhs_ufs_card_cfg, SDM845_SLAVE_UFS_CARD_CFG, 1, 4);
116aae57773SDavid Dai DEFINE_QNODE(qhs_ufs_mem_cfg, SDM845_SLAVE_UFS_MEM_CFG, 1, 4);
117aae57773SDavid Dai DEFINE_QNODE(qhs_usb3_0, SDM845_SLAVE_USB3_0, 1, 4);
118aae57773SDavid Dai DEFINE_QNODE(qhs_usb3_1, SDM845_SLAVE_USB3_1, 1, 4);
119aae57773SDavid Dai DEFINE_QNODE(qhs_venus_cfg, SDM845_SLAVE_VENUS_CFG, 1, 4);
120aae57773SDavid Dai DEFINE_QNODE(qhs_vsense_ctrl_cfg, SDM845_SLAVE_VSENSE_CTRL_CFG, 1, 4);
121aae57773SDavid Dai DEFINE_QNODE(qns_cnoc_a2noc, SDM845_SLAVE_CNOC_A2NOC, 1, 8, SDM845_MASTER_CNOC_A2NOC);
122aae57773SDavid Dai DEFINE_QNODE(srvc_cnoc, SDM845_SLAVE_SERVICE_CNOC, 1, 4);
123aae57773SDavid Dai DEFINE_QNODE(qhs_llcc, SDM845_SLAVE_LLCC_CFG, 1, 4);
124aae57773SDavid Dai DEFINE_QNODE(qhs_memnoc, SDM845_SLAVE_MEM_NOC_CFG, 1, 4, SDM845_MASTER_MEM_NOC_CFG);
125aae57773SDavid Dai DEFINE_QNODE(qns_gladiator_sodv, SDM845_SLAVE_GNOC_SNOC, 1, 8, SDM845_MASTER_GNOC_SNOC);
126aae57773SDavid Dai DEFINE_QNODE(qns_gnoc_memnoc, SDM845_SLAVE_GNOC_MEM_NOC, 2, 32, SDM845_MASTER_GNOC_MEM_NOC);
127aae57773SDavid Dai DEFINE_QNODE(srvc_gnoc, SDM845_SLAVE_SERVICE_GNOC, 1, 4);
128aae57773SDavid Dai DEFINE_QNODE(ebi, SDM845_SLAVE_EBI1, 4, 4);
129aae57773SDavid Dai DEFINE_QNODE(qhs_mdsp_ms_mpu_cfg, SDM845_SLAVE_MSS_PROC_MS_MPU_CFG, 1, 4);
130aae57773SDavid Dai DEFINE_QNODE(qns_apps_io, SDM845_SLAVE_MEM_NOC_GNOC, 1, 32);
131aae57773SDavid Dai DEFINE_QNODE(qns_llcc, SDM845_SLAVE_LLCC, 4, 16, SDM845_MASTER_LLCC);
132aae57773SDavid Dai DEFINE_QNODE(qns_memnoc_snoc, SDM845_SLAVE_MEM_NOC_SNOC, 1, 8, SDM845_MASTER_MEM_NOC_SNOC);
133aae57773SDavid Dai DEFINE_QNODE(srvc_memnoc, SDM845_SLAVE_SERVICE_MEM_NOC, 1, 4);
134aae57773SDavid Dai DEFINE_QNODE(qns2_mem_noc, SDM845_SLAVE_MNOC_SF_MEM_NOC, 1, 32, SDM845_MASTER_MNOC_SF_MEM_NOC);
135aae57773SDavid Dai DEFINE_QNODE(qns_mem_noc_hf, SDM845_SLAVE_MNOC_HF_MEM_NOC, 2, 32, SDM845_MASTER_MNOC_HF_MEM_NOC);
136aae57773SDavid Dai DEFINE_QNODE(srvc_mnoc, SDM845_SLAVE_SERVICE_MNOC, 1, 4);
137aae57773SDavid Dai DEFINE_QNODE(qhs_apss, SDM845_SLAVE_APPSS, 1, 8);
138aae57773SDavid Dai DEFINE_QNODE(qns_cnoc, SDM845_SLAVE_SNOC_CNOC, 1, 8, SDM845_MASTER_SNOC_CNOC);
139aae57773SDavid Dai DEFINE_QNODE(qns_memnoc_gc, SDM845_SLAVE_SNOC_MEM_NOC_GC, 1, 8, SDM845_MASTER_SNOC_GC_MEM_NOC);
140aae57773SDavid Dai DEFINE_QNODE(qns_memnoc_sf, SDM845_SLAVE_SNOC_MEM_NOC_SF, 1, 16, SDM845_MASTER_SNOC_SF_MEM_NOC);
141aae57773SDavid Dai DEFINE_QNODE(qxs_imem, SDM845_SLAVE_IMEM, 1, 8);
142aae57773SDavid Dai DEFINE_QNODE(qxs_pcie, SDM845_SLAVE_PCIE_0, 1, 8);
143aae57773SDavid Dai DEFINE_QNODE(qxs_pcie_gen3, SDM845_SLAVE_PCIE_1, 1, 8);
144aae57773SDavid Dai DEFINE_QNODE(qxs_pimem, SDM845_SLAVE_PIMEM, 1, 8);
145aae57773SDavid Dai DEFINE_QNODE(srvc_snoc, SDM845_SLAVE_SERVICE_SNOC, 1, 4);
146aae57773SDavid Dai DEFINE_QNODE(xs_qdss_stm, SDM845_SLAVE_QDSS_STM, 1, 4);
147aae57773SDavid Dai DEFINE_QNODE(xs_sys_tcu_cfg, SDM845_SLAVE_TCU, 1, 8);
148aae57773SDavid Dai 
149aae57773SDavid Dai DEFINE_QBCM(bcm_acv, "ACV", false, &ebi);
150aae57773SDavid Dai DEFINE_QBCM(bcm_mc0, "MC0", true, &ebi);
151aae57773SDavid Dai DEFINE_QBCM(bcm_sh0, "SH0", true, &qns_llcc);
152aae57773SDavid Dai DEFINE_QBCM(bcm_mm0, "MM0", false, &qns_mem_noc_hf);
153aae57773SDavid Dai DEFINE_QBCM(bcm_sh1, "SH1", false, &qns_apps_io);
1545be1805dSGeorgi Djakov DEFINE_QBCM(bcm_mm1, "MM1", true, &qxm_camnoc_hf0_uncomp, &qxm_camnoc_hf1_uncomp, &qxm_camnoc_sf_uncomp, &qxm_camnoc_hf0, &qxm_camnoc_hf1, &qxm_mdp0, &qxm_mdp1);
155aae57773SDavid Dai DEFINE_QBCM(bcm_sh2, "SH2", false, &qns_memnoc_snoc);
156aae57773SDavid Dai DEFINE_QBCM(bcm_mm2, "MM2", false, &qns2_mem_noc);
157aae57773SDavid Dai DEFINE_QBCM(bcm_sh3, "SH3", false, &acm_tcu);
158aae57773SDavid Dai DEFINE_QBCM(bcm_mm3, "MM3", false, &qxm_camnoc_sf, &qxm_rot, &qxm_venus0, &qxm_venus1, &qxm_venus_arm9);
159aae57773SDavid Dai DEFINE_QBCM(bcm_sh5, "SH5", false, &qnm_apps);
160aae57773SDavid Dai DEFINE_QBCM(bcm_sn0, "SN0", true, &qns_memnoc_sf);
161aae57773SDavid Dai DEFINE_QBCM(bcm_ce0, "CE0", false, &qxm_crypto);
162aae57773SDavid Dai DEFINE_QBCM(bcm_cn0, "CN0", false, &qhm_spdm, &qhm_tic, &qnm_snoc, &xm_qdss_dap, &qhs_a1_noc_cfg, &qhs_a2_noc_cfg, &qhs_aop, &qhs_aoss, &qhs_camera_cfg, &qhs_clk_ctl, &qhs_compute_dsp_cfg, &qhs_cpr_cx, &qhs_crypto0_cfg, &qhs_dcc_cfg, &qhs_ddrss_cfg, &qhs_display_cfg, &qhs_glm, &qhs_gpuss_cfg, &qhs_imem_cfg, &qhs_ipa, &qhs_mnoc_cfg, &qhs_pcie0_cfg, &qhs_pcie_gen3_cfg, &qhs_pdm, &qhs_phy_refgen_south, &qhs_pimem_cfg, &qhs_prng, &qhs_qdss_cfg, &qhs_qupv3_north, &qhs_qupv3_south, &qhs_sdc2, &qhs_sdc4, &qhs_snoc_cfg, &qhs_spdm, &qhs_spss_cfg, &qhs_tcsr, &qhs_tlmm_north, &qhs_tlmm_south, &qhs_tsif, &qhs_ufs_card_cfg, &qhs_ufs_mem_cfg, &qhs_usb3_0, &qhs_usb3_1, &qhs_venus_cfg, &qhs_vsense_ctrl_cfg, &qns_cnoc_a2noc, &srvc_cnoc);
163aae57773SDavid Dai DEFINE_QBCM(bcm_qup0, "QUP0", false, &qhm_qup1, &qhm_qup2);
164aae57773SDavid Dai DEFINE_QBCM(bcm_sn1, "SN1", false, &qxs_imem);
165aae57773SDavid Dai DEFINE_QBCM(bcm_sn2, "SN2", false, &qns_memnoc_gc);
166aae57773SDavid Dai DEFINE_QBCM(bcm_sn3, "SN3", false, &qns_cnoc);
167aae57773SDavid Dai DEFINE_QBCM(bcm_sn4, "SN4", false, &qxm_pimem);
168aae57773SDavid Dai DEFINE_QBCM(bcm_sn5, "SN5", false, &xs_qdss_stm);
169aae57773SDavid Dai DEFINE_QBCM(bcm_sn6, "SN6", false, &qhs_apss, &srvc_snoc, &xs_sys_tcu_cfg);
170aae57773SDavid Dai DEFINE_QBCM(bcm_sn7, "SN7", false, &qxs_pcie);
171aae57773SDavid Dai DEFINE_QBCM(bcm_sn8, "SN8", false, &qxs_pcie_gen3);
172aae57773SDavid Dai DEFINE_QBCM(bcm_sn9, "SN9", false, &srvc_aggre1_noc, &qnm_aggre1_noc);
173aae57773SDavid Dai DEFINE_QBCM(bcm_sn11, "SN11", false, &srvc_aggre2_noc, &qnm_aggre2_noc);
174aae57773SDavid Dai DEFINE_QBCM(bcm_sn12, "SN12", false, &qnm_gladiator_sodv, &xm_gic);
175aae57773SDavid Dai DEFINE_QBCM(bcm_sn14, "SN14", false, &qnm_pcie_anoc);
176aae57773SDavid Dai DEFINE_QBCM(bcm_sn15, "SN15", false, &qnm_memnoc);
177aae57773SDavid Dai 
178aae57773SDavid Dai static struct qcom_icc_bcm *aggre1_noc_bcms[] = {
179aae57773SDavid Dai 	&bcm_sn9,
180b5d2f741SDavid Dai };
181b5d2f741SDavid Dai 
182aae57773SDavid Dai static struct qcom_icc_node *aggre1_noc_nodes[] = {
183b5d2f741SDavid Dai 	[MASTER_A1NOC_CFG] = &qhm_a1noc_cfg,
184b5d2f741SDavid Dai 	[MASTER_TSIF] = &qhm_tsif,
185b5d2f741SDavid Dai 	[MASTER_SDCC_2] = &xm_sdc2,
186b5d2f741SDavid Dai 	[MASTER_SDCC_4] = &xm_sdc4,
187b5d2f741SDavid Dai 	[MASTER_UFS_CARD] = &xm_ufs_card,
188b5d2f741SDavid Dai 	[MASTER_UFS_MEM] = &xm_ufs_mem,
189aae57773SDavid Dai 	[MASTER_PCIE_0] = &xm_pcie_0,
190aae57773SDavid Dai 	[SLAVE_A1NOC_SNOC] = &qns_a1noc_snoc,
191aae57773SDavid Dai 	[SLAVE_SERVICE_A1NOC] = &srvc_aggre1_noc,
192aae57773SDavid Dai 	[SLAVE_ANOC_PCIE_A1NOC_SNOC] = &qns_pcie_a1noc_snoc,
193aae57773SDavid Dai };
194aae57773SDavid Dai 
1955409e0ccSChenTao static const struct qcom_icc_desc sdm845_aggre1_noc = {
196aae57773SDavid Dai 	.nodes = aggre1_noc_nodes,
197aae57773SDavid Dai 	.num_nodes = ARRAY_SIZE(aggre1_noc_nodes),
198aae57773SDavid Dai 	.bcms = aggre1_noc_bcms,
199aae57773SDavid Dai 	.num_bcms = ARRAY_SIZE(aggre1_noc_bcms),
200aae57773SDavid Dai };
201aae57773SDavid Dai 
202aae57773SDavid Dai static struct qcom_icc_bcm *aggre2_noc_bcms[] = {
203aae57773SDavid Dai 	&bcm_ce0,
204aae57773SDavid Dai 	&bcm_sn11,
205aae57773SDavid Dai 	&bcm_qup0,
206aae57773SDavid Dai };
207aae57773SDavid Dai 
208aae57773SDavid Dai static struct qcom_icc_node *aggre2_noc_nodes[] = {
209aae57773SDavid Dai 	[MASTER_A2NOC_CFG] = &qhm_a2noc_cfg,
210aae57773SDavid Dai 	[MASTER_QDSS_BAM] = &qhm_qdss_bam,
211aae57773SDavid Dai 	[MASTER_CNOC_A2NOC] = &qnm_cnoc,
212aae57773SDavid Dai 	[MASTER_CRYPTO] = &qxm_crypto,
213aae57773SDavid Dai 	[MASTER_IPA] = &qxm_ipa,
214aae57773SDavid Dai 	[MASTER_PCIE_1] = &xm_pcie3_1,
215aae57773SDavid Dai 	[MASTER_QDSS_ETR] = &xm_qdss_etr,
216b5d2f741SDavid Dai 	[MASTER_USB3_0] = &xm_usb3_0,
217b5d2f741SDavid Dai 	[MASTER_USB3_1] = &xm_usb3_1,
218aae57773SDavid Dai 	[SLAVE_A2NOC_SNOC] = &qns_a2noc_snoc,
219aae57773SDavid Dai 	[SLAVE_ANOC_PCIE_SNOC] = &qns_pcie_snoc,
220aae57773SDavid Dai 	[SLAVE_SERVICE_A2NOC] = &srvc_aggre2_noc,
221aae57773SDavid Dai };
222aae57773SDavid Dai 
2235409e0ccSChenTao static const struct qcom_icc_desc sdm845_aggre2_noc = {
224aae57773SDavid Dai 	.nodes = aggre2_noc_nodes,
225aae57773SDavid Dai 	.num_nodes = ARRAY_SIZE(aggre2_noc_nodes),
226aae57773SDavid Dai 	.bcms = aggre2_noc_bcms,
227aae57773SDavid Dai 	.num_bcms = ARRAY_SIZE(aggre2_noc_bcms),
228aae57773SDavid Dai };
229aae57773SDavid Dai 
230aae57773SDavid Dai static struct qcom_icc_bcm *config_noc_bcms[] = {
231aae57773SDavid Dai 	&bcm_cn0,
232aae57773SDavid Dai };
233aae57773SDavid Dai 
234aae57773SDavid Dai static struct qcom_icc_node *config_noc_nodes[] = {
235aae57773SDavid Dai 	[MASTER_SPDM] = &qhm_spdm,
236aae57773SDavid Dai 	[MASTER_TIC] = &qhm_tic,
237aae57773SDavid Dai 	[MASTER_SNOC_CNOC] = &qnm_snoc,
238aae57773SDavid Dai 	[MASTER_QDSS_DAP] = &xm_qdss_dap,
239b5d2f741SDavid Dai 	[SLAVE_A1NOC_CFG] = &qhs_a1_noc_cfg,
240b5d2f741SDavid Dai 	[SLAVE_A2NOC_CFG] = &qhs_a2_noc_cfg,
241b5d2f741SDavid Dai 	[SLAVE_AOP] = &qhs_aop,
242b5d2f741SDavid Dai 	[SLAVE_AOSS] = &qhs_aoss,
243b5d2f741SDavid Dai 	[SLAVE_CAMERA_CFG] = &qhs_camera_cfg,
244b5d2f741SDavid Dai 	[SLAVE_CLK_CTL] = &qhs_clk_ctl,
245b5d2f741SDavid Dai 	[SLAVE_CDSP_CFG] = &qhs_compute_dsp_cfg,
246b5d2f741SDavid Dai 	[SLAVE_RBCPR_CX_CFG] = &qhs_cpr_cx,
247b5d2f741SDavid Dai 	[SLAVE_CRYPTO_0_CFG] = &qhs_crypto0_cfg,
248b5d2f741SDavid Dai 	[SLAVE_DCC_CFG] = &qhs_dcc_cfg,
249b5d2f741SDavid Dai 	[SLAVE_CNOC_DDRSS] = &qhs_ddrss_cfg,
250b5d2f741SDavid Dai 	[SLAVE_DISPLAY_CFG] = &qhs_display_cfg,
251b5d2f741SDavid Dai 	[SLAVE_GLM] = &qhs_glm,
252b5d2f741SDavid Dai 	[SLAVE_GFX3D_CFG] = &qhs_gpuss_cfg,
253b5d2f741SDavid Dai 	[SLAVE_IMEM_CFG] = &qhs_imem_cfg,
254b5d2f741SDavid Dai 	[SLAVE_IPA_CFG] = &qhs_ipa,
255b5d2f741SDavid Dai 	[SLAVE_CNOC_MNOC_CFG] = &qhs_mnoc_cfg,
256b5d2f741SDavid Dai 	[SLAVE_PCIE_0_CFG] = &qhs_pcie0_cfg,
257b5d2f741SDavid Dai 	[SLAVE_PCIE_1_CFG] = &qhs_pcie_gen3_cfg,
258b5d2f741SDavid Dai 	[SLAVE_PDM] = &qhs_pdm,
259b5d2f741SDavid Dai 	[SLAVE_SOUTH_PHY_CFG] = &qhs_phy_refgen_south,
260b5d2f741SDavid Dai 	[SLAVE_PIMEM_CFG] = &qhs_pimem_cfg,
261b5d2f741SDavid Dai 	[SLAVE_PRNG] = &qhs_prng,
262b5d2f741SDavid Dai 	[SLAVE_QDSS_CFG] = &qhs_qdss_cfg,
263b5d2f741SDavid Dai 	[SLAVE_BLSP_2] = &qhs_qupv3_north,
264b5d2f741SDavid Dai 	[SLAVE_BLSP_1] = &qhs_qupv3_south,
265b5d2f741SDavid Dai 	[SLAVE_SDCC_2] = &qhs_sdc2,
266b5d2f741SDavid Dai 	[SLAVE_SDCC_4] = &qhs_sdc4,
267b5d2f741SDavid Dai 	[SLAVE_SNOC_CFG] = &qhs_snoc_cfg,
268b5d2f741SDavid Dai 	[SLAVE_SPDM_WRAPPER] = &qhs_spdm,
269b5d2f741SDavid Dai 	[SLAVE_SPSS_CFG] = &qhs_spss_cfg,
270b5d2f741SDavid Dai 	[SLAVE_TCSR] = &qhs_tcsr,
271b5d2f741SDavid Dai 	[SLAVE_TLMM_NORTH] = &qhs_tlmm_north,
272b5d2f741SDavid Dai 	[SLAVE_TLMM_SOUTH] = &qhs_tlmm_south,
273b5d2f741SDavid Dai 	[SLAVE_TSIF] = &qhs_tsif,
274b5d2f741SDavid Dai 	[SLAVE_UFS_CARD_CFG] = &qhs_ufs_card_cfg,
275b5d2f741SDavid Dai 	[SLAVE_UFS_MEM_CFG] = &qhs_ufs_mem_cfg,
276b5d2f741SDavid Dai 	[SLAVE_USB3_0] = &qhs_usb3_0,
277b5d2f741SDavid Dai 	[SLAVE_USB3_1] = &qhs_usb3_1,
278b5d2f741SDavid Dai 	[SLAVE_VENUS_CFG] = &qhs_venus_cfg,
279b5d2f741SDavid Dai 	[SLAVE_VSENSE_CTRL_CFG] = &qhs_vsense_ctrl_cfg,
280b5d2f741SDavid Dai 	[SLAVE_CNOC_A2NOC] = &qns_cnoc_a2noc,
281b5d2f741SDavid Dai 	[SLAVE_SERVICE_CNOC] = &srvc_cnoc,
282b5d2f741SDavid Dai };
283b5d2f741SDavid Dai 
2845409e0ccSChenTao static const struct qcom_icc_desc sdm845_config_noc = {
285aae57773SDavid Dai 	.nodes = config_noc_nodes,
286aae57773SDavid Dai 	.num_nodes = ARRAY_SIZE(config_noc_nodes),
287aae57773SDavid Dai 	.bcms = config_noc_bcms,
288aae57773SDavid Dai 	.num_bcms = ARRAY_SIZE(config_noc_bcms),
289aae57773SDavid Dai };
290aae57773SDavid Dai 
291aae57773SDavid Dai static struct qcom_icc_bcm *dc_noc_bcms[] = {
292aae57773SDavid Dai };
293aae57773SDavid Dai 
294aae57773SDavid Dai static struct qcom_icc_node *dc_noc_nodes[] = {
295aae57773SDavid Dai 	[MASTER_CNOC_DC_NOC] = &qhm_cnoc,
296aae57773SDavid Dai 	[SLAVE_LLCC_CFG] = &qhs_llcc,
297aae57773SDavid Dai 	[SLAVE_MEM_NOC_CFG] = &qhs_memnoc,
298aae57773SDavid Dai };
299aae57773SDavid Dai 
3005409e0ccSChenTao static const struct qcom_icc_desc sdm845_dc_noc = {
301aae57773SDavid Dai 	.nodes = dc_noc_nodes,
302aae57773SDavid Dai 	.num_nodes = ARRAY_SIZE(dc_noc_nodes),
303aae57773SDavid Dai 	.bcms = dc_noc_bcms,
304aae57773SDavid Dai 	.num_bcms = ARRAY_SIZE(dc_noc_bcms),
305aae57773SDavid Dai };
306aae57773SDavid Dai 
307aae57773SDavid Dai static struct qcom_icc_bcm *gladiator_noc_bcms[] = {
308aae57773SDavid Dai };
309aae57773SDavid Dai 
310aae57773SDavid Dai static struct qcom_icc_node *gladiator_noc_nodes[] = {
311aae57773SDavid Dai 	[MASTER_APPSS_PROC] = &acm_l3,
312aae57773SDavid Dai 	[MASTER_GNOC_CFG] = &pm_gnoc_cfg,
313aae57773SDavid Dai 	[SLAVE_GNOC_SNOC] = &qns_gladiator_sodv,
314aae57773SDavid Dai 	[SLAVE_GNOC_MEM_NOC] = &qns_gnoc_memnoc,
315aae57773SDavid Dai 	[SLAVE_SERVICE_GNOC] = &srvc_gnoc,
316aae57773SDavid Dai };
317aae57773SDavid Dai 
3185409e0ccSChenTao static const struct qcom_icc_desc sdm845_gladiator_noc = {
319aae57773SDavid Dai 	.nodes = gladiator_noc_nodes,
320aae57773SDavid Dai 	.num_nodes = ARRAY_SIZE(gladiator_noc_nodes),
321aae57773SDavid Dai 	.bcms = gladiator_noc_bcms,
322aae57773SDavid Dai 	.num_bcms = ARRAY_SIZE(gladiator_noc_bcms),
323aae57773SDavid Dai };
324aae57773SDavid Dai 
325aae57773SDavid Dai static struct qcom_icc_bcm *mem_noc_bcms[] = {
326b5d2f741SDavid Dai 	&bcm_mc0,
327aae57773SDavid Dai 	&bcm_acv,
328b5d2f741SDavid Dai 	&bcm_sh0,
329b5d2f741SDavid Dai 	&bcm_sh1,
330b5d2f741SDavid Dai 	&bcm_sh2,
331b5d2f741SDavid Dai 	&bcm_sh3,
332b5d2f741SDavid Dai 	&bcm_sh5,
333aae57773SDavid Dai };
334aae57773SDavid Dai 
335aae57773SDavid Dai static struct qcom_icc_node *mem_noc_nodes[] = {
336aae57773SDavid Dai 	[MASTER_TCU_0] = &acm_tcu,
337aae57773SDavid Dai 	[MASTER_MEM_NOC_CFG] = &qhm_memnoc_cfg,
338aae57773SDavid Dai 	[MASTER_GNOC_MEM_NOC] = &qnm_apps,
339aae57773SDavid Dai 	[MASTER_MNOC_HF_MEM_NOC] = &qnm_mnoc_hf,
340aae57773SDavid Dai 	[MASTER_MNOC_SF_MEM_NOC] = &qnm_mnoc_sf,
341aae57773SDavid Dai 	[MASTER_SNOC_GC_MEM_NOC] = &qnm_snoc_gc,
342aae57773SDavid Dai 	[MASTER_SNOC_SF_MEM_NOC] = &qnm_snoc_sf,
343aae57773SDavid Dai 	[MASTER_GFX3D] = &qxm_gpu,
344aae57773SDavid Dai 	[SLAVE_MSS_PROC_MS_MPU_CFG] = &qhs_mdsp_ms_mpu_cfg,
345aae57773SDavid Dai 	[SLAVE_MEM_NOC_GNOC] = &qns_apps_io,
346aae57773SDavid Dai 	[SLAVE_LLCC] = &qns_llcc,
347aae57773SDavid Dai 	[SLAVE_MEM_NOC_SNOC] = &qns_memnoc_snoc,
348aae57773SDavid Dai 	[SLAVE_SERVICE_MEM_NOC] = &srvc_memnoc,
349aae57773SDavid Dai 	[MASTER_LLCC] = &llcc_mc,
350aae57773SDavid Dai 	[SLAVE_EBI1] = &ebi,
351aae57773SDavid Dai };
352aae57773SDavid Dai 
3535409e0ccSChenTao static const struct qcom_icc_desc sdm845_mem_noc = {
354aae57773SDavid Dai 	.nodes = mem_noc_nodes,
355aae57773SDavid Dai 	.num_nodes = ARRAY_SIZE(mem_noc_nodes),
356aae57773SDavid Dai 	.bcms = mem_noc_bcms,
357aae57773SDavid Dai 	.num_bcms = ARRAY_SIZE(mem_noc_bcms),
358aae57773SDavid Dai };
359aae57773SDavid Dai 
360aae57773SDavid Dai static struct qcom_icc_bcm *mmss_noc_bcms[] = {
361aae57773SDavid Dai 	&bcm_mm0,
362aae57773SDavid Dai 	&bcm_mm1,
363aae57773SDavid Dai 	&bcm_mm2,
364aae57773SDavid Dai 	&bcm_mm3,
365aae57773SDavid Dai };
366aae57773SDavid Dai 
367aae57773SDavid Dai static struct qcom_icc_node *mmss_noc_nodes[] = {
368aae57773SDavid Dai 	[MASTER_CNOC_MNOC_CFG] = &qhm_mnoc_cfg,
369aae57773SDavid Dai 	[MASTER_CAMNOC_HF0] = &qxm_camnoc_hf0,
370aae57773SDavid Dai 	[MASTER_CAMNOC_HF1] = &qxm_camnoc_hf1,
371aae57773SDavid Dai 	[MASTER_CAMNOC_SF] = &qxm_camnoc_sf,
372aae57773SDavid Dai 	[MASTER_MDP0] = &qxm_mdp0,
373aae57773SDavid Dai 	[MASTER_MDP1] = &qxm_mdp1,
374aae57773SDavid Dai 	[MASTER_ROTATOR] = &qxm_rot,
375aae57773SDavid Dai 	[MASTER_VIDEO_P0] = &qxm_venus0,
376aae57773SDavid Dai 	[MASTER_VIDEO_P1] = &qxm_venus1,
377aae57773SDavid Dai 	[MASTER_VIDEO_PROC] = &qxm_venus_arm9,
378aae57773SDavid Dai 	[SLAVE_MNOC_SF_MEM_NOC] = &qns2_mem_noc,
379aae57773SDavid Dai 	[SLAVE_MNOC_HF_MEM_NOC] = &qns_mem_noc_hf,
380aae57773SDavid Dai 	[SLAVE_SERVICE_MNOC] = &srvc_mnoc,
381aae57773SDavid Dai 	[MASTER_CAMNOC_HF0_UNCOMP] = &qxm_camnoc_hf0_uncomp,
382aae57773SDavid Dai 	[MASTER_CAMNOC_HF1_UNCOMP] = &qxm_camnoc_hf1_uncomp,
383aae57773SDavid Dai 	[MASTER_CAMNOC_SF_UNCOMP] = &qxm_camnoc_sf_uncomp,
384aae57773SDavid Dai 	[SLAVE_CAMNOC_UNCOMP] = &qns_camnoc_uncomp,
385aae57773SDavid Dai };
386aae57773SDavid Dai 
3875409e0ccSChenTao static const struct qcom_icc_desc sdm845_mmss_noc = {
388aae57773SDavid Dai 	.nodes = mmss_noc_nodes,
389aae57773SDavid Dai 	.num_nodes = ARRAY_SIZE(mmss_noc_nodes),
390aae57773SDavid Dai 	.bcms = mmss_noc_bcms,
391aae57773SDavid Dai 	.num_bcms = ARRAY_SIZE(mmss_noc_bcms),
392aae57773SDavid Dai };
393aae57773SDavid Dai 
394aae57773SDavid Dai static struct qcom_icc_bcm *system_noc_bcms[] = {
395b5d2f741SDavid Dai 	&bcm_sn0,
396b5d2f741SDavid Dai 	&bcm_sn1,
397b5d2f741SDavid Dai 	&bcm_sn2,
398b5d2f741SDavid Dai 	&bcm_sn3,
399b5d2f741SDavid Dai 	&bcm_sn4,
400b5d2f741SDavid Dai 	&bcm_sn5,
401b5d2f741SDavid Dai 	&bcm_sn6,
402b5d2f741SDavid Dai 	&bcm_sn7,
403b5d2f741SDavid Dai 	&bcm_sn8,
404b5d2f741SDavid Dai 	&bcm_sn9,
405b5d2f741SDavid Dai 	&bcm_sn11,
406b5d2f741SDavid Dai 	&bcm_sn12,
407b5d2f741SDavid Dai 	&bcm_sn14,
408b5d2f741SDavid Dai 	&bcm_sn15,
409b5d2f741SDavid Dai };
410b5d2f741SDavid Dai 
411aae57773SDavid Dai static struct qcom_icc_node *system_noc_nodes[] = {
412aae57773SDavid Dai 	[MASTER_SNOC_CFG] = &qhm_snoc_cfg,
413aae57773SDavid Dai 	[MASTER_A1NOC_SNOC] = &qnm_aggre1_noc,
414aae57773SDavid Dai 	[MASTER_A2NOC_SNOC] = &qnm_aggre2_noc,
415aae57773SDavid Dai 	[MASTER_GNOC_SNOC] = &qnm_gladiator_sodv,
416aae57773SDavid Dai 	[MASTER_MEM_NOC_SNOC] = &qnm_memnoc,
417aae57773SDavid Dai 	[MASTER_ANOC_PCIE_SNOC] = &qnm_pcie_anoc,
418aae57773SDavid Dai 	[MASTER_PIMEM] = &qxm_pimem,
419aae57773SDavid Dai 	[MASTER_GIC] = &xm_gic,
420aae57773SDavid Dai 	[SLAVE_APPSS] = &qhs_apss,
421aae57773SDavid Dai 	[SLAVE_SNOC_CNOC] = &qns_cnoc,
422aae57773SDavid Dai 	[SLAVE_SNOC_MEM_NOC_GC] = &qns_memnoc_gc,
423aae57773SDavid Dai 	[SLAVE_SNOC_MEM_NOC_SF] = &qns_memnoc_sf,
424aae57773SDavid Dai 	[SLAVE_IMEM] = &qxs_imem,
425aae57773SDavid Dai 	[SLAVE_PCIE_0] = &qxs_pcie,
426aae57773SDavid Dai 	[SLAVE_PCIE_1] = &qxs_pcie_gen3,
427aae57773SDavid Dai 	[SLAVE_PIMEM] = &qxs_pimem,
428aae57773SDavid Dai 	[SLAVE_SERVICE_SNOC] = &srvc_snoc,
429aae57773SDavid Dai 	[SLAVE_QDSS_STM] = &xs_qdss_stm,
430aae57773SDavid Dai 	[SLAVE_TCU] = &xs_sys_tcu_cfg,
431b5d2f741SDavid Dai };
432b5d2f741SDavid Dai 
4335409e0ccSChenTao static const struct qcom_icc_desc sdm845_system_noc = {
434aae57773SDavid Dai 	.nodes = system_noc_nodes,
435aae57773SDavid Dai 	.num_nodes = ARRAY_SIZE(system_noc_nodes),
436aae57773SDavid Dai 	.bcms = system_noc_bcms,
437aae57773SDavid Dai 	.num_bcms = ARRAY_SIZE(system_noc_bcms),
438aae57773SDavid Dai };
439b5d2f741SDavid Dai 
440b5d2f741SDavid Dai static int qnoc_probe(struct platform_device *pdev)
441b5d2f741SDavid Dai {
442b5d2f741SDavid Dai 	const struct qcom_icc_desc *desc;
443b5d2f741SDavid Dai 	struct icc_onecell_data *data;
444b5d2f741SDavid Dai 	struct icc_provider *provider;
445b5d2f741SDavid Dai 	struct qcom_icc_node **qnodes;
446b5d2f741SDavid Dai 	struct qcom_icc_provider *qp;
447b5d2f741SDavid Dai 	struct icc_node *node;
448b5d2f741SDavid Dai 	size_t num_nodes, i;
449b5d2f741SDavid Dai 	int ret;
450b5d2f741SDavid Dai 
451aae57773SDavid Dai 	desc = device_get_match_data(&pdev->dev);
452b5d2f741SDavid Dai 	if (!desc)
453b5d2f741SDavid Dai 		return -EINVAL;
454b5d2f741SDavid Dai 
455b5d2f741SDavid Dai 	qnodes = desc->nodes;
456b5d2f741SDavid Dai 	num_nodes = desc->num_nodes;
457b5d2f741SDavid Dai 
458b5d2f741SDavid Dai 	qp = devm_kzalloc(&pdev->dev, sizeof(*qp), GFP_KERNEL);
459b5d2f741SDavid Dai 	if (!qp)
460b5d2f741SDavid Dai 		return -ENOMEM;
461b5d2f741SDavid Dai 
46283c774f0SLeonard Crestez 	data = devm_kzalloc(&pdev->dev, struct_size(data, nodes, num_nodes),
46383c774f0SLeonard Crestez 			    GFP_KERNEL);
464b5d2f741SDavid Dai 	if (!data)
465b5d2f741SDavid Dai 		return -ENOMEM;
466b5d2f741SDavid Dai 
467b5d2f741SDavid Dai 	provider = &qp->provider;
468b5d2f741SDavid Dai 	provider->dev = &pdev->dev;
469b5d2f741SDavid Dai 	provider->set = qcom_icc_set;
4709e3ce77cSDavid Dai 	provider->pre_aggregate = qcom_icc_pre_aggregate;
471b5d2f741SDavid Dai 	provider->aggregate = qcom_icc_aggregate;
4726478e0d4SGeorgi Djakov 	provider->xlate_extended = qcom_icc_xlate_extended;
473b5d2f741SDavid Dai 	INIT_LIST_HEAD(&provider->nodes);
474b5d2f741SDavid Dai 	provider->data = data;
475b5d2f741SDavid Dai 
476b5d2f741SDavid Dai 	qp->dev = &pdev->dev;
477b5d2f741SDavid Dai 	qp->bcms = desc->bcms;
478b5d2f741SDavid Dai 	qp->num_bcms = desc->num_bcms;
479b5d2f741SDavid Dai 
480aae57773SDavid Dai 	qp->voter = of_bcm_voter_get(qp->dev, NULL);
481aae57773SDavid Dai 	if (IS_ERR(qp->voter)) {
482aae57773SDavid Dai 		dev_err(&pdev->dev, "bcm_voter err:%ld\n", PTR_ERR(qp->voter));
483aae57773SDavid Dai 		return PTR_ERR(qp->voter);
484aae57773SDavid Dai 	}
485aae57773SDavid Dai 
486b5d2f741SDavid Dai 	ret = icc_provider_add(provider);
487b5d2f741SDavid Dai 	if (ret) {
488b5d2f741SDavid Dai 		dev_err(&pdev->dev, "error adding interconnect provider\n");
489b5d2f741SDavid Dai 		return ret;
490b5d2f741SDavid Dai 	}
491b5d2f741SDavid Dai 
492b5d2f741SDavid Dai 	for (i = 0; i < num_nodes; i++) {
493b5d2f741SDavid Dai 		size_t j;
494b5d2f741SDavid Dai 
495aae57773SDavid Dai 		if (!qnodes[i])
496aae57773SDavid Dai 			continue;
497aae57773SDavid Dai 
498b5d2f741SDavid Dai 		node = icc_node_create(qnodes[i]->id);
499b5d2f741SDavid Dai 		if (IS_ERR(node)) {
500b5d2f741SDavid Dai 			ret = PTR_ERR(node);
501b5d2f741SDavid Dai 			goto err;
502b5d2f741SDavid Dai 		}
503b5d2f741SDavid Dai 
504b5d2f741SDavid Dai 		node->name = qnodes[i]->name;
505b5d2f741SDavid Dai 		node->data = qnodes[i];
506b5d2f741SDavid Dai 		icc_node_add(node, provider);
507b5d2f741SDavid Dai 
508b5d2f741SDavid Dai 		for (j = 0; j < qnodes[i]->num_links; j++)
509b5d2f741SDavid Dai 			icc_link_create(node, qnodes[i]->links[j]);
510b5d2f741SDavid Dai 
511b5d2f741SDavid Dai 		data->nodes[i] = node;
512b5d2f741SDavid Dai 	}
513b5d2f741SDavid Dai 	data->num_nodes = num_nodes;
514b5d2f741SDavid Dai 
515b5d2f741SDavid Dai 	for (i = 0; i < qp->num_bcms; i++)
516b5d2f741SDavid Dai 		qcom_icc_bcm_init(qp->bcms[i], &pdev->dev);
517b5d2f741SDavid Dai 
518b5d2f741SDavid Dai 	platform_set_drvdata(pdev, qp);
519b5d2f741SDavid Dai 
520aae57773SDavid Dai 	return 0;
521b5d2f741SDavid Dai err:
522ad3703acSGeorgi Djakov 	icc_nodes_remove(provider);
523b5d2f741SDavid Dai 	icc_provider_del(provider);
524b5d2f741SDavid Dai 	return ret;
525b5d2f741SDavid Dai }
526b5d2f741SDavid Dai 
527b5d2f741SDavid Dai static int qnoc_remove(struct platform_device *pdev)
528b5d2f741SDavid Dai {
529b5d2f741SDavid Dai 	struct qcom_icc_provider *qp = platform_get_drvdata(pdev);
530b5d2f741SDavid Dai 
531ad3703acSGeorgi Djakov 	icc_nodes_remove(&qp->provider);
532ad3703acSGeorgi Djakov 	return icc_provider_del(&qp->provider);
533b5d2f741SDavid Dai }
534b5d2f741SDavid Dai 
535b5d2f741SDavid Dai static const struct of_device_id qnoc_of_match[] = {
536aae57773SDavid Dai 	{ .compatible = "qcom,sdm845-aggre1-noc",
537aae57773SDavid Dai 	  .data = &sdm845_aggre1_noc},
538aae57773SDavid Dai 	{ .compatible = "qcom,sdm845-aggre2-noc",
539aae57773SDavid Dai 	  .data = &sdm845_aggre2_noc},
540aae57773SDavid Dai 	{ .compatible = "qcom,sdm845-config-noc",
541aae57773SDavid Dai 	  .data = &sdm845_config_noc},
542aae57773SDavid Dai 	{ .compatible = "qcom,sdm845-dc-noc",
543aae57773SDavid Dai 	  .data = &sdm845_dc_noc},
544aae57773SDavid Dai 	{ .compatible = "qcom,sdm845-gladiator-noc",
545aae57773SDavid Dai 	  .data = &sdm845_gladiator_noc},
546aae57773SDavid Dai 	{ .compatible = "qcom,sdm845-mem-noc",
547aae57773SDavid Dai 	  .data = &sdm845_mem_noc},
548aae57773SDavid Dai 	{ .compatible = "qcom,sdm845-mmss-noc",
549aae57773SDavid Dai 	  .data = &sdm845_mmss_noc},
550aae57773SDavid Dai 	{ .compatible = "qcom,sdm845-system-noc",
551aae57773SDavid Dai 	  .data = &sdm845_system_noc},
552aae57773SDavid Dai 	{ }
553b5d2f741SDavid Dai };
554b5d2f741SDavid Dai MODULE_DEVICE_TABLE(of, qnoc_of_match);
555b5d2f741SDavid Dai 
556b5d2f741SDavid Dai static struct platform_driver qnoc_driver = {
557b5d2f741SDavid Dai 	.probe = qnoc_probe,
558b5d2f741SDavid Dai 	.remove = qnoc_remove,
559b5d2f741SDavid Dai 	.driver = {
560b5d2f741SDavid Dai 		.name = "qnoc-sdm845",
561b5d2f741SDavid Dai 		.of_match_table = qnoc_of_match,
5627d3b0b0dSGeorgi Djakov 		.sync_state = icc_sync_state,
563b5d2f741SDavid Dai 	},
564b5d2f741SDavid Dai };
565b5d2f741SDavid Dai module_platform_driver(qnoc_driver);
566b5d2f741SDavid Dai 
567b5d2f741SDavid Dai MODULE_AUTHOR("David Dai <daidavid1@codeaurora.org>");
568b5d2f741SDavid Dai MODULE_DESCRIPTION("Qualcomm sdm845 NoC driver");
569b5d2f741SDavid Dai MODULE_LICENSE("GPL v2");
570