1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2020 Linaro Ltd
6 #ifndef __DRIVERS_INTERCONNECT_QCOM_ICC_RPM_H
7 #define __DRIVERS_INTERCONNECT_QCOM_ICC_RPM_H
9 #include <dt-bindings/interconnect/qcom,icc.h>
11 #define RPM_BUS_MASTER_REQ 0x73616d62
12 #define RPM_BUS_SLAVE_REQ 0x766c7362
14 #define to_qcom_provider(_provider) \
15 container_of(_provider, struct qcom_icc_provider, provider)
24 * struct qcom_icc_provider - Qualcomm specific interconnect provider
25 * @provider: generic interconnect provider
26 * @bus_clks: the clk_bulk_data table of bus clocks
27 * @num_clks: the total number of clk_bulk_data entries
28 * @type: the ICC provider type
29 * @qos_offset: offset to QoS registers
30 * @regmap: regmap for QoS registers read/write access
31 * @bus_clk_rate: bus clock rate in Hz
33 struct qcom_icc_provider {
34 struct icc_provider provider;
36 enum qcom_icc_type type;
37 struct regmap *regmap;
38 unsigned int qos_offset;
40 struct clk_bulk_data bus_clks[];
44 * struct qcom_icc_qos - Qualcomm specific interconnect QoS parameters
45 * @areq_prio: node requests priority
46 * @prio_level: priority level for bus communication
47 * @limit_commands: activate/deactivate limiter mode during runtime
48 * @ap_owned: indicates if the node is owned by the AP or by the RPM
49 * @qos_mode: default qos mode for this node
50 * @qos_port: qos port number for finding qos registers of this node
51 * @urg_fwd_en: enable urgent forwarding
64 * struct qcom_icc_node - Qualcomm specific interconnect nodes
65 * @name: the node name used in debugfs
66 * @id: a unique node identifier
67 * @links: an array of nodes where we can go next while traversing
68 * @num_links: the total number of @links
69 * @buswidth: width of the interconnect between a node and the bus (bytes)
70 * @sum_avg: current sum aggregate value of all avg bw requests
71 * @max_peak: current max aggregate value of all peak bw requests
72 * @mas_rpm_id: RPM id for devices that are bus masters
73 * @slv_rpm_id: RPM id for devices that are bus slaves
74 * @qos: NoC QoS setting parameters
76 struct qcom_icc_node {
82 u64 sum_avg[QCOM_ICC_NUM_BUCKETS];
83 u64 max_peak[QCOM_ICC_NUM_BUCKETS];
86 struct qcom_icc_qos qos;
89 struct qcom_icc_desc {
90 struct qcom_icc_node * const *nodes;
92 const char * const *clocks;
95 enum qcom_icc_type type;
96 const struct regmap_config *regmap_cfg;
97 unsigned int qos_offset;
100 /* Valid for both NoC and BIMC */
101 #define NOC_QOS_MODE_INVALID -1
102 #define NOC_QOS_MODE_FIXED 0x0
103 #define NOC_QOS_MODE_BYPASS 0x2
105 int qnoc_probe(struct platform_device *pdev);
106 int qnoc_remove(struct platform_device *pdev);