1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (C) 2020 Linaro Ltd 4 */ 5 6 #ifndef __DRIVERS_INTERCONNECT_QCOM_ICC_RPM_H 7 #define __DRIVERS_INTERCONNECT_QCOM_ICC_RPM_H 8 9 #define RPM_BUS_MASTER_REQ 0x73616d62 10 #define RPM_BUS_SLAVE_REQ 0x766c7362 11 12 #define to_qcom_provider(_provider) \ 13 container_of(_provider, struct qcom_icc_provider, provider) 14 15 /** 16 * struct qcom_icc_provider - Qualcomm specific interconnect provider 17 * @provider: generic interconnect provider 18 * @bus_clks: the clk_bulk_data table of bus clocks 19 * @num_clks: the total number of clk_bulk_data entries 20 * @is_bimc_node: indicates whether to use bimc specific setting 21 * @qos_offset: offset to QoS registers 22 * @regmap: regmap for QoS registers read/write access 23 */ 24 struct qcom_icc_provider { 25 struct icc_provider provider; 26 int num_clks; 27 bool is_bimc_node; 28 struct regmap *regmap; 29 unsigned int qos_offset; 30 struct clk_bulk_data bus_clks[]; 31 }; 32 33 /** 34 * struct qcom_icc_qos - Qualcomm specific interconnect QoS parameters 35 * @areq_prio: node requests priority 36 * @prio_level: priority level for bus communication 37 * @limit_commands: activate/deactivate limiter mode during runtime 38 * @ap_owned: indicates if the node is owned by the AP or by the RPM 39 * @qos_mode: default qos mode for this node 40 * @qos_port: qos port number for finding qos registers of this node 41 */ 42 struct qcom_icc_qos { 43 u32 areq_prio; 44 u32 prio_level; 45 bool limit_commands; 46 bool ap_owned; 47 int qos_mode; 48 int qos_port; 49 }; 50 51 /** 52 * struct qcom_icc_node - Qualcomm specific interconnect nodes 53 * @name: the node name used in debugfs 54 * @id: a unique node identifier 55 * @links: an array of nodes where we can go next while traversing 56 * @num_links: the total number of @links 57 * @buswidth: width of the interconnect between a node and the bus (bytes) 58 * @mas_rpm_id: RPM id for devices that are bus masters 59 * @slv_rpm_id: RPM id for devices that are bus slaves 60 * @qos: NoC QoS setting parameters 61 * @rate: current bus clock rate in Hz 62 */ 63 struct qcom_icc_node { 64 unsigned char *name; 65 u16 id; 66 const u16 *links; 67 u16 num_links; 68 u16 buswidth; 69 int mas_rpm_id; 70 int slv_rpm_id; 71 struct qcom_icc_qos qos; 72 u64 rate; 73 }; 74 75 struct qcom_icc_desc { 76 struct qcom_icc_node **nodes; 77 size_t num_nodes; 78 const char * const *clocks; 79 size_t num_clocks; 80 bool is_bimc_node; 81 const struct regmap_config *regmap_cfg; 82 unsigned int qos_offset; 83 }; 84 85 /* Valid for both NoC and BIMC */ 86 #define NOC_QOS_MODE_INVALID -1 87 #define NOC_QOS_MODE_FIXED 0x0 88 #define NOC_QOS_MODE_BYPASS 0x2 89 90 int qnoc_probe(struct platform_device *pdev); 91 int qnoc_remove(struct platform_device *pdev); 92 93 #endif 94