Jun Nie | 62feb14 | 2020-12-04 15:53:41 +0800 | [diff] [blame] | 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 | |
Jun Nie | 62feb14 | 2020-12-04 15:53:41 +0800 | [diff] [blame] | 12 | #define to_qcom_provider(_provider) \ |
| 13 | container_of(_provider, struct qcom_icc_provider, provider) |
| 14 | |
Shawn Guo | e9d54c2 | 2021-12-15 08:23:20 +0800 | [diff] [blame] | 15 | enum qcom_icc_type { |
| 16 | QCOM_ICC_NOC, |
| 17 | QCOM_ICC_BIMC, |
Shawn Guo | 08c5904 | 2021-12-15 08:23:21 +0800 | [diff] [blame] | 18 | QCOM_ICC_QNOC, |
Shawn Guo | e9d54c2 | 2021-12-15 08:23:20 +0800 | [diff] [blame] | 19 | }; |
| 20 | |
Jun Nie | 62feb14 | 2020-12-04 15:53:41 +0800 | [diff] [blame] | 21 | /** |
| 22 | * struct qcom_icc_provider - Qualcomm specific interconnect provider |
| 23 | * @provider: generic interconnect provider |
| 24 | * @bus_clks: the clk_bulk_data table of bus clocks |
| 25 | * @num_clks: the total number of clk_bulk_data entries |
Shawn Guo | e9d54c2 | 2021-12-15 08:23:20 +0800 | [diff] [blame] | 26 | * @type: the ICC provider type |
Dmitry Baryshkov | 0788f4d | 2021-09-04 02:24:15 +0300 | [diff] [blame] | 27 | * @qos_offset: offset to QoS registers |
Dmitry Baryshkov | 2b6c7d6 | 2021-09-04 02:24:14 +0300 | [diff] [blame] | 28 | * @regmap: regmap for QoS registers read/write access |
Jun Nie | 62feb14 | 2020-12-04 15:53:41 +0800 | [diff] [blame] | 29 | */ |
| 30 | struct qcom_icc_provider { |
| 31 | struct icc_provider provider; |
Jun Nie | 62feb14 | 2020-12-04 15:53:41 +0800 | [diff] [blame] | 32 | int num_clks; |
Shawn Guo | e9d54c2 | 2021-12-15 08:23:20 +0800 | [diff] [blame] | 33 | enum qcom_icc_type type; |
Dmitry Baryshkov | 2b6c7d6 | 2021-09-04 02:24:14 +0300 | [diff] [blame] | 34 | struct regmap *regmap; |
Dmitry Baryshkov | 0788f4d | 2021-09-04 02:24:15 +0300 | [diff] [blame] | 35 | unsigned int qos_offset; |
Dmitry Baryshkov | 63e8ab6 | 2021-09-04 02:24:11 +0300 | [diff] [blame] | 36 | struct clk_bulk_data bus_clks[]; |
Jun Nie | 62feb14 | 2020-12-04 15:53:41 +0800 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | /** |
Dmitry Baryshkov | 2b6c7d6 | 2021-09-04 02:24:14 +0300 | [diff] [blame] | 40 | * struct qcom_icc_qos - Qualcomm specific interconnect QoS parameters |
| 41 | * @areq_prio: node requests priority |
| 42 | * @prio_level: priority level for bus communication |
| 43 | * @limit_commands: activate/deactivate limiter mode during runtime |
| 44 | * @ap_owned: indicates if the node is owned by the AP or by the RPM |
| 45 | * @qos_mode: default qos mode for this node |
| 46 | * @qos_port: qos port number for finding qos registers of this node |
Shawn Guo | 08c5904 | 2021-12-15 08:23:21 +0800 | [diff] [blame] | 47 | * @urg_fwd_en: enable urgent forwarding |
Dmitry Baryshkov | 2b6c7d6 | 2021-09-04 02:24:14 +0300 | [diff] [blame] | 48 | */ |
| 49 | struct qcom_icc_qos { |
| 50 | u32 areq_prio; |
| 51 | u32 prio_level; |
| 52 | bool limit_commands; |
| 53 | bool ap_owned; |
| 54 | int qos_mode; |
| 55 | int qos_port; |
Shawn Guo | 08c5904 | 2021-12-15 08:23:21 +0800 | [diff] [blame] | 56 | bool urg_fwd_en; |
Dmitry Baryshkov | 2b6c7d6 | 2021-09-04 02:24:14 +0300 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | /** |
Jun Nie | 62feb14 | 2020-12-04 15:53:41 +0800 | [diff] [blame] | 60 | * struct qcom_icc_node - Qualcomm specific interconnect nodes |
| 61 | * @name: the node name used in debugfs |
| 62 | * @id: a unique node identifier |
| 63 | * @links: an array of nodes where we can go next while traversing |
| 64 | * @num_links: the total number of @links |
| 65 | * @buswidth: width of the interconnect between a node and the bus (bytes) |
| 66 | * @mas_rpm_id: RPM id for devices that are bus masters |
| 67 | * @slv_rpm_id: RPM id for devices that are bus slaves |
Dmitry Baryshkov | 2b6c7d6 | 2021-09-04 02:24:14 +0300 | [diff] [blame] | 68 | * @qos: NoC QoS setting parameters |
Jun Nie | 62feb14 | 2020-12-04 15:53:41 +0800 | [diff] [blame] | 69 | * @rate: current bus clock rate in Hz |
| 70 | */ |
| 71 | struct qcom_icc_node { |
| 72 | unsigned char *name; |
| 73 | u16 id; |
Dmitry Baryshkov | 2b6c7d6 | 2021-09-04 02:24:14 +0300 | [diff] [blame] | 74 | const u16 *links; |
Jun Nie | 62feb14 | 2020-12-04 15:53:41 +0800 | [diff] [blame] | 75 | u16 num_links; |
| 76 | u16 buswidth; |
| 77 | int mas_rpm_id; |
| 78 | int slv_rpm_id; |
Dmitry Baryshkov | 2b6c7d6 | 2021-09-04 02:24:14 +0300 | [diff] [blame] | 79 | struct qcom_icc_qos qos; |
Jun Nie | 62feb14 | 2020-12-04 15:53:41 +0800 | [diff] [blame] | 80 | u64 rate; |
| 81 | }; |
| 82 | |
| 83 | struct qcom_icc_desc { |
| 84 | struct qcom_icc_node **nodes; |
| 85 | size_t num_nodes; |
Dmitry Baryshkov | 2b6c7d6 | 2021-09-04 02:24:14 +0300 | [diff] [blame] | 86 | const char * const *clocks; |
| 87 | size_t num_clocks; |
Yassine Oudjana | 7de109c | 2021-10-21 13:24:42 +0000 | [diff] [blame] | 88 | bool has_bus_pd; |
Shawn Guo | e9d54c2 | 2021-12-15 08:23:20 +0800 | [diff] [blame] | 89 | enum qcom_icc_type type; |
Dmitry Baryshkov | 2b6c7d6 | 2021-09-04 02:24:14 +0300 | [diff] [blame] | 90 | const struct regmap_config *regmap_cfg; |
Dmitry Baryshkov | 0788f4d | 2021-09-04 02:24:15 +0300 | [diff] [blame] | 91 | unsigned int qos_offset; |
Jun Nie | 62feb14 | 2020-12-04 15:53:41 +0800 | [diff] [blame] | 92 | }; |
| 93 | |
Dmitry Baryshkov | 2b6c7d6 | 2021-09-04 02:24:14 +0300 | [diff] [blame] | 94 | /* Valid for both NoC and BIMC */ |
| 95 | #define NOC_QOS_MODE_INVALID -1 |
| 96 | #define NOC_QOS_MODE_FIXED 0x0 |
| 97 | #define NOC_QOS_MODE_BYPASS 0x2 |
Jun Nie | 62feb14 | 2020-12-04 15:53:41 +0800 | [diff] [blame] | 98 | |
Dmitry Baryshkov | 63e8ab6 | 2021-09-04 02:24:11 +0300 | [diff] [blame] | 99 | int qnoc_probe(struct platform_device *pdev); |
Jun Nie | 62feb14 | 2020-12-04 15:53:41 +0800 | [diff] [blame] | 100 | int qnoc_remove(struct platform_device *pdev); |
| 101 | |
| 102 | #endif |