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