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