xref: /linux/drivers/interconnect/qcom/msm8974.c (revision cff66ace51e3acfcba3ab03f92adc9510830c365)
14e60a956SBrian Masney // SPDX-License-Identifier: GPL-2.0
24e60a956SBrian Masney /*
34e60a956SBrian Masney  * Copyright (C) 2019 Brian Masney <masneyb@onstation.org>
44e60a956SBrian Masney  *
54e60a956SBrian Masney  * Based on MSM bus code from downstream MSM kernel sources.
64e60a956SBrian Masney  * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
74e60a956SBrian Masney  *
84e60a956SBrian Masney  * Based on qcs404.c
94e60a956SBrian Masney  * Copyright (C) 2019 Linaro Ltd
104e60a956SBrian Masney  *
114e60a956SBrian Masney  * Here's a rough representation that shows the various buses that form the
124e60a956SBrian Masney  * Network On Chip (NOC) for the msm8974:
134e60a956SBrian Masney  *
144e60a956SBrian Masney  *                         Multimedia Subsystem (MMSS)
154e60a956SBrian Masney  *         |----------+-----------------------------------+-----------|
164e60a956SBrian Masney  *                    |                                   |
174e60a956SBrian Masney  *                    |                                   |
184e60a956SBrian Masney  *        Config      |                     Bus Interface | Memory Controller
194e60a956SBrian Masney  *       |------------+-+-----------|        |------------+-+-----------|
204e60a956SBrian Masney  *                      |                                   |
214e60a956SBrian Masney  *                      |                                   |
224e60a956SBrian Masney  *                      |             System                |
234e60a956SBrian Masney  *     |--------------+-+---------------------------------+-+-------------|
244e60a956SBrian Masney  *                    |                                   |
254e60a956SBrian Masney  *                    |                                   |
264e60a956SBrian Masney  *        Peripheral  |                           On Chip | Memory (OCMEM)
274e60a956SBrian Masney  *       |------------+-------------|        |------------+-------------|
284e60a956SBrian Masney  */
294e60a956SBrian Masney 
304e60a956SBrian Masney #include <dt-bindings/interconnect/qcom,msm8974.h>
314e60a956SBrian Masney #include <linux/clk.h>
324e60a956SBrian Masney #include <linux/device.h>
334e60a956SBrian Masney #include <linux/interconnect-provider.h>
344e60a956SBrian Masney #include <linux/io.h>
354e60a956SBrian Masney #include <linux/module.h>
36*cff66aceSRob Herring #include <linux/of.h>
374e60a956SBrian Masney #include <linux/platform_device.h>
384e60a956SBrian Masney #include <linux/slab.h>
394e60a956SBrian Masney 
4019ced2aeSKonrad Dybcio #include "icc-rpm.h"
414e60a956SBrian Masney 
424e60a956SBrian Masney enum {
434e60a956SBrian Masney 	MSM8974_BIMC_MAS_AMPSS_M0 = 1,
444e60a956SBrian Masney 	MSM8974_BIMC_MAS_AMPSS_M1,
454e60a956SBrian Masney 	MSM8974_BIMC_MAS_MSS_PROC,
464e60a956SBrian Masney 	MSM8974_BIMC_TO_MNOC,
474e60a956SBrian Masney 	MSM8974_BIMC_TO_SNOC,
484e60a956SBrian Masney 	MSM8974_BIMC_SLV_EBI_CH0,
494e60a956SBrian Masney 	MSM8974_BIMC_SLV_AMPSS_L2,
504e60a956SBrian Masney 	MSM8974_CNOC_MAS_RPM_INST,
514e60a956SBrian Masney 	MSM8974_CNOC_MAS_RPM_DATA,
524e60a956SBrian Masney 	MSM8974_CNOC_MAS_RPM_SYS,
534e60a956SBrian Masney 	MSM8974_CNOC_MAS_DEHR,
544e60a956SBrian Masney 	MSM8974_CNOC_MAS_QDSS_DAP,
554e60a956SBrian Masney 	MSM8974_CNOC_MAS_SPDM,
564e60a956SBrian Masney 	MSM8974_CNOC_MAS_TIC,
574e60a956SBrian Masney 	MSM8974_CNOC_SLV_CLK_CTL,
584e60a956SBrian Masney 	MSM8974_CNOC_SLV_CNOC_MSS,
594e60a956SBrian Masney 	MSM8974_CNOC_SLV_SECURITY,
604e60a956SBrian Masney 	MSM8974_CNOC_SLV_TCSR,
614e60a956SBrian Masney 	MSM8974_CNOC_SLV_TLMM,
624e60a956SBrian Masney 	MSM8974_CNOC_SLV_CRYPTO_0_CFG,
634e60a956SBrian Masney 	MSM8974_CNOC_SLV_CRYPTO_1_CFG,
644e60a956SBrian Masney 	MSM8974_CNOC_SLV_IMEM_CFG,
654e60a956SBrian Masney 	MSM8974_CNOC_SLV_MESSAGE_RAM,
664e60a956SBrian Masney 	MSM8974_CNOC_SLV_BIMC_CFG,
674e60a956SBrian Masney 	MSM8974_CNOC_SLV_BOOT_ROM,
684e60a956SBrian Masney 	MSM8974_CNOC_SLV_PMIC_ARB,
694e60a956SBrian Masney 	MSM8974_CNOC_SLV_SPDM_WRAPPER,
704e60a956SBrian Masney 	MSM8974_CNOC_SLV_DEHR_CFG,
714e60a956SBrian Masney 	MSM8974_CNOC_SLV_MPM,
724e60a956SBrian Masney 	MSM8974_CNOC_SLV_QDSS_CFG,
734e60a956SBrian Masney 	MSM8974_CNOC_SLV_RBCPR_CFG,
744e60a956SBrian Masney 	MSM8974_CNOC_SLV_RBCPR_QDSS_APU_CFG,
754e60a956SBrian Masney 	MSM8974_CNOC_TO_SNOC,
764e60a956SBrian Masney 	MSM8974_CNOC_SLV_CNOC_ONOC_CFG,
774e60a956SBrian Masney 	MSM8974_CNOC_SLV_CNOC_MNOC_MMSS_CFG,
784e60a956SBrian Masney 	MSM8974_CNOC_SLV_CNOC_MNOC_CFG,
794e60a956SBrian Masney 	MSM8974_CNOC_SLV_PNOC_CFG,
804e60a956SBrian Masney 	MSM8974_CNOC_SLV_SNOC_MPU_CFG,
814e60a956SBrian Masney 	MSM8974_CNOC_SLV_SNOC_CFG,
824e60a956SBrian Masney 	MSM8974_CNOC_SLV_EBI1_DLL_CFG,
834e60a956SBrian Masney 	MSM8974_CNOC_SLV_PHY_APU_CFG,
844e60a956SBrian Masney 	MSM8974_CNOC_SLV_EBI1_PHY_CFG,
854e60a956SBrian Masney 	MSM8974_CNOC_SLV_RPM,
864e60a956SBrian Masney 	MSM8974_CNOC_SLV_SERVICE_CNOC,
874e60a956SBrian Masney 	MSM8974_MNOC_MAS_GRAPHICS_3D,
884e60a956SBrian Masney 	MSM8974_MNOC_MAS_JPEG,
894e60a956SBrian Masney 	MSM8974_MNOC_MAS_MDP_PORT0,
904e60a956SBrian Masney 	MSM8974_MNOC_MAS_VIDEO_P0,
914e60a956SBrian Masney 	MSM8974_MNOC_MAS_VIDEO_P1,
924e60a956SBrian Masney 	MSM8974_MNOC_MAS_VFE,
934e60a956SBrian Masney 	MSM8974_MNOC_TO_CNOC,
944e60a956SBrian Masney 	MSM8974_MNOC_TO_BIMC,
954e60a956SBrian Masney 	MSM8974_MNOC_SLV_CAMERA_CFG,
964e60a956SBrian Masney 	MSM8974_MNOC_SLV_DISPLAY_CFG,
974e60a956SBrian Masney 	MSM8974_MNOC_SLV_OCMEM_CFG,
984e60a956SBrian Masney 	MSM8974_MNOC_SLV_CPR_CFG,
994e60a956SBrian Masney 	MSM8974_MNOC_SLV_CPR_XPU_CFG,
1004e60a956SBrian Masney 	MSM8974_MNOC_SLV_MISC_CFG,
1014e60a956SBrian Masney 	MSM8974_MNOC_SLV_MISC_XPU_CFG,
1024e60a956SBrian Masney 	MSM8974_MNOC_SLV_VENUS_CFG,
1034e60a956SBrian Masney 	MSM8974_MNOC_SLV_GRAPHICS_3D_CFG,
1044e60a956SBrian Masney 	MSM8974_MNOC_SLV_MMSS_CLK_CFG,
1054e60a956SBrian Masney 	MSM8974_MNOC_SLV_MMSS_CLK_XPU_CFG,
1064e60a956SBrian Masney 	MSM8974_MNOC_SLV_MNOC_MPU_CFG,
1074e60a956SBrian Masney 	MSM8974_MNOC_SLV_ONOC_MPU_CFG,
1084e60a956SBrian Masney 	MSM8974_MNOC_SLV_SERVICE_MNOC,
1094e60a956SBrian Masney 	MSM8974_OCMEM_NOC_TO_OCMEM_VNOC,
1104e60a956SBrian Masney 	MSM8974_OCMEM_MAS_JPEG_OCMEM,
1114e60a956SBrian Masney 	MSM8974_OCMEM_MAS_MDP_OCMEM,
1124e60a956SBrian Masney 	MSM8974_OCMEM_MAS_VIDEO_P0_OCMEM,
1134e60a956SBrian Masney 	MSM8974_OCMEM_MAS_VIDEO_P1_OCMEM,
1144e60a956SBrian Masney 	MSM8974_OCMEM_MAS_VFE_OCMEM,
1154e60a956SBrian Masney 	MSM8974_OCMEM_MAS_CNOC_ONOC_CFG,
1164e60a956SBrian Masney 	MSM8974_OCMEM_SLV_SERVICE_ONOC,
1174e60a956SBrian Masney 	MSM8974_OCMEM_VNOC_TO_SNOC,
1184e60a956SBrian Masney 	MSM8974_OCMEM_VNOC_TO_OCMEM_NOC,
1194e60a956SBrian Masney 	MSM8974_OCMEM_VNOC_MAS_GFX3D,
1204e60a956SBrian Masney 	MSM8974_OCMEM_SLV_OCMEM,
1214e60a956SBrian Masney 	MSM8974_PNOC_MAS_PNOC_CFG,
1224e60a956SBrian Masney 	MSM8974_PNOC_MAS_SDCC_1,
1234e60a956SBrian Masney 	MSM8974_PNOC_MAS_SDCC_3,
1244e60a956SBrian Masney 	MSM8974_PNOC_MAS_SDCC_4,
1254e60a956SBrian Masney 	MSM8974_PNOC_MAS_SDCC_2,
1264e60a956SBrian Masney 	MSM8974_PNOC_MAS_TSIF,
1274e60a956SBrian Masney 	MSM8974_PNOC_MAS_BAM_DMA,
1284e60a956SBrian Masney 	MSM8974_PNOC_MAS_BLSP_2,
1294e60a956SBrian Masney 	MSM8974_PNOC_MAS_USB_HSIC,
1304e60a956SBrian Masney 	MSM8974_PNOC_MAS_BLSP_1,
1314e60a956SBrian Masney 	MSM8974_PNOC_MAS_USB_HS,
1324e60a956SBrian Masney 	MSM8974_PNOC_TO_SNOC,
1334e60a956SBrian Masney 	MSM8974_PNOC_SLV_SDCC_1,
1344e60a956SBrian Masney 	MSM8974_PNOC_SLV_SDCC_3,
1354e60a956SBrian Masney 	MSM8974_PNOC_SLV_SDCC_2,
1364e60a956SBrian Masney 	MSM8974_PNOC_SLV_SDCC_4,
1374e60a956SBrian Masney 	MSM8974_PNOC_SLV_TSIF,
1384e60a956SBrian Masney 	MSM8974_PNOC_SLV_BAM_DMA,
1394e60a956SBrian Masney 	MSM8974_PNOC_SLV_BLSP_2,
1404e60a956SBrian Masney 	MSM8974_PNOC_SLV_USB_HSIC,
1414e60a956SBrian Masney 	MSM8974_PNOC_SLV_BLSP_1,
1424e60a956SBrian Masney 	MSM8974_PNOC_SLV_USB_HS,
1434e60a956SBrian Masney 	MSM8974_PNOC_SLV_PDM,
1444e60a956SBrian Masney 	MSM8974_PNOC_SLV_PERIPH_APU_CFG,
1454e60a956SBrian Masney 	MSM8974_PNOC_SLV_PNOC_MPU_CFG,
1464e60a956SBrian Masney 	MSM8974_PNOC_SLV_PRNG,
1474e60a956SBrian Masney 	MSM8974_PNOC_SLV_SERVICE_PNOC,
1484e60a956SBrian Masney 	MSM8974_SNOC_MAS_LPASS_AHB,
1494e60a956SBrian Masney 	MSM8974_SNOC_MAS_QDSS_BAM,
1504e60a956SBrian Masney 	MSM8974_SNOC_MAS_SNOC_CFG,
1514e60a956SBrian Masney 	MSM8974_SNOC_TO_BIMC,
1524e60a956SBrian Masney 	MSM8974_SNOC_TO_CNOC,
1534e60a956SBrian Masney 	MSM8974_SNOC_TO_PNOC,
1544e60a956SBrian Masney 	MSM8974_SNOC_TO_OCMEM_VNOC,
1554e60a956SBrian Masney 	MSM8974_SNOC_MAS_CRYPTO_CORE0,
1564e60a956SBrian Masney 	MSM8974_SNOC_MAS_CRYPTO_CORE1,
1574e60a956SBrian Masney 	MSM8974_SNOC_MAS_LPASS_PROC,
1584e60a956SBrian Masney 	MSM8974_SNOC_MAS_MSS,
1594e60a956SBrian Masney 	MSM8974_SNOC_MAS_MSS_NAV,
1604e60a956SBrian Masney 	MSM8974_SNOC_MAS_OCMEM_DMA,
1614e60a956SBrian Masney 	MSM8974_SNOC_MAS_WCSS,
1624e60a956SBrian Masney 	MSM8974_SNOC_MAS_QDSS_ETR,
1634e60a956SBrian Masney 	MSM8974_SNOC_MAS_USB3,
1644e60a956SBrian Masney 	MSM8974_SNOC_SLV_AMPSS,
1654e60a956SBrian Masney 	MSM8974_SNOC_SLV_LPASS,
1664e60a956SBrian Masney 	MSM8974_SNOC_SLV_USB3,
1674e60a956SBrian Masney 	MSM8974_SNOC_SLV_WCSS,
1684e60a956SBrian Masney 	MSM8974_SNOC_SLV_OCIMEM,
1694e60a956SBrian Masney 	MSM8974_SNOC_SLV_SNOC_OCMEM,
1704e60a956SBrian Masney 	MSM8974_SNOC_SLV_SERVICE_SNOC,
1714e60a956SBrian Masney 	MSM8974_SNOC_SLV_QDSS_STM,
1724e60a956SBrian Masney };
1734e60a956SBrian Masney 
1744e60a956SBrian Masney #define RPM_BUS_MASTER_REQ	0x73616d62
1754e60a956SBrian Masney #define RPM_BUS_SLAVE_REQ	0x766c7362
1764e60a956SBrian Masney 
1774e60a956SBrian Masney #define to_msm8974_icc_provider(_provider) \
1784e60a956SBrian Masney 	container_of(_provider, struct msm8974_icc_provider, provider)
1794e60a956SBrian Masney 
1804e60a956SBrian Masney static const struct clk_bulk_data msm8974_icc_bus_clocks[] = {
1814e60a956SBrian Masney 	{ .id = "bus" },
1824e60a956SBrian Masney 	{ .id = "bus_a" },
1834e60a956SBrian Masney };
1844e60a956SBrian Masney 
1854e60a956SBrian Masney /**
1864e60a956SBrian Masney  * struct msm8974_icc_provider - Qualcomm specific interconnect provider
1874e60a956SBrian Masney  * @provider: generic interconnect provider
1884e60a956SBrian Masney  * @bus_clks: the clk_bulk_data table of bus clocks
1894e60a956SBrian Masney  * @num_clks: the total number of clk_bulk_data entries
1904e60a956SBrian Masney  */
1914e60a956SBrian Masney struct msm8974_icc_provider {
1924e60a956SBrian Masney 	struct icc_provider provider;
1934e60a956SBrian Masney 	struct clk_bulk_data *bus_clks;
1944e60a956SBrian Masney 	int num_clks;
1954e60a956SBrian Masney };
1964e60a956SBrian Masney 
1974e60a956SBrian Masney #define MSM8974_ICC_MAX_LINKS	3
1984e60a956SBrian Masney 
1994e60a956SBrian Masney /**
2004e60a956SBrian Masney  * struct msm8974_icc_node - Qualcomm specific interconnect nodes
2014e60a956SBrian Masney  * @name: the node name used in debugfs
2024e60a956SBrian Masney  * @id: a unique node identifier
2034e60a956SBrian Masney  * @links: an array of nodes where we can go next while traversing
2044e60a956SBrian Masney  * @num_links: the total number of @links
2054e60a956SBrian Masney  * @buswidth: width of the interconnect between a node and the bus (bytes)
2064e60a956SBrian Masney  * @mas_rpm_id:	RPM ID for devices that are bus masters
2074e60a956SBrian Masney  * @slv_rpm_id:	RPM ID for devices that are bus slaves
2084e60a956SBrian Masney  * @rate: current bus clock rate in Hz
2094e60a956SBrian Masney  */
2104e60a956SBrian Masney struct msm8974_icc_node {
2114e60a956SBrian Masney 	unsigned char *name;
2124e60a956SBrian Masney 	u16 id;
2134e60a956SBrian Masney 	u16 links[MSM8974_ICC_MAX_LINKS];
2144e60a956SBrian Masney 	u16 num_links;
2154e60a956SBrian Masney 	u16 buswidth;
2164e60a956SBrian Masney 	int mas_rpm_id;
2174e60a956SBrian Masney 	int slv_rpm_id;
2184e60a956SBrian Masney 	u64 rate;
2194e60a956SBrian Masney };
2204e60a956SBrian Masney 
2214e60a956SBrian Masney struct msm8974_icc_desc {
2222ccf33c0SKrzysztof Kozlowski 	struct msm8974_icc_node * const *nodes;
2234e60a956SBrian Masney 	size_t num_nodes;
2244e60a956SBrian Masney };
2254e60a956SBrian Masney 
2264e60a956SBrian Masney #define DEFINE_QNODE(_name, _id, _buswidth, _mas_rpm_id, _slv_rpm_id,	\
2274e60a956SBrian Masney 		     ...)						\
2284e60a956SBrian Masney 		static struct msm8974_icc_node _name = {		\
2294e60a956SBrian Masney 		.name = #_name,						\
2304e60a956SBrian Masney 		.id = _id,						\
2314e60a956SBrian Masney 		.buswidth = _buswidth,					\
2324e60a956SBrian Masney 		.mas_rpm_id = _mas_rpm_id,				\
2334e60a956SBrian Masney 		.slv_rpm_id = _slv_rpm_id,				\
2344e60a956SBrian Masney 		.num_links = ARRAY_SIZE(((int[]){ __VA_ARGS__ })),	\
2354e60a956SBrian Masney 		.links = { __VA_ARGS__ },				\
2364e60a956SBrian Masney 	}
2374e60a956SBrian Masney 
2384e60a956SBrian Masney DEFINE_QNODE(mas_ampss_m0, MSM8974_BIMC_MAS_AMPSS_M0, 8, 0, -1);
2394e60a956SBrian Masney DEFINE_QNODE(mas_ampss_m1, MSM8974_BIMC_MAS_AMPSS_M1, 8, 0, -1);
2404e60a956SBrian Masney DEFINE_QNODE(mas_mss_proc, MSM8974_BIMC_MAS_MSS_PROC, 8, 1, -1);
2414e60a956SBrian Masney DEFINE_QNODE(bimc_to_mnoc, MSM8974_BIMC_TO_MNOC, 8, 2, -1, MSM8974_BIMC_SLV_EBI_CH0);
2424e60a956SBrian Masney DEFINE_QNODE(bimc_to_snoc, MSM8974_BIMC_TO_SNOC, 8, 3, 2, MSM8974_SNOC_TO_BIMC, MSM8974_BIMC_SLV_EBI_CH0, MSM8974_BIMC_MAS_AMPSS_M0);
2434e60a956SBrian Masney DEFINE_QNODE(slv_ebi_ch0, MSM8974_BIMC_SLV_EBI_CH0, 8, -1, 0);
2444e60a956SBrian Masney DEFINE_QNODE(slv_ampss_l2, MSM8974_BIMC_SLV_AMPSS_L2, 8, -1, 1);
2454e60a956SBrian Masney 
2462ccf33c0SKrzysztof Kozlowski static struct msm8974_icc_node * const msm8974_bimc_nodes[] = {
2474e60a956SBrian Masney 	[BIMC_MAS_AMPSS_M0] = &mas_ampss_m0,
2484e60a956SBrian Masney 	[BIMC_MAS_AMPSS_M1] = &mas_ampss_m1,
2494e60a956SBrian Masney 	[BIMC_MAS_MSS_PROC] = &mas_mss_proc,
2504e60a956SBrian Masney 	[BIMC_TO_MNOC] = &bimc_to_mnoc,
2514e60a956SBrian Masney 	[BIMC_TO_SNOC] = &bimc_to_snoc,
2524e60a956SBrian Masney 	[BIMC_SLV_EBI_CH0] = &slv_ebi_ch0,
2534e60a956SBrian Masney 	[BIMC_SLV_AMPSS_L2] = &slv_ampss_l2,
2544e60a956SBrian Masney };
2554e60a956SBrian Masney 
2561625aaa3SKrzysztof Kozlowski static const struct msm8974_icc_desc msm8974_bimc = {
2574e60a956SBrian Masney 	.nodes = msm8974_bimc_nodes,
2584e60a956SBrian Masney 	.num_nodes = ARRAY_SIZE(msm8974_bimc_nodes),
2594e60a956SBrian Masney };
2604e60a956SBrian Masney 
2614e60a956SBrian Masney DEFINE_QNODE(mas_rpm_inst, MSM8974_CNOC_MAS_RPM_INST, 8, 45, -1);
2624e60a956SBrian Masney DEFINE_QNODE(mas_rpm_data, MSM8974_CNOC_MAS_RPM_DATA, 8, 46, -1);
2634e60a956SBrian Masney DEFINE_QNODE(mas_rpm_sys, MSM8974_CNOC_MAS_RPM_SYS, 8, 47, -1);
2644e60a956SBrian Masney DEFINE_QNODE(mas_dehr, MSM8974_CNOC_MAS_DEHR, 8, 48, -1);
2654e60a956SBrian Masney DEFINE_QNODE(mas_qdss_dap, MSM8974_CNOC_MAS_QDSS_DAP, 8, 49, -1);
2664e60a956SBrian Masney DEFINE_QNODE(mas_spdm, MSM8974_CNOC_MAS_SPDM, 8, 50, -1);
2674e60a956SBrian Masney DEFINE_QNODE(mas_tic, MSM8974_CNOC_MAS_TIC, 8, 51, -1);
2684e60a956SBrian Masney DEFINE_QNODE(slv_clk_ctl, MSM8974_CNOC_SLV_CLK_CTL, 8, -1, 47);
2694e60a956SBrian Masney DEFINE_QNODE(slv_cnoc_mss, MSM8974_CNOC_SLV_CNOC_MSS, 8, -1, 48);
2704e60a956SBrian Masney DEFINE_QNODE(slv_security, MSM8974_CNOC_SLV_SECURITY, 8, -1, 49);
2714e60a956SBrian Masney DEFINE_QNODE(slv_tcsr, MSM8974_CNOC_SLV_TCSR, 8, -1, 50);
2724e60a956SBrian Masney DEFINE_QNODE(slv_tlmm, MSM8974_CNOC_SLV_TLMM, 8, -1, 51);
2734e60a956SBrian Masney DEFINE_QNODE(slv_crypto_0_cfg, MSM8974_CNOC_SLV_CRYPTO_0_CFG, 8, -1, 52);
2744e60a956SBrian Masney DEFINE_QNODE(slv_crypto_1_cfg, MSM8974_CNOC_SLV_CRYPTO_1_CFG, 8, -1, 53);
2754e60a956SBrian Masney DEFINE_QNODE(slv_imem_cfg, MSM8974_CNOC_SLV_IMEM_CFG, 8, -1, 54);
2764e60a956SBrian Masney DEFINE_QNODE(slv_message_ram, MSM8974_CNOC_SLV_MESSAGE_RAM, 8, -1, 55);
2774e60a956SBrian Masney DEFINE_QNODE(slv_bimc_cfg, MSM8974_CNOC_SLV_BIMC_CFG, 8, -1, 56);
2784e60a956SBrian Masney DEFINE_QNODE(slv_boot_rom, MSM8974_CNOC_SLV_BOOT_ROM, 8, -1, 57);
2794e60a956SBrian Masney DEFINE_QNODE(slv_pmic_arb, MSM8974_CNOC_SLV_PMIC_ARB, 8, -1, 59);
2804e60a956SBrian Masney DEFINE_QNODE(slv_spdm_wrapper, MSM8974_CNOC_SLV_SPDM_WRAPPER, 8, -1, 60);
2814e60a956SBrian Masney DEFINE_QNODE(slv_dehr_cfg, MSM8974_CNOC_SLV_DEHR_CFG, 8, -1, 61);
2824e60a956SBrian Masney DEFINE_QNODE(slv_mpm, MSM8974_CNOC_SLV_MPM, 8, -1, 62);
2834e60a956SBrian Masney DEFINE_QNODE(slv_qdss_cfg, MSM8974_CNOC_SLV_QDSS_CFG, 8, -1, 63);
2844e60a956SBrian Masney DEFINE_QNODE(slv_rbcpr_cfg, MSM8974_CNOC_SLV_RBCPR_CFG, 8, -1, 64);
2854e60a956SBrian Masney DEFINE_QNODE(slv_rbcpr_qdss_apu_cfg, MSM8974_CNOC_SLV_RBCPR_QDSS_APU_CFG, 8, -1, 65);
2864e60a956SBrian Masney DEFINE_QNODE(cnoc_to_snoc, MSM8974_CNOC_TO_SNOC, 8, 52, 75);
2874e60a956SBrian Masney DEFINE_QNODE(slv_cnoc_onoc_cfg, MSM8974_CNOC_SLV_CNOC_ONOC_CFG, 8, -1, 68);
2884e60a956SBrian Masney DEFINE_QNODE(slv_cnoc_mnoc_mmss_cfg, MSM8974_CNOC_SLV_CNOC_MNOC_MMSS_CFG, 8, -1, 58);
2894e60a956SBrian Masney DEFINE_QNODE(slv_cnoc_mnoc_cfg, MSM8974_CNOC_SLV_CNOC_MNOC_CFG, 8, -1, 66);
2904e60a956SBrian Masney DEFINE_QNODE(slv_pnoc_cfg, MSM8974_CNOC_SLV_PNOC_CFG, 8, -1, 69);
2914e60a956SBrian Masney DEFINE_QNODE(slv_snoc_mpu_cfg, MSM8974_CNOC_SLV_SNOC_MPU_CFG, 8, -1, 67);
2924e60a956SBrian Masney DEFINE_QNODE(slv_snoc_cfg, MSM8974_CNOC_SLV_SNOC_CFG, 8, -1, 70);
2934e60a956SBrian Masney DEFINE_QNODE(slv_ebi1_dll_cfg, MSM8974_CNOC_SLV_EBI1_DLL_CFG, 8, -1, 71);
2944e60a956SBrian Masney DEFINE_QNODE(slv_phy_apu_cfg, MSM8974_CNOC_SLV_PHY_APU_CFG, 8, -1, 72);
2954e60a956SBrian Masney DEFINE_QNODE(slv_ebi1_phy_cfg, MSM8974_CNOC_SLV_EBI1_PHY_CFG, 8, -1, 73);
2964e60a956SBrian Masney DEFINE_QNODE(slv_rpm, MSM8974_CNOC_SLV_RPM, 8, -1, 74);
2974e60a956SBrian Masney DEFINE_QNODE(slv_service_cnoc, MSM8974_CNOC_SLV_SERVICE_CNOC, 8, -1, 76);
2984e60a956SBrian Masney 
2992ccf33c0SKrzysztof Kozlowski static struct msm8974_icc_node * const msm8974_cnoc_nodes[] = {
3004e60a956SBrian Masney 	[CNOC_MAS_RPM_INST] = &mas_rpm_inst,
3014e60a956SBrian Masney 	[CNOC_MAS_RPM_DATA] = &mas_rpm_data,
3024e60a956SBrian Masney 	[CNOC_MAS_RPM_SYS] = &mas_rpm_sys,
3034e60a956SBrian Masney 	[CNOC_MAS_DEHR] = &mas_dehr,
3044e60a956SBrian Masney 	[CNOC_MAS_QDSS_DAP] = &mas_qdss_dap,
3054e60a956SBrian Masney 	[CNOC_MAS_SPDM] = &mas_spdm,
3064e60a956SBrian Masney 	[CNOC_MAS_TIC] = &mas_tic,
3074e60a956SBrian Masney 	[CNOC_SLV_CLK_CTL] = &slv_clk_ctl,
3084e60a956SBrian Masney 	[CNOC_SLV_CNOC_MSS] = &slv_cnoc_mss,
3094e60a956SBrian Masney 	[CNOC_SLV_SECURITY] = &slv_security,
3104e60a956SBrian Masney 	[CNOC_SLV_TCSR] = &slv_tcsr,
3114e60a956SBrian Masney 	[CNOC_SLV_TLMM] = &slv_tlmm,
3124e60a956SBrian Masney 	[CNOC_SLV_CRYPTO_0_CFG] = &slv_crypto_0_cfg,
3134e60a956SBrian Masney 	[CNOC_SLV_CRYPTO_1_CFG] = &slv_crypto_1_cfg,
3144e60a956SBrian Masney 	[CNOC_SLV_IMEM_CFG] = &slv_imem_cfg,
3154e60a956SBrian Masney 	[CNOC_SLV_MESSAGE_RAM] = &slv_message_ram,
3164e60a956SBrian Masney 	[CNOC_SLV_BIMC_CFG] = &slv_bimc_cfg,
3174e60a956SBrian Masney 	[CNOC_SLV_BOOT_ROM] = &slv_boot_rom,
3184e60a956SBrian Masney 	[CNOC_SLV_PMIC_ARB] = &slv_pmic_arb,
3194e60a956SBrian Masney 	[CNOC_SLV_SPDM_WRAPPER] = &slv_spdm_wrapper,
3204e60a956SBrian Masney 	[CNOC_SLV_DEHR_CFG] = &slv_dehr_cfg,
3214e60a956SBrian Masney 	[CNOC_SLV_MPM] = &slv_mpm,
3224e60a956SBrian Masney 	[CNOC_SLV_QDSS_CFG] = &slv_qdss_cfg,
3234e60a956SBrian Masney 	[CNOC_SLV_RBCPR_CFG] = &slv_rbcpr_cfg,
3244e60a956SBrian Masney 	[CNOC_SLV_RBCPR_QDSS_APU_CFG] = &slv_rbcpr_qdss_apu_cfg,
3254e60a956SBrian Masney 	[CNOC_TO_SNOC] = &cnoc_to_snoc,
3264e60a956SBrian Masney 	[CNOC_SLV_CNOC_ONOC_CFG] = &slv_cnoc_onoc_cfg,
3274e60a956SBrian Masney 	[CNOC_SLV_CNOC_MNOC_MMSS_CFG] = &slv_cnoc_mnoc_mmss_cfg,
3284e60a956SBrian Masney 	[CNOC_SLV_CNOC_MNOC_CFG] = &slv_cnoc_mnoc_cfg,
3294e60a956SBrian Masney 	[CNOC_SLV_PNOC_CFG] = &slv_pnoc_cfg,
3304e60a956SBrian Masney 	[CNOC_SLV_SNOC_MPU_CFG] = &slv_snoc_mpu_cfg,
3314e60a956SBrian Masney 	[CNOC_SLV_SNOC_CFG] = &slv_snoc_cfg,
3324e60a956SBrian Masney 	[CNOC_SLV_EBI1_DLL_CFG] = &slv_ebi1_dll_cfg,
3334e60a956SBrian Masney 	[CNOC_SLV_PHY_APU_CFG] = &slv_phy_apu_cfg,
3344e60a956SBrian Masney 	[CNOC_SLV_EBI1_PHY_CFG] = &slv_ebi1_phy_cfg,
3354e60a956SBrian Masney 	[CNOC_SLV_RPM] = &slv_rpm,
3364e60a956SBrian Masney 	[CNOC_SLV_SERVICE_CNOC] = &slv_service_cnoc,
3374e60a956SBrian Masney };
3384e60a956SBrian Masney 
3391625aaa3SKrzysztof Kozlowski static const struct msm8974_icc_desc msm8974_cnoc = {
3404e60a956SBrian Masney 	.nodes = msm8974_cnoc_nodes,
3414e60a956SBrian Masney 	.num_nodes = ARRAY_SIZE(msm8974_cnoc_nodes),
3424e60a956SBrian Masney };
3434e60a956SBrian Masney 
3444e60a956SBrian Masney DEFINE_QNODE(mas_graphics_3d, MSM8974_MNOC_MAS_GRAPHICS_3D, 16, 6, -1, MSM8974_MNOC_TO_BIMC);
3454e60a956SBrian Masney DEFINE_QNODE(mas_jpeg, MSM8974_MNOC_MAS_JPEG, 16, 7, -1, MSM8974_MNOC_TO_BIMC);
3464e60a956SBrian Masney DEFINE_QNODE(mas_mdp_port0, MSM8974_MNOC_MAS_MDP_PORT0, 16, 8, -1, MSM8974_MNOC_TO_BIMC);
3474e60a956SBrian Masney DEFINE_QNODE(mas_video_p0, MSM8974_MNOC_MAS_VIDEO_P0, 16, 9, -1);
3484e60a956SBrian Masney DEFINE_QNODE(mas_video_p1, MSM8974_MNOC_MAS_VIDEO_P1, 16, 10, -1);
3494e60a956SBrian Masney DEFINE_QNODE(mas_vfe, MSM8974_MNOC_MAS_VFE, 16, 11, -1, MSM8974_MNOC_TO_BIMC);
3504e60a956SBrian Masney DEFINE_QNODE(mnoc_to_cnoc, MSM8974_MNOC_TO_CNOC, 16, 4, -1);
3514e60a956SBrian Masney DEFINE_QNODE(mnoc_to_bimc, MSM8974_MNOC_TO_BIMC, 16, -1, 16, MSM8974_BIMC_TO_MNOC);
3524e60a956SBrian Masney DEFINE_QNODE(slv_camera_cfg, MSM8974_MNOC_SLV_CAMERA_CFG, 16, -1, 3);
3534e60a956SBrian Masney DEFINE_QNODE(slv_display_cfg, MSM8974_MNOC_SLV_DISPLAY_CFG, 16, -1, 4);
3544e60a956SBrian Masney DEFINE_QNODE(slv_ocmem_cfg, MSM8974_MNOC_SLV_OCMEM_CFG, 16, -1, 5);
3554e60a956SBrian Masney DEFINE_QNODE(slv_cpr_cfg, MSM8974_MNOC_SLV_CPR_CFG, 16, -1, 6);
3564e60a956SBrian Masney DEFINE_QNODE(slv_cpr_xpu_cfg, MSM8974_MNOC_SLV_CPR_XPU_CFG, 16, -1, 7);
3574e60a956SBrian Masney DEFINE_QNODE(slv_misc_cfg, MSM8974_MNOC_SLV_MISC_CFG, 16, -1, 8);
3584e60a956SBrian Masney DEFINE_QNODE(slv_misc_xpu_cfg, MSM8974_MNOC_SLV_MISC_XPU_CFG, 16, -1, 9);
3594e60a956SBrian Masney DEFINE_QNODE(slv_venus_cfg, MSM8974_MNOC_SLV_VENUS_CFG, 16, -1, 10);
3604e60a956SBrian Masney DEFINE_QNODE(slv_graphics_3d_cfg, MSM8974_MNOC_SLV_GRAPHICS_3D_CFG, 16, -1, 11);
3614e60a956SBrian Masney DEFINE_QNODE(slv_mmss_clk_cfg, MSM8974_MNOC_SLV_MMSS_CLK_CFG, 16, -1, 12);
3624e60a956SBrian Masney DEFINE_QNODE(slv_mmss_clk_xpu_cfg, MSM8974_MNOC_SLV_MMSS_CLK_XPU_CFG, 16, -1, 13);
3634e60a956SBrian Masney DEFINE_QNODE(slv_mnoc_mpu_cfg, MSM8974_MNOC_SLV_MNOC_MPU_CFG, 16, -1, 14);
3644e60a956SBrian Masney DEFINE_QNODE(slv_onoc_mpu_cfg, MSM8974_MNOC_SLV_ONOC_MPU_CFG, 16, -1, 15);
3654e60a956SBrian Masney DEFINE_QNODE(slv_service_mnoc, MSM8974_MNOC_SLV_SERVICE_MNOC, 16, -1, 17);
3664e60a956SBrian Masney 
3672ccf33c0SKrzysztof Kozlowski static struct msm8974_icc_node * const msm8974_mnoc_nodes[] = {
3684e60a956SBrian Masney 	[MNOC_MAS_GRAPHICS_3D] = &mas_graphics_3d,
3694e60a956SBrian Masney 	[MNOC_MAS_JPEG] = &mas_jpeg,
3704e60a956SBrian Masney 	[MNOC_MAS_MDP_PORT0] = &mas_mdp_port0,
3714e60a956SBrian Masney 	[MNOC_MAS_VIDEO_P0] = &mas_video_p0,
3724e60a956SBrian Masney 	[MNOC_MAS_VIDEO_P1] = &mas_video_p1,
3734e60a956SBrian Masney 	[MNOC_MAS_VFE] = &mas_vfe,
3744e60a956SBrian Masney 	[MNOC_TO_CNOC] = &mnoc_to_cnoc,
3754e60a956SBrian Masney 	[MNOC_TO_BIMC] = &mnoc_to_bimc,
3764e60a956SBrian Masney 	[MNOC_SLV_CAMERA_CFG] = &slv_camera_cfg,
3774e60a956SBrian Masney 	[MNOC_SLV_DISPLAY_CFG] = &slv_display_cfg,
3784e60a956SBrian Masney 	[MNOC_SLV_OCMEM_CFG] = &slv_ocmem_cfg,
3794e60a956SBrian Masney 	[MNOC_SLV_CPR_CFG] = &slv_cpr_cfg,
3804e60a956SBrian Masney 	[MNOC_SLV_CPR_XPU_CFG] = &slv_cpr_xpu_cfg,
3814e60a956SBrian Masney 	[MNOC_SLV_MISC_CFG] = &slv_misc_cfg,
3824e60a956SBrian Masney 	[MNOC_SLV_MISC_XPU_CFG] = &slv_misc_xpu_cfg,
3834e60a956SBrian Masney 	[MNOC_SLV_VENUS_CFG] = &slv_venus_cfg,
3844e60a956SBrian Masney 	[MNOC_SLV_GRAPHICS_3D_CFG] = &slv_graphics_3d_cfg,
3854e60a956SBrian Masney 	[MNOC_SLV_MMSS_CLK_CFG] = &slv_mmss_clk_cfg,
3864e60a956SBrian Masney 	[MNOC_SLV_MMSS_CLK_XPU_CFG] = &slv_mmss_clk_xpu_cfg,
3874e60a956SBrian Masney 	[MNOC_SLV_MNOC_MPU_CFG] = &slv_mnoc_mpu_cfg,
3884e60a956SBrian Masney 	[MNOC_SLV_ONOC_MPU_CFG] = &slv_onoc_mpu_cfg,
3894e60a956SBrian Masney 	[MNOC_SLV_SERVICE_MNOC] = &slv_service_mnoc,
3904e60a956SBrian Masney };
3914e60a956SBrian Masney 
3921625aaa3SKrzysztof Kozlowski static const struct msm8974_icc_desc msm8974_mnoc = {
3934e60a956SBrian Masney 	.nodes = msm8974_mnoc_nodes,
3944e60a956SBrian Masney 	.num_nodes = ARRAY_SIZE(msm8974_mnoc_nodes),
3954e60a956SBrian Masney };
3964e60a956SBrian Masney 
3974e60a956SBrian Masney DEFINE_QNODE(ocmem_noc_to_ocmem_vnoc, MSM8974_OCMEM_NOC_TO_OCMEM_VNOC, 16, 54, 78, MSM8974_OCMEM_SLV_OCMEM);
3984e60a956SBrian Masney DEFINE_QNODE(mas_jpeg_ocmem, MSM8974_OCMEM_MAS_JPEG_OCMEM, 16, 13, -1);
3994e60a956SBrian Masney DEFINE_QNODE(mas_mdp_ocmem, MSM8974_OCMEM_MAS_MDP_OCMEM, 16, 14, -1);
4004e60a956SBrian Masney DEFINE_QNODE(mas_video_p0_ocmem, MSM8974_OCMEM_MAS_VIDEO_P0_OCMEM, 16, 15, -1);
4014e60a956SBrian Masney DEFINE_QNODE(mas_video_p1_ocmem, MSM8974_OCMEM_MAS_VIDEO_P1_OCMEM, 16, 16, -1);
4024e60a956SBrian Masney DEFINE_QNODE(mas_vfe_ocmem, MSM8974_OCMEM_MAS_VFE_OCMEM, 16, 17, -1);
4034e60a956SBrian Masney DEFINE_QNODE(mas_cnoc_onoc_cfg, MSM8974_OCMEM_MAS_CNOC_ONOC_CFG, 16, 12, -1);
4044e60a956SBrian Masney DEFINE_QNODE(slv_service_onoc, MSM8974_OCMEM_SLV_SERVICE_ONOC, 16, -1, 19);
4054e60a956SBrian Masney DEFINE_QNODE(slv_ocmem, MSM8974_OCMEM_SLV_OCMEM, 16, -1, 18);
4064e60a956SBrian Masney 
4074e60a956SBrian Masney /* Virtual NoC is needed for connection to OCMEM */
4084e60a956SBrian Masney DEFINE_QNODE(ocmem_vnoc_to_onoc, MSM8974_OCMEM_VNOC_TO_OCMEM_NOC, 16, 56, 79, MSM8974_OCMEM_NOC_TO_OCMEM_VNOC);
4094e60a956SBrian Masney DEFINE_QNODE(ocmem_vnoc_to_snoc, MSM8974_OCMEM_VNOC_TO_SNOC, 8, 57, 80);
4104e60a956SBrian Masney DEFINE_QNODE(mas_v_ocmem_gfx3d, MSM8974_OCMEM_VNOC_MAS_GFX3D, 8, 55, -1, MSM8974_OCMEM_VNOC_TO_OCMEM_NOC);
4114e60a956SBrian Masney 
4122ccf33c0SKrzysztof Kozlowski static struct msm8974_icc_node * const msm8974_onoc_nodes[] = {
4134e60a956SBrian Masney 	[OCMEM_NOC_TO_OCMEM_VNOC] = &ocmem_noc_to_ocmem_vnoc,
4144e60a956SBrian Masney 	[OCMEM_MAS_JPEG_OCMEM] = &mas_jpeg_ocmem,
4154e60a956SBrian Masney 	[OCMEM_MAS_MDP_OCMEM] = &mas_mdp_ocmem,
4164e60a956SBrian Masney 	[OCMEM_MAS_VIDEO_P0_OCMEM] = &mas_video_p0_ocmem,
4174e60a956SBrian Masney 	[OCMEM_MAS_VIDEO_P1_OCMEM] = &mas_video_p1_ocmem,
4184e60a956SBrian Masney 	[OCMEM_MAS_VFE_OCMEM] = &mas_vfe_ocmem,
4194e60a956SBrian Masney 	[OCMEM_MAS_CNOC_ONOC_CFG] = &mas_cnoc_onoc_cfg,
4204e60a956SBrian Masney 	[OCMEM_SLV_SERVICE_ONOC] = &slv_service_onoc,
4214e60a956SBrian Masney 	[OCMEM_VNOC_TO_SNOC] = &ocmem_vnoc_to_snoc,
4224e60a956SBrian Masney 	[OCMEM_VNOC_TO_OCMEM_NOC] = &ocmem_vnoc_to_onoc,
4234e60a956SBrian Masney 	[OCMEM_VNOC_MAS_GFX3D] = &mas_v_ocmem_gfx3d,
4244e60a956SBrian Masney 	[OCMEM_SLV_OCMEM] = &slv_ocmem,
4254e60a956SBrian Masney };
4264e60a956SBrian Masney 
4271625aaa3SKrzysztof Kozlowski static const struct msm8974_icc_desc msm8974_onoc = {
4284e60a956SBrian Masney 	.nodes = msm8974_onoc_nodes,
4294e60a956SBrian Masney 	.num_nodes = ARRAY_SIZE(msm8974_onoc_nodes),
4304e60a956SBrian Masney };
4314e60a956SBrian Masney 
4324e60a956SBrian Masney DEFINE_QNODE(mas_pnoc_cfg, MSM8974_PNOC_MAS_PNOC_CFG, 8, 43, -1);
4334e60a956SBrian Masney DEFINE_QNODE(mas_sdcc_1, MSM8974_PNOC_MAS_SDCC_1, 8, 33, -1, MSM8974_PNOC_TO_SNOC);
4344e60a956SBrian Masney DEFINE_QNODE(mas_sdcc_3, MSM8974_PNOC_MAS_SDCC_3, 8, 34, -1, MSM8974_PNOC_TO_SNOC);
4354e60a956SBrian Masney DEFINE_QNODE(mas_sdcc_4, MSM8974_PNOC_MAS_SDCC_4, 8, 36, -1, MSM8974_PNOC_TO_SNOC);
4364e60a956SBrian Masney DEFINE_QNODE(mas_sdcc_2, MSM8974_PNOC_MAS_SDCC_2, 8, 35, -1, MSM8974_PNOC_TO_SNOC);
4374e60a956SBrian Masney DEFINE_QNODE(mas_tsif, MSM8974_PNOC_MAS_TSIF, 8, 37, -1, MSM8974_PNOC_TO_SNOC);
4384e60a956SBrian Masney DEFINE_QNODE(mas_bam_dma, MSM8974_PNOC_MAS_BAM_DMA, 8, 38, -1);
4394e60a956SBrian Masney DEFINE_QNODE(mas_blsp_2, MSM8974_PNOC_MAS_BLSP_2, 8, 39, -1, MSM8974_PNOC_TO_SNOC);
4404e60a956SBrian Masney DEFINE_QNODE(mas_usb_hsic, MSM8974_PNOC_MAS_USB_HSIC, 8, 40, -1, MSM8974_PNOC_TO_SNOC);
4414e60a956SBrian Masney DEFINE_QNODE(mas_blsp_1, MSM8974_PNOC_MAS_BLSP_1, 8, 41, -1, MSM8974_PNOC_TO_SNOC);
4424e60a956SBrian Masney DEFINE_QNODE(mas_usb_hs, MSM8974_PNOC_MAS_USB_HS, 8, 42, -1, MSM8974_PNOC_TO_SNOC);
4434e60a956SBrian Masney DEFINE_QNODE(pnoc_to_snoc, MSM8974_PNOC_TO_SNOC, 8, 44, 45, MSM8974_SNOC_TO_PNOC, MSM8974_PNOC_SLV_PRNG);
4444e60a956SBrian Masney DEFINE_QNODE(slv_sdcc_1, MSM8974_PNOC_SLV_SDCC_1, 8, -1, 31);
4454e60a956SBrian Masney DEFINE_QNODE(slv_sdcc_3, MSM8974_PNOC_SLV_SDCC_3, 8, -1, 32);
4464e60a956SBrian Masney DEFINE_QNODE(slv_sdcc_2, MSM8974_PNOC_SLV_SDCC_2, 8, -1, 33);
4474e60a956SBrian Masney DEFINE_QNODE(slv_sdcc_4, MSM8974_PNOC_SLV_SDCC_4, 8, -1, 34);
4484e60a956SBrian Masney DEFINE_QNODE(slv_tsif, MSM8974_PNOC_SLV_TSIF, 8, -1, 35);
4494e60a956SBrian Masney DEFINE_QNODE(slv_bam_dma, MSM8974_PNOC_SLV_BAM_DMA, 8, -1, 36);
4504e60a956SBrian Masney DEFINE_QNODE(slv_blsp_2, MSM8974_PNOC_SLV_BLSP_2, 8, -1, 37);
4514e60a956SBrian Masney DEFINE_QNODE(slv_usb_hsic, MSM8974_PNOC_SLV_USB_HSIC, 8, -1, 38);
4524e60a956SBrian Masney DEFINE_QNODE(slv_blsp_1, MSM8974_PNOC_SLV_BLSP_1, 8, -1, 39);
4534e60a956SBrian Masney DEFINE_QNODE(slv_usb_hs, MSM8974_PNOC_SLV_USB_HS, 8, -1, 40);
4544e60a956SBrian Masney DEFINE_QNODE(slv_pdm, MSM8974_PNOC_SLV_PDM, 8, -1, 41);
4554e60a956SBrian Masney DEFINE_QNODE(slv_periph_apu_cfg, MSM8974_PNOC_SLV_PERIPH_APU_CFG, 8, -1, 42);
4564e60a956SBrian Masney DEFINE_QNODE(slv_pnoc_mpu_cfg, MSM8974_PNOC_SLV_PNOC_MPU_CFG, 8, -1, 43);
4574e60a956SBrian Masney DEFINE_QNODE(slv_prng, MSM8974_PNOC_SLV_PRNG, 8, -1, 44, MSM8974_PNOC_TO_SNOC);
4584e60a956SBrian Masney DEFINE_QNODE(slv_service_pnoc, MSM8974_PNOC_SLV_SERVICE_PNOC, 8, -1, 46);
4594e60a956SBrian Masney 
4602ccf33c0SKrzysztof Kozlowski static struct msm8974_icc_node * const msm8974_pnoc_nodes[] = {
4614e60a956SBrian Masney 	[PNOC_MAS_PNOC_CFG] = &mas_pnoc_cfg,
4624e60a956SBrian Masney 	[PNOC_MAS_SDCC_1] = &mas_sdcc_1,
4634e60a956SBrian Masney 	[PNOC_MAS_SDCC_3] = &mas_sdcc_3,
4644e60a956SBrian Masney 	[PNOC_MAS_SDCC_4] = &mas_sdcc_4,
4654e60a956SBrian Masney 	[PNOC_MAS_SDCC_2] = &mas_sdcc_2,
4664e60a956SBrian Masney 	[PNOC_MAS_TSIF] = &mas_tsif,
4674e60a956SBrian Masney 	[PNOC_MAS_BAM_DMA] = &mas_bam_dma,
4684e60a956SBrian Masney 	[PNOC_MAS_BLSP_2] = &mas_blsp_2,
4694e60a956SBrian Masney 	[PNOC_MAS_USB_HSIC] = &mas_usb_hsic,
4704e60a956SBrian Masney 	[PNOC_MAS_BLSP_1] = &mas_blsp_1,
4714e60a956SBrian Masney 	[PNOC_MAS_USB_HS] = &mas_usb_hs,
4724e60a956SBrian Masney 	[PNOC_TO_SNOC] = &pnoc_to_snoc,
4734e60a956SBrian Masney 	[PNOC_SLV_SDCC_1] = &slv_sdcc_1,
4744e60a956SBrian Masney 	[PNOC_SLV_SDCC_3] = &slv_sdcc_3,
4754e60a956SBrian Masney 	[PNOC_SLV_SDCC_2] = &slv_sdcc_2,
4764e60a956SBrian Masney 	[PNOC_SLV_SDCC_4] = &slv_sdcc_4,
4774e60a956SBrian Masney 	[PNOC_SLV_TSIF] = &slv_tsif,
4784e60a956SBrian Masney 	[PNOC_SLV_BAM_DMA] = &slv_bam_dma,
4794e60a956SBrian Masney 	[PNOC_SLV_BLSP_2] = &slv_blsp_2,
4804e60a956SBrian Masney 	[PNOC_SLV_USB_HSIC] = &slv_usb_hsic,
4814e60a956SBrian Masney 	[PNOC_SLV_BLSP_1] = &slv_blsp_1,
4824e60a956SBrian Masney 	[PNOC_SLV_USB_HS] = &slv_usb_hs,
4834e60a956SBrian Masney 	[PNOC_SLV_PDM] = &slv_pdm,
4844e60a956SBrian Masney 	[PNOC_SLV_PERIPH_APU_CFG] = &slv_periph_apu_cfg,
4854e60a956SBrian Masney 	[PNOC_SLV_PNOC_MPU_CFG] = &slv_pnoc_mpu_cfg,
4864e60a956SBrian Masney 	[PNOC_SLV_PRNG] = &slv_prng,
4874e60a956SBrian Masney 	[PNOC_SLV_SERVICE_PNOC] = &slv_service_pnoc,
4884e60a956SBrian Masney };
4894e60a956SBrian Masney 
4901625aaa3SKrzysztof Kozlowski static const struct msm8974_icc_desc msm8974_pnoc = {
4914e60a956SBrian Masney 	.nodes = msm8974_pnoc_nodes,
4924e60a956SBrian Masney 	.num_nodes = ARRAY_SIZE(msm8974_pnoc_nodes),
4934e60a956SBrian Masney };
4944e60a956SBrian Masney 
4954e60a956SBrian Masney DEFINE_QNODE(mas_lpass_ahb, MSM8974_SNOC_MAS_LPASS_AHB, 8, 18, -1);
4964e60a956SBrian Masney DEFINE_QNODE(mas_qdss_bam, MSM8974_SNOC_MAS_QDSS_BAM, 8, 19, -1);
4974e60a956SBrian Masney DEFINE_QNODE(mas_snoc_cfg, MSM8974_SNOC_MAS_SNOC_CFG, 8, 20, -1);
4984e60a956SBrian Masney DEFINE_QNODE(snoc_to_bimc, MSM8974_SNOC_TO_BIMC, 8, 21, 24, MSM8974_BIMC_TO_SNOC);
4994e60a956SBrian Masney DEFINE_QNODE(snoc_to_cnoc, MSM8974_SNOC_TO_CNOC, 8, 22, 25);
5004e60a956SBrian Masney DEFINE_QNODE(snoc_to_pnoc, MSM8974_SNOC_TO_PNOC, 8, 29, 28, MSM8974_PNOC_TO_SNOC);
5014e60a956SBrian Masney DEFINE_QNODE(snoc_to_ocmem_vnoc, MSM8974_SNOC_TO_OCMEM_VNOC, 8, 53, 77, MSM8974_OCMEM_VNOC_TO_OCMEM_NOC);
5024e60a956SBrian Masney DEFINE_QNODE(mas_crypto_core0, MSM8974_SNOC_MAS_CRYPTO_CORE0, 8, 23, -1, MSM8974_SNOC_TO_BIMC);
5034e60a956SBrian Masney DEFINE_QNODE(mas_crypto_core1, MSM8974_SNOC_MAS_CRYPTO_CORE1, 8, 24, -1);
5044e60a956SBrian Masney DEFINE_QNODE(mas_lpass_proc, MSM8974_SNOC_MAS_LPASS_PROC, 8, 25, -1, MSM8974_SNOC_TO_OCMEM_VNOC);
5054e60a956SBrian Masney DEFINE_QNODE(mas_mss, MSM8974_SNOC_MAS_MSS, 8, 26, -1);
5064e60a956SBrian Masney DEFINE_QNODE(mas_mss_nav, MSM8974_SNOC_MAS_MSS_NAV, 8, 27, -1);
5074e60a956SBrian Masney DEFINE_QNODE(mas_ocmem_dma, MSM8974_SNOC_MAS_OCMEM_DMA, 8, 28, -1);
5084e60a956SBrian Masney DEFINE_QNODE(mas_wcss, MSM8974_SNOC_MAS_WCSS, 8, 30, -1);
5094e60a956SBrian Masney DEFINE_QNODE(mas_qdss_etr, MSM8974_SNOC_MAS_QDSS_ETR, 8, 31, -1);
5104e60a956SBrian Masney DEFINE_QNODE(mas_usb3, MSM8974_SNOC_MAS_USB3, 8, 32, -1, MSM8974_SNOC_TO_BIMC);
5114e60a956SBrian Masney DEFINE_QNODE(slv_ampss, MSM8974_SNOC_SLV_AMPSS, 8, -1, 20);
5124e60a956SBrian Masney DEFINE_QNODE(slv_lpass, MSM8974_SNOC_SLV_LPASS, 8, -1, 21);
5134e60a956SBrian Masney DEFINE_QNODE(slv_usb3, MSM8974_SNOC_SLV_USB3, 8, -1, 22);
5144e60a956SBrian Masney DEFINE_QNODE(slv_wcss, MSM8974_SNOC_SLV_WCSS, 8, -1, 23);
5154e60a956SBrian Masney DEFINE_QNODE(slv_ocimem, MSM8974_SNOC_SLV_OCIMEM, 8, -1, 26);
5164e60a956SBrian Masney DEFINE_QNODE(slv_snoc_ocmem, MSM8974_SNOC_SLV_SNOC_OCMEM, 8, -1, 27);
5174e60a956SBrian Masney DEFINE_QNODE(slv_service_snoc, MSM8974_SNOC_SLV_SERVICE_SNOC, 8, -1, 29);
5184e60a956SBrian Masney DEFINE_QNODE(slv_qdss_stm, MSM8974_SNOC_SLV_QDSS_STM, 8, -1, 30);
5194e60a956SBrian Masney 
5202ccf33c0SKrzysztof Kozlowski static struct msm8974_icc_node * const msm8974_snoc_nodes[] = {
5214e60a956SBrian Masney 	[SNOC_MAS_LPASS_AHB] = &mas_lpass_ahb,
5224e60a956SBrian Masney 	[SNOC_MAS_QDSS_BAM] = &mas_qdss_bam,
5234e60a956SBrian Masney 	[SNOC_MAS_SNOC_CFG] = &mas_snoc_cfg,
5244e60a956SBrian Masney 	[SNOC_TO_BIMC] = &snoc_to_bimc,
5254e60a956SBrian Masney 	[SNOC_TO_CNOC] = &snoc_to_cnoc,
5264e60a956SBrian Masney 	[SNOC_TO_PNOC] = &snoc_to_pnoc,
5274e60a956SBrian Masney 	[SNOC_TO_OCMEM_VNOC] = &snoc_to_ocmem_vnoc,
5284e60a956SBrian Masney 	[SNOC_MAS_CRYPTO_CORE0] = &mas_crypto_core0,
5294e60a956SBrian Masney 	[SNOC_MAS_CRYPTO_CORE1] = &mas_crypto_core1,
5304e60a956SBrian Masney 	[SNOC_MAS_LPASS_PROC] = &mas_lpass_proc,
5314e60a956SBrian Masney 	[SNOC_MAS_MSS] = &mas_mss,
5324e60a956SBrian Masney 	[SNOC_MAS_MSS_NAV] = &mas_mss_nav,
5334e60a956SBrian Masney 	[SNOC_MAS_OCMEM_DMA] = &mas_ocmem_dma,
5344e60a956SBrian Masney 	[SNOC_MAS_WCSS] = &mas_wcss,
5354e60a956SBrian Masney 	[SNOC_MAS_QDSS_ETR] = &mas_qdss_etr,
5364e60a956SBrian Masney 	[SNOC_MAS_USB3] = &mas_usb3,
5374e60a956SBrian Masney 	[SNOC_SLV_AMPSS] = &slv_ampss,
5384e60a956SBrian Masney 	[SNOC_SLV_LPASS] = &slv_lpass,
5394e60a956SBrian Masney 	[SNOC_SLV_USB3] = &slv_usb3,
5404e60a956SBrian Masney 	[SNOC_SLV_WCSS] = &slv_wcss,
5414e60a956SBrian Masney 	[SNOC_SLV_OCIMEM] = &slv_ocimem,
5424e60a956SBrian Masney 	[SNOC_SLV_SNOC_OCMEM] = &slv_snoc_ocmem,
5434e60a956SBrian Masney 	[SNOC_SLV_SERVICE_SNOC] = &slv_service_snoc,
5444e60a956SBrian Masney 	[SNOC_SLV_QDSS_STM] = &slv_qdss_stm,
5454e60a956SBrian Masney };
5464e60a956SBrian Masney 
5471625aaa3SKrzysztof Kozlowski static const struct msm8974_icc_desc msm8974_snoc = {
5484e60a956SBrian Masney 	.nodes = msm8974_snoc_nodes,
5494e60a956SBrian Masney 	.num_nodes = ARRAY_SIZE(msm8974_snoc_nodes),
5504e60a956SBrian Masney };
5514e60a956SBrian Masney 
5524e60a956SBrian Masney static void msm8974_icc_rpm_smd_send(struct device *dev, int rsc_type,
5534e60a956SBrian Masney 				     char *name, int id, u64 val)
5544e60a956SBrian Masney {
5554e60a956SBrian Masney 	int ret;
5564e60a956SBrian Masney 
5574e60a956SBrian Masney 	if (id == -1)
5584e60a956SBrian Masney 		return;
5594e60a956SBrian Masney 
5604e60a956SBrian Masney 	/*
5614e60a956SBrian Masney 	 * Setting the bandwidth requests for some nodes fails and this same
5624e60a956SBrian Masney 	 * behavior occurs on the downstream MSM 3.4 kernel sources based on
5634e60a956SBrian Masney 	 * errors like this in that kernel:
5644e60a956SBrian Masney 	 *
5654e60a956SBrian Masney 	 *   msm_rpm_get_error_from_ack(): RPM NACK Unsupported resource
5664e60a956SBrian Masney 	 *   AXI: msm_bus_rpm_req(): RPM: Ack failed
5674e60a956SBrian Masney 	 *   AXI: msm_bus_rpm_commit_arb(): RPM: Req fail: mas:32, bw:240000000
5684e60a956SBrian Masney 	 *
5694e60a956SBrian Masney 	 * Since there's no publicly available documentation for this hardware,
5704e60a956SBrian Masney 	 * and the bandwidth for some nodes in the path can be set properly,
5714e60a956SBrian Masney 	 * let's not return an error.
5724e60a956SBrian Masney 	 */
5734e60a956SBrian Masney 	ret = qcom_icc_rpm_smd_send(QCOM_SMD_RPM_ACTIVE_STATE, rsc_type, id,
5744e60a956SBrian Masney 				    val);
5754e60a956SBrian Masney 	if (ret)
5764e60a956SBrian Masney 		dev_dbg(dev, "Cannot set bandwidth for node %s (%d): %d\n",
5774e60a956SBrian Masney 			name, id, ret);
5784e60a956SBrian Masney }
5794e60a956SBrian Masney 
5804e60a956SBrian Masney static int msm8974_icc_set(struct icc_node *src, struct icc_node *dst)
5814e60a956SBrian Masney {
5824e60a956SBrian Masney 	struct msm8974_icc_node *src_qn, *dst_qn;
5834e60a956SBrian Masney 	struct msm8974_icc_provider *qp;
5844e60a956SBrian Masney 	u64 sum_bw, max_peak_bw, rate;
5854e60a956SBrian Masney 	u32 agg_avg = 0, agg_peak = 0;
5864e60a956SBrian Masney 	struct icc_provider *provider;
5874e60a956SBrian Masney 	struct icc_node *n;
5884e60a956SBrian Masney 	int ret, i;
5894e60a956SBrian Masney 
5904e60a956SBrian Masney 	src_qn = src->data;
5914e60a956SBrian Masney 	dst_qn = dst->data;
5924e60a956SBrian Masney 	provider = src->provider;
5934e60a956SBrian Masney 	qp = to_msm8974_icc_provider(provider);
5944e60a956SBrian Masney 
5954e60a956SBrian Masney 	list_for_each_entry(n, &provider->nodes, node_list)
596b92c35e1SGeorgi Djakov 		provider->aggregate(n, 0, n->avg_bw, n->peak_bw,
5974e60a956SBrian Masney 				    &agg_avg, &agg_peak);
5984e60a956SBrian Masney 
5994e60a956SBrian Masney 	sum_bw = icc_units_to_bps(agg_avg);
6004e60a956SBrian Masney 	max_peak_bw = icc_units_to_bps(agg_peak);
6014e60a956SBrian Masney 
6024e60a956SBrian Masney 	/* Set bandwidth on source node */
6034e60a956SBrian Masney 	msm8974_icc_rpm_smd_send(provider->dev, RPM_BUS_MASTER_REQ,
6044e60a956SBrian Masney 				 src_qn->name, src_qn->mas_rpm_id, sum_bw);
6054e60a956SBrian Masney 
6064e60a956SBrian Masney 	msm8974_icc_rpm_smd_send(provider->dev, RPM_BUS_SLAVE_REQ,
6074e60a956SBrian Masney 				 src_qn->name, src_qn->slv_rpm_id, sum_bw);
6084e60a956SBrian Masney 
6094e60a956SBrian Masney 	/* Set bandwidth on destination node */
6104e60a956SBrian Masney 	msm8974_icc_rpm_smd_send(provider->dev, RPM_BUS_MASTER_REQ,
6114e60a956SBrian Masney 				 dst_qn->name, dst_qn->mas_rpm_id, sum_bw);
6124e60a956SBrian Masney 
6134e60a956SBrian Masney 	msm8974_icc_rpm_smd_send(provider->dev, RPM_BUS_SLAVE_REQ,
6144e60a956SBrian Masney 				 dst_qn->name, dst_qn->slv_rpm_id, sum_bw);
6154e60a956SBrian Masney 
6164e60a956SBrian Masney 	rate = max(sum_bw, max_peak_bw);
6174e60a956SBrian Masney 
6184e60a956SBrian Masney 	do_div(rate, src_qn->buswidth);
6194e60a956SBrian Masney 
6207381e27bSGeorgi Djakov 	rate = min_t(u32, rate, INT_MAX);
6217381e27bSGeorgi Djakov 
6224e60a956SBrian Masney 	if (src_qn->rate == rate)
6234e60a956SBrian Masney 		return 0;
6244e60a956SBrian Masney 
6254e60a956SBrian Masney 	for (i = 0; i < qp->num_clks; i++) {
6264e60a956SBrian Masney 		ret = clk_set_rate(qp->bus_clks[i].clk, rate);
6274e60a956SBrian Masney 		if (ret) {
6284e60a956SBrian Masney 			dev_err(provider->dev, "%s clk_set_rate error: %d\n",
6294e60a956SBrian Masney 				qp->bus_clks[i].id, ret);
6304e60a956SBrian Masney 			ret = 0;
6314e60a956SBrian Masney 		}
6324e60a956SBrian Masney 	}
6334e60a956SBrian Masney 
6344e60a956SBrian Masney 	src_qn->rate = rate;
6354e60a956SBrian Masney 
6364e60a956SBrian Masney 	return 0;
6374e60a956SBrian Masney }
6384e60a956SBrian Masney 
6399caf2d95SGeorgi Djakov static int msm8974_get_bw(struct icc_node *node, u32 *avg, u32 *peak)
6409caf2d95SGeorgi Djakov {
6419caf2d95SGeorgi Djakov 	*avg = 0;
6429caf2d95SGeorgi Djakov 	*peak = 0;
6439caf2d95SGeorgi Djakov 
6449caf2d95SGeorgi Djakov 	return 0;
6459caf2d95SGeorgi Djakov }
6469caf2d95SGeorgi Djakov 
6474e60a956SBrian Masney static int msm8974_icc_probe(struct platform_device *pdev)
6484e60a956SBrian Masney {
6494e60a956SBrian Masney 	const struct msm8974_icc_desc *desc;
6502ccf33c0SKrzysztof Kozlowski 	struct msm8974_icc_node * const *qnodes;
6514e60a956SBrian Masney 	struct msm8974_icc_provider *qp;
6524e60a956SBrian Masney 	struct device *dev = &pdev->dev;
6534e60a956SBrian Masney 	struct icc_onecell_data *data;
6544e60a956SBrian Masney 	struct icc_provider *provider;
655ad3703acSGeorgi Djakov 	struct icc_node *node;
6564e60a956SBrian Masney 	size_t num_nodes, i;
6574e60a956SBrian Masney 	int ret;
6584e60a956SBrian Masney 
6594e60a956SBrian Masney 	/* wait for the RPM proxy */
6604e60a956SBrian Masney 	if (!qcom_icc_rpm_smd_available())
6614e60a956SBrian Masney 		return -EPROBE_DEFER;
6624e60a956SBrian Masney 
6634e60a956SBrian Masney 	desc = of_device_get_match_data(dev);
6644e60a956SBrian Masney 	if (!desc)
6654e60a956SBrian Masney 		return -EINVAL;
6664e60a956SBrian Masney 
6674e60a956SBrian Masney 	qnodes = desc->nodes;
6684e60a956SBrian Masney 	num_nodes = desc->num_nodes;
6694e60a956SBrian Masney 
6704e60a956SBrian Masney 	qp = devm_kzalloc(dev, sizeof(*qp), GFP_KERNEL);
6714e60a956SBrian Masney 	if (!qp)
6724e60a956SBrian Masney 		return -ENOMEM;
6734e60a956SBrian Masney 
6744e60a956SBrian Masney 	data = devm_kzalloc(dev, struct_size(data, nodes, num_nodes),
6754e60a956SBrian Masney 			    GFP_KERNEL);
6764e60a956SBrian Masney 	if (!data)
6774e60a956SBrian Masney 		return -ENOMEM;
6784e60a956SBrian Masney 
6794e60a956SBrian Masney 	qp->bus_clks = devm_kmemdup(dev, msm8974_icc_bus_clocks,
6804e60a956SBrian Masney 				    sizeof(msm8974_icc_bus_clocks), GFP_KERNEL);
6814e60a956SBrian Masney 	if (!qp->bus_clks)
6824e60a956SBrian Masney 		return -ENOMEM;
6834e60a956SBrian Masney 
6844e60a956SBrian Masney 	qp->num_clks = ARRAY_SIZE(msm8974_icc_bus_clocks);
6854e60a956SBrian Masney 	ret = devm_clk_bulk_get(dev, qp->num_clks, qp->bus_clks);
6864e60a956SBrian Masney 	if (ret)
6874e60a956SBrian Masney 		return ret;
6884e60a956SBrian Masney 
6894e60a956SBrian Masney 	ret = clk_bulk_prepare_enable(qp->num_clks, qp->bus_clks);
6904e60a956SBrian Masney 	if (ret)
6914e60a956SBrian Masney 		return ret;
6924e60a956SBrian Masney 
6934e60a956SBrian Masney 	provider = &qp->provider;
6944e60a956SBrian Masney 	provider->dev = dev;
6954e60a956SBrian Masney 	provider->set = msm8974_icc_set;
696b92c35e1SGeorgi Djakov 	provider->aggregate = icc_std_aggregate;
6974e60a956SBrian Masney 	provider->xlate = of_icc_xlate_onecell;
6984e60a956SBrian Masney 	provider->data = data;
6999caf2d95SGeorgi Djakov 	provider->get_bw = msm8974_get_bw;
7004e60a956SBrian Masney 
701bfe7bcd2SJohan Hovold 	icc_provider_init(provider);
7024e60a956SBrian Masney 
7034e60a956SBrian Masney 	for (i = 0; i < num_nodes; i++) {
7044e60a956SBrian Masney 		size_t j;
7054e60a956SBrian Masney 
7064e60a956SBrian Masney 		node = icc_node_create(qnodes[i]->id);
7074e60a956SBrian Masney 		if (IS_ERR(node)) {
7084e60a956SBrian Masney 			ret = PTR_ERR(node);
709bfe7bcd2SJohan Hovold 			goto err_remove_nodes;
7104e60a956SBrian Masney 		}
7114e60a956SBrian Masney 
7124e60a956SBrian Masney 		node->name = qnodes[i]->name;
7134e60a956SBrian Masney 		node->data = qnodes[i];
7144e60a956SBrian Masney 		icc_node_add(node, provider);
7154e60a956SBrian Masney 
7164e60a956SBrian Masney 		dev_dbg(dev, "registered node %s\n", node->name);
7174e60a956SBrian Masney 
7184e60a956SBrian Masney 		/* populate links */
7194e60a956SBrian Masney 		for (j = 0; j < qnodes[i]->num_links; j++)
7204e60a956SBrian Masney 			icc_link_create(node, qnodes[i]->links[j]);
7214e60a956SBrian Masney 
7224e60a956SBrian Masney 		data->nodes[i] = node;
7234e60a956SBrian Masney 	}
7244e60a956SBrian Masney 	data->num_nodes = num_nodes;
7254e60a956SBrian Masney 
726bfe7bcd2SJohan Hovold 	ret = icc_provider_register(provider);
727bfe7bcd2SJohan Hovold 	if (ret)
728bfe7bcd2SJohan Hovold 		goto err_remove_nodes;
729bfe7bcd2SJohan Hovold 
7304e60a956SBrian Masney 	platform_set_drvdata(pdev, qp);
7314e60a956SBrian Masney 
7324e60a956SBrian Masney 	return 0;
7334e60a956SBrian Masney 
734bfe7bcd2SJohan Hovold err_remove_nodes:
735ad3703acSGeorgi Djakov 	icc_nodes_remove(provider);
7364e60a956SBrian Masney 	clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks);
7374e60a956SBrian Masney 
7384e60a956SBrian Masney 	return ret;
7394e60a956SBrian Masney }
7404e60a956SBrian Masney 
7414e60a956SBrian Masney static int msm8974_icc_remove(struct platform_device *pdev)
7424e60a956SBrian Masney {
7434e60a956SBrian Masney 	struct msm8974_icc_provider *qp = platform_get_drvdata(pdev);
7444e60a956SBrian Masney 
745bfe7bcd2SJohan Hovold 	icc_provider_deregister(&qp->provider);
746ad3703acSGeorgi Djakov 	icc_nodes_remove(&qp->provider);
7474e60a956SBrian Masney 	clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks);
748919d4e1aSUwe Kleine-König 
749919d4e1aSUwe Kleine-König 	return 0;
7504e60a956SBrian Masney }
7514e60a956SBrian Masney 
7524e60a956SBrian Masney static const struct of_device_id msm8974_noc_of_match[] = {
7534e60a956SBrian Masney 	{ .compatible = "qcom,msm8974-bimc", .data = &msm8974_bimc},
7544e60a956SBrian Masney 	{ .compatible = "qcom,msm8974-cnoc", .data = &msm8974_cnoc},
7554e60a956SBrian Masney 	{ .compatible = "qcom,msm8974-mmssnoc", .data = &msm8974_mnoc},
7564e60a956SBrian Masney 	{ .compatible = "qcom,msm8974-ocmemnoc", .data = &msm8974_onoc},
7574e60a956SBrian Masney 	{ .compatible = "qcom,msm8974-pnoc", .data = &msm8974_pnoc},
7584e60a956SBrian Masney 	{ .compatible = "qcom,msm8974-snoc", .data = &msm8974_snoc},
7594e60a956SBrian Masney 	{ },
7604e60a956SBrian Masney };
7614e60a956SBrian Masney MODULE_DEVICE_TABLE(of, msm8974_noc_of_match);
7624e60a956SBrian Masney 
7634e60a956SBrian Masney static struct platform_driver msm8974_noc_driver = {
7644e60a956SBrian Masney 	.probe = msm8974_icc_probe,
7654e60a956SBrian Masney 	.remove = msm8974_icc_remove,
7664e60a956SBrian Masney 	.driver = {
7674e60a956SBrian Masney 		.name = "qnoc-msm8974",
7684e60a956SBrian Masney 		.of_match_table = msm8974_noc_of_match,
7697381e27bSGeorgi Djakov 		.sync_state = icc_sync_state,
7704e60a956SBrian Masney 	},
7714e60a956SBrian Masney };
7724e60a956SBrian Masney module_platform_driver(msm8974_noc_driver);
7734e60a956SBrian Masney MODULE_DESCRIPTION("Qualcomm MSM8974 NoC driver");
7744e60a956SBrian Masney MODULE_AUTHOR("Brian Masney <masneyb@onstation.org>");
7754e60a956SBrian Masney MODULE_LICENSE("GPL v2");
776