1 // SPDX-License-Identifier: GPL-2.0
3 * Qualcomm SDX55 interconnect driver
4 * Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
6 * Copyright (c) 2021, Linaro Ltd.
10 #include <linux/device.h>
11 #include <linux/interconnect.h>
12 #include <linux/interconnect-provider.h>
13 #include <linux/mod_devicetable.h>
14 #include <linux/module.h>
15 #include <linux/platform_device.h>
16 #include <dt-bindings/interconnect/qcom,sdx55.h>
18 #include "bcm-voter.h"
22 static struct qcom_icc_node llcc_mc
= {
24 .id
= SDX55_MASTER_LLCC
,
28 .links
= { SDX55_SLAVE_EBI_CH0
},
31 static struct qcom_icc_node acm_tcu
= {
33 .id
= SDX55_MASTER_TCU_0
,
37 .links
= { SDX55_SLAVE_LLCC
,
38 SDX55_SLAVE_MEM_NOC_SNOC
,
39 SDX55_SLAVE_MEM_NOC_PCIE_SNOC
43 static struct qcom_icc_node qnm_snoc_gc
= {
44 .name
= "qnm_snoc_gc",
45 .id
= SDX55_MASTER_SNOC_GC_MEM_NOC
,
49 .links
= { SDX55_SLAVE_LLCC
},
52 static struct qcom_icc_node xm_apps_rdwr
= {
53 .name
= "xm_apps_rdwr",
54 .id
= SDX55_MASTER_AMPSS_M0
,
58 .links
= { SDX55_SLAVE_LLCC
,
59 SDX55_SLAVE_MEM_NOC_SNOC
,
60 SDX55_SLAVE_MEM_NOC_PCIE_SNOC
64 static struct qcom_icc_node qhm_audio
= {
66 .id
= SDX55_MASTER_AUDIO
,
70 .links
= { SDX55_SLAVE_ANOC_SNOC
},
73 static struct qcom_icc_node qhm_blsp1
= {
75 .id
= SDX55_MASTER_BLSP_1
,
79 .links
= { SDX55_SLAVE_ANOC_SNOC
},
82 static struct qcom_icc_node qhm_qdss_bam
= {
83 .name
= "qhm_qdss_bam",
84 .id
= SDX55_MASTER_QDSS_BAM
,
88 .links
= { SDX55_SLAVE_SNOC_CFG
,
92 SDX55_SLAVE_SPMI_FETCHER
,
95 SDX55_SLAVE_SNOC_MEM_NOC_GC
,
97 SDX55_SLAVE_CNOC_DDRSS
,
98 SDX55_SLAVE_SPMI_VGI_COEX
,
102 SDX55_SLAVE_USB3_PHY_CFG
,
106 SDX55_SLAVE_CNOC_MSS
,
107 SDX55_SLAVE_PCIE_PARF
,
112 SDX55_SLAVE_CRYPTO_0_CFG
,
119 static struct qcom_icc_node qhm_qpic
= {
121 .id
= SDX55_MASTER_QPIC
,
125 .links
= { SDX55_SLAVE_AOSS
,
127 SDX55_SLAVE_ANOC_SNOC
,
133 static struct qcom_icc_node qhm_snoc_cfg
= {
134 .name
= "qhm_snoc_cfg",
135 .id
= SDX55_MASTER_SNOC_CFG
,
139 .links
= { SDX55_SLAVE_SERVICE_SNOC
},
142 static struct qcom_icc_node qhm_spmi_fetcher1
= {
143 .name
= "qhm_spmi_fetcher1",
144 .id
= SDX55_MASTER_SPMI_FETCHER
,
148 .links
= { SDX55_SLAVE_AOSS
,
149 SDX55_SLAVE_ANOC_SNOC
,
154 static struct qcom_icc_node qnm_aggre_noc
= {
155 .name
= "qnm_aggre_noc",
156 .id
= SDX55_MASTER_ANOC_SNOC
,
160 .links
= { SDX55_SLAVE_PCIE_0
,
161 SDX55_SLAVE_SNOC_CFG
,
164 SDX55_SLAVE_SPMI_FETCHER
,
165 SDX55_SLAVE_QDSS_CFG
,
167 SDX55_SLAVE_SNOC_MEM_NOC_GC
,
169 SDX55_SLAVE_CNOC_DDRSS
,
170 SDX55_SLAVE_SPMI_VGI_COEX
,
171 SDX55_SLAVE_QDSS_STM
,
175 SDX55_SLAVE_USB3_PHY_CFG
,
179 SDX55_SLAVE_CNOC_MSS
,
180 SDX55_SLAVE_PCIE_PARF
,
186 SDX55_SLAVE_CRYPTO_0_CFG
,
193 static struct qcom_icc_node qnm_ipa
= {
195 .id
= SDX55_MASTER_IPA
,
199 .links
= { SDX55_SLAVE_SNOC_CFG
,
200 SDX55_SLAVE_EMAC_CFG
,
203 SDX55_SLAVE_SPMI_FETCHER
,
204 SDX55_SLAVE_QDSS_CFG
,
206 SDX55_SLAVE_SNOC_MEM_NOC_GC
,
208 SDX55_SLAVE_CNOC_DDRSS
,
209 SDX55_SLAVE_QDSS_STM
,
213 SDX55_SLAVE_USB3_PHY_CFG
,
217 SDX55_SLAVE_CNOC_MSS
,
218 SDX55_SLAVE_PCIE_PARF
,
223 SDX55_SLAVE_CRYPTO_0_CFG
,
229 static struct qcom_icc_node qnm_memnoc
= {
230 .name
= "qnm_memnoc",
231 .id
= SDX55_MASTER_MEM_NOC_SNOC
,
235 .links
= { SDX55_SLAVE_SNOC_CFG
,
236 SDX55_SLAVE_EMAC_CFG
,
239 SDX55_SLAVE_SPMI_FETCHER
,
240 SDX55_SLAVE_QDSS_CFG
,
243 SDX55_SLAVE_CNOC_DDRSS
,
244 SDX55_SLAVE_SPMI_VGI_COEX
,
245 SDX55_SLAVE_QDSS_STM
,
249 SDX55_SLAVE_USB3_PHY_CFG
,
253 SDX55_SLAVE_CNOC_MSS
,
254 SDX55_SLAVE_PCIE_PARF
,
260 SDX55_SLAVE_CRYPTO_0_CFG
,
267 static struct qcom_icc_node qnm_memnoc_pcie
= {
268 .name
= "qnm_memnoc_pcie",
269 .id
= SDX55_MASTER_MEM_NOC_PCIE_SNOC
,
273 .links
= { SDX55_SLAVE_PCIE_0
},
276 static struct qcom_icc_node qxm_crypto
= {
277 .name
= "qxm_crypto",
278 .id
= SDX55_MASTER_CRYPTO_CORE_0
,
282 .links
= { SDX55_SLAVE_AOSS
,
283 SDX55_SLAVE_ANOC_SNOC
,
288 static struct qcom_icc_node xm_emac
= {
290 .id
= SDX55_MASTER_EMAC
,
294 .links
= { SDX55_SLAVE_ANOC_SNOC
},
297 static struct qcom_icc_node xm_ipa2pcie_slv
= {
298 .name
= "xm_ipa2pcie_slv",
299 .id
= SDX55_MASTER_IPA_PCIE
,
303 .links
= { SDX55_SLAVE_PCIE_0
},
306 static struct qcom_icc_node xm_pcie
= {
308 .id
= SDX55_MASTER_PCIE
,
312 .links
= { SDX55_SLAVE_ANOC_SNOC
},
315 static struct qcom_icc_node xm_qdss_etr
= {
316 .name
= "xm_qdss_etr",
317 .id
= SDX55_MASTER_QDSS_ETR
,
321 .links
= { SDX55_SLAVE_SNOC_CFG
,
322 SDX55_SLAVE_EMAC_CFG
,
325 SDX55_SLAVE_SPMI_FETCHER
,
326 SDX55_SLAVE_QDSS_CFG
,
328 SDX55_SLAVE_SNOC_MEM_NOC_GC
,
330 SDX55_SLAVE_CNOC_DDRSS
,
331 SDX55_SLAVE_SPMI_VGI_COEX
,
335 SDX55_SLAVE_USB3_PHY_CFG
,
339 SDX55_SLAVE_CNOC_MSS
,
340 SDX55_SLAVE_PCIE_PARF
,
345 SDX55_SLAVE_CRYPTO_0_CFG
,
352 static struct qcom_icc_node xm_sdc1
= {
354 .id
= SDX55_MASTER_SDCC_1
,
358 .links
= { SDX55_SLAVE_AOSS
,
360 SDX55_SLAVE_ANOC_SNOC
,
366 static struct qcom_icc_node xm_usb3
= {
368 .id
= SDX55_MASTER_USB3
,
372 .links
= { SDX55_SLAVE_ANOC_SNOC
},
375 static struct qcom_icc_node ebi
= {
377 .id
= SDX55_SLAVE_EBI_CH0
,
382 static struct qcom_icc_node qns_llcc
= {
384 .id
= SDX55_SLAVE_LLCC
,
388 .links
= { SDX55_SLAVE_EBI_CH0
},
391 static struct qcom_icc_node qns_memnoc_snoc
= {
392 .name
= "qns_memnoc_snoc",
393 .id
= SDX55_SLAVE_MEM_NOC_SNOC
,
397 .links
= { SDX55_MASTER_MEM_NOC_SNOC
},
400 static struct qcom_icc_node qns_sys_pcie
= {
401 .name
= "qns_sys_pcie",
402 .id
= SDX55_SLAVE_MEM_NOC_PCIE_SNOC
,
406 .links
= { SDX55_MASTER_MEM_NOC_PCIE_SNOC
},
409 static struct qcom_icc_node qhs_aop
= {
411 .id
= SDX55_SLAVE_AOP
,
416 static struct qcom_icc_node qhs_aoss
= {
418 .id
= SDX55_SLAVE_AOSS
,
423 static struct qcom_icc_node qhs_apss
= {
425 .id
= SDX55_SLAVE_APPSS
,
430 static struct qcom_icc_node qhs_audio
= {
432 .id
= SDX55_SLAVE_AUDIO
,
437 static struct qcom_icc_node qhs_blsp1
= {
439 .id
= SDX55_SLAVE_BLSP_1
,
444 static struct qcom_icc_node qhs_clk_ctl
= {
445 .name
= "qhs_clk_ctl",
446 .id
= SDX55_SLAVE_CLK_CTL
,
451 static struct qcom_icc_node qhs_crypto0_cfg
= {
452 .name
= "qhs_crypto0_cfg",
453 .id
= SDX55_SLAVE_CRYPTO_0_CFG
,
458 static struct qcom_icc_node qhs_ddrss_cfg
= {
459 .name
= "qhs_ddrss_cfg",
460 .id
= SDX55_SLAVE_CNOC_DDRSS
,
465 static struct qcom_icc_node qhs_ecc_cfg
= {
466 .name
= "qhs_ecc_cfg",
467 .id
= SDX55_SLAVE_ECC_CFG
,
472 static struct qcom_icc_node qhs_emac_cfg
= {
473 .name
= "qhs_emac_cfg",
474 .id
= SDX55_SLAVE_EMAC_CFG
,
479 static struct qcom_icc_node qhs_imem_cfg
= {
480 .name
= "qhs_imem_cfg",
481 .id
= SDX55_SLAVE_IMEM_CFG
,
486 static struct qcom_icc_node qhs_ipa
= {
488 .id
= SDX55_SLAVE_IPA_CFG
,
493 static struct qcom_icc_node qhs_mss_cfg
= {
494 .name
= "qhs_mss_cfg",
495 .id
= SDX55_SLAVE_CNOC_MSS
,
500 static struct qcom_icc_node qhs_pcie_parf
= {
501 .name
= "qhs_pcie_parf",
502 .id
= SDX55_SLAVE_PCIE_PARF
,
507 static struct qcom_icc_node qhs_pdm
= {
509 .id
= SDX55_SLAVE_PDM
,
514 static struct qcom_icc_node qhs_prng
= {
516 .id
= SDX55_SLAVE_PRNG
,
521 static struct qcom_icc_node qhs_qdss_cfg
= {
522 .name
= "qhs_qdss_cfg",
523 .id
= SDX55_SLAVE_QDSS_CFG
,
528 static struct qcom_icc_node qhs_qpic
= {
530 .id
= SDX55_SLAVE_QPIC
,
535 static struct qcom_icc_node qhs_sdc1
= {
537 .id
= SDX55_SLAVE_SDCC_1
,
542 static struct qcom_icc_node qhs_snoc_cfg
= {
543 .name
= "qhs_snoc_cfg",
544 .id
= SDX55_SLAVE_SNOC_CFG
,
548 .links
= { SDX55_MASTER_SNOC_CFG
},
551 static struct qcom_icc_node qhs_spmi_fetcher
= {
552 .name
= "qhs_spmi_fetcher",
553 .id
= SDX55_SLAVE_SPMI_FETCHER
,
558 static struct qcom_icc_node qhs_spmi_vgi_coex
= {
559 .name
= "qhs_spmi_vgi_coex",
560 .id
= SDX55_SLAVE_SPMI_VGI_COEX
,
565 static struct qcom_icc_node qhs_tcsr
= {
567 .id
= SDX55_SLAVE_TCSR
,
572 static struct qcom_icc_node qhs_tlmm
= {
574 .id
= SDX55_SLAVE_TLMM
,
579 static struct qcom_icc_node qhs_usb3
= {
581 .id
= SDX55_SLAVE_USB3
,
586 static struct qcom_icc_node qhs_usb3_phy
= {
587 .name
= "qhs_usb3_phy",
588 .id
= SDX55_SLAVE_USB3_PHY_CFG
,
593 static struct qcom_icc_node qns_aggre_noc
= {
594 .name
= "qns_aggre_noc",
595 .id
= SDX55_SLAVE_ANOC_SNOC
,
599 .links
= { SDX55_MASTER_ANOC_SNOC
},
602 static struct qcom_icc_node qns_snoc_memnoc
= {
603 .name
= "qns_snoc_memnoc",
604 .id
= SDX55_SLAVE_SNOC_MEM_NOC_GC
,
608 .links
= { SDX55_MASTER_SNOC_GC_MEM_NOC
},
611 static struct qcom_icc_node qxs_imem
= {
613 .id
= SDX55_SLAVE_OCIMEM
,
618 static struct qcom_icc_node srvc_snoc
= {
620 .id
= SDX55_SLAVE_SERVICE_SNOC
,
625 static struct qcom_icc_node xs_pcie
= {
627 .id
= SDX55_SLAVE_PCIE_0
,
632 static struct qcom_icc_node xs_qdss_stm
= {
633 .name
= "xs_qdss_stm",
634 .id
= SDX55_SLAVE_QDSS_STM
,
639 static struct qcom_icc_node xs_sys_tcu_cfg
= {
640 .name
= "xs_sys_tcu_cfg",
641 .id
= SDX55_SLAVE_TCU
,
646 static struct qcom_icc_bcm bcm_mc0
= {
653 static struct qcom_icc_bcm bcm_sh0
= {
657 .nodes
= { &qns_llcc
},
660 static struct qcom_icc_bcm bcm_ce0
= {
664 .nodes
= { &qxm_crypto
},
667 static struct qcom_icc_bcm bcm_pn0
= {
671 .nodes
= { &qhm_snoc_cfg
},
674 static struct qcom_icc_bcm bcm_sh3
= {
678 .nodes
= { &xm_apps_rdwr
},
681 static struct qcom_icc_bcm bcm_sh4
= {
685 .nodes
= { &qns_memnoc_snoc
, &qns_sys_pcie
},
688 static struct qcom_icc_bcm bcm_sn0
= {
692 .nodes
= { &qns_snoc_memnoc
},
695 static struct qcom_icc_bcm bcm_sn1
= {
699 .nodes
= { &qxs_imem
},
702 static struct qcom_icc_bcm bcm_pn1
= {
706 .nodes
= { &xm_sdc1
},
709 static struct qcom_icc_bcm bcm_pn2
= {
713 .nodes
= { &qhm_audio
, &qhm_spmi_fetcher1
},
716 static struct qcom_icc_bcm bcm_sn3
= {
720 .nodes
= { &xs_qdss_stm
},
723 static struct qcom_icc_bcm bcm_pn3
= {
727 .nodes
= { &qhm_blsp1
, &qhm_qpic
},
730 static struct qcom_icc_bcm bcm_sn4
= {
734 .nodes
= { &xs_sys_tcu_cfg
},
737 static struct qcom_icc_bcm bcm_pn5
= {
741 .nodes
= { &qxm_crypto
},
744 static struct qcom_icc_bcm bcm_sn6
= {
748 .nodes
= { &xs_pcie
},
751 static struct qcom_icc_bcm bcm_sn7
= {
755 .nodes
= { &qnm_aggre_noc
, &xm_emac
, &xm_emac
, &xm_usb3
, &qns_aggre_noc
},
758 static struct qcom_icc_bcm bcm_sn8
= {
762 .nodes
= { &qhm_qdss_bam
, &xm_qdss_etr
},
765 static struct qcom_icc_bcm bcm_sn9
= {
769 .nodes
= { &qnm_memnoc
},
772 static struct qcom_icc_bcm bcm_sn10
= {
776 .nodes
= { &qnm_memnoc_pcie
},
779 static struct qcom_icc_bcm bcm_sn11
= {
783 .nodes
= { &qnm_ipa
, &xm_ipa2pcie_slv
},
786 static struct qcom_icc_bcm
* const mc_virt_bcms
[] = {
790 static struct qcom_icc_node
* const mc_virt_nodes
[] = {
791 [MASTER_LLCC
] = &llcc_mc
,
792 [SLAVE_EBI_CH0
] = &ebi
,
795 static const struct qcom_icc_desc sdx55_mc_virt
= {
796 .nodes
= mc_virt_nodes
,
797 .num_nodes
= ARRAY_SIZE(mc_virt_nodes
),
798 .bcms
= mc_virt_bcms
,
799 .num_bcms
= ARRAY_SIZE(mc_virt_bcms
),
802 static struct qcom_icc_bcm
* const mem_noc_bcms
[] = {
808 static struct qcom_icc_node
* const mem_noc_nodes
[] = {
809 [MASTER_TCU_0
] = &acm_tcu
,
810 [MASTER_SNOC_GC_MEM_NOC
] = &qnm_snoc_gc
,
811 [MASTER_AMPSS_M0
] = &xm_apps_rdwr
,
812 [SLAVE_LLCC
] = &qns_llcc
,
813 [SLAVE_MEM_NOC_SNOC
] = &qns_memnoc_snoc
,
814 [SLAVE_MEM_NOC_PCIE_SNOC
] = &qns_sys_pcie
,
817 static const struct qcom_icc_desc sdx55_mem_noc
= {
818 .nodes
= mem_noc_nodes
,
819 .num_nodes
= ARRAY_SIZE(mem_noc_nodes
),
820 .bcms
= mem_noc_bcms
,
821 .num_bcms
= ARRAY_SIZE(mem_noc_bcms
),
824 static struct qcom_icc_bcm
* const system_noc_bcms
[] = {
843 static struct qcom_icc_node
* const system_noc_nodes
[] = {
844 [MASTER_AUDIO
] = &qhm_audio
,
845 [MASTER_BLSP_1
] = &qhm_blsp1
,
846 [MASTER_QDSS_BAM
] = &qhm_qdss_bam
,
847 [MASTER_QPIC
] = &qhm_qpic
,
848 [MASTER_SNOC_CFG
] = &qhm_snoc_cfg
,
849 [MASTER_SPMI_FETCHER
] = &qhm_spmi_fetcher1
,
850 [MASTER_ANOC_SNOC
] = &qnm_aggre_noc
,
851 [MASTER_IPA
] = &qnm_ipa
,
852 [MASTER_MEM_NOC_SNOC
] = &qnm_memnoc
,
853 [MASTER_MEM_NOC_PCIE_SNOC
] = &qnm_memnoc_pcie
,
854 [MASTER_CRYPTO_CORE_0
] = &qxm_crypto
,
855 [MASTER_EMAC
] = &xm_emac
,
856 [MASTER_IPA_PCIE
] = &xm_ipa2pcie_slv
,
857 [MASTER_PCIE
] = &xm_pcie
,
858 [MASTER_QDSS_ETR
] = &xm_qdss_etr
,
859 [MASTER_SDCC_1
] = &xm_sdc1
,
860 [MASTER_USB3
] = &xm_usb3
,
861 [SLAVE_AOP
] = &qhs_aop
,
862 [SLAVE_AOSS
] = &qhs_aoss
,
863 [SLAVE_APPSS
] = &qhs_apss
,
864 [SLAVE_AUDIO
] = &qhs_audio
,
865 [SLAVE_BLSP_1
] = &qhs_blsp1
,
866 [SLAVE_CLK_CTL
] = &qhs_clk_ctl
,
867 [SLAVE_CRYPTO_0_CFG
] = &qhs_crypto0_cfg
,
868 [SLAVE_CNOC_DDRSS
] = &qhs_ddrss_cfg
,
869 [SLAVE_ECC_CFG
] = &qhs_ecc_cfg
,
870 [SLAVE_EMAC_CFG
] = &qhs_emac_cfg
,
871 [SLAVE_IMEM_CFG
] = &qhs_imem_cfg
,
872 [SLAVE_IPA_CFG
] = &qhs_ipa
,
873 [SLAVE_CNOC_MSS
] = &qhs_mss_cfg
,
874 [SLAVE_PCIE_PARF
] = &qhs_pcie_parf
,
875 [SLAVE_PDM
] = &qhs_pdm
,
876 [SLAVE_PRNG
] = &qhs_prng
,
877 [SLAVE_QDSS_CFG
] = &qhs_qdss_cfg
,
878 [SLAVE_QPIC
] = &qhs_qpic
,
879 [SLAVE_SDCC_1
] = &qhs_sdc1
,
880 [SLAVE_SNOC_CFG
] = &qhs_snoc_cfg
,
881 [SLAVE_SPMI_FETCHER
] = &qhs_spmi_fetcher
,
882 [SLAVE_SPMI_VGI_COEX
] = &qhs_spmi_vgi_coex
,
883 [SLAVE_TCSR
] = &qhs_tcsr
,
884 [SLAVE_TLMM
] = &qhs_tlmm
,
885 [SLAVE_USB3
] = &qhs_usb3
,
886 [SLAVE_USB3_PHY_CFG
] = &qhs_usb3_phy
,
887 [SLAVE_ANOC_SNOC
] = &qns_aggre_noc
,
888 [SLAVE_SNOC_MEM_NOC_GC
] = &qns_snoc_memnoc
,
889 [SLAVE_OCIMEM
] = &qxs_imem
,
890 [SLAVE_SERVICE_SNOC
] = &srvc_snoc
,
891 [SLAVE_PCIE_0
] = &xs_pcie
,
892 [SLAVE_QDSS_STM
] = &xs_qdss_stm
,
893 [SLAVE_TCU
] = &xs_sys_tcu_cfg
,
896 static const struct qcom_icc_desc sdx55_system_noc
= {
897 .nodes
= system_noc_nodes
,
898 .num_nodes
= ARRAY_SIZE(system_noc_nodes
),
899 .bcms
= system_noc_bcms
,
900 .num_bcms
= ARRAY_SIZE(system_noc_bcms
),
903 static const struct of_device_id qnoc_of_match
[] = {
904 { .compatible
= "qcom,sdx55-mc-virt",
905 .data
= &sdx55_mc_virt
},
906 { .compatible
= "qcom,sdx55-mem-noc",
907 .data
= &sdx55_mem_noc
},
908 { .compatible
= "qcom,sdx55-system-noc",
909 .data
= &sdx55_system_noc
},
912 MODULE_DEVICE_TABLE(of
, qnoc_of_match
);
914 static struct platform_driver qnoc_driver
= {
915 .probe
= qcom_icc_rpmh_probe
,
916 .remove
= qcom_icc_rpmh_remove
,
918 .name
= "qnoc-sdx55",
919 .of_match_table
= qnoc_of_match
,
920 .sync_state
= icc_sync_state
,
923 module_platform_driver(qnoc_driver
);
925 MODULE_DESCRIPTION("Qualcomm SDX55 NoC driver");
926 MODULE_AUTHOR("Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>");
927 MODULE_LICENSE("GPL v2");