msm_cvp_resources.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef __MSM_CVP_RESOURCES_H__
  7. #define __MSM_CVP_RESOURCES_H__
  8. #include <linux/devfreq.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/pm_qos.h>
  11. #include "msm_cvp_core.h"
  12. #include <linux/soc/qcom/llcc-qcom.h>
  13. struct reg_value_pair {
  14. u32 reg;
  15. u32 value;
  16. };
  17. struct reg_set {
  18. struct reg_value_pair *reg_tbl;
  19. int count;
  20. };
  21. struct addr_range {
  22. u32 start;
  23. u32 size;
  24. };
  25. struct addr_set {
  26. struct addr_range *addr_tbl;
  27. int count;
  28. };
  29. struct context_bank_info {
  30. struct list_head list;
  31. const char *name;
  32. u32 buffer_type;
  33. bool is_secure;
  34. struct addr_range addr_range;
  35. struct device *dev;
  36. struct iommu_domain *domain;
  37. };
  38. struct regulator_info {
  39. struct regulator *regulator;
  40. bool has_hw_power_collapse;
  41. char *name;
  42. };
  43. struct regulator_set {
  44. struct regulator_info *regulator_tbl;
  45. u32 count;
  46. };
  47. struct clock_info {
  48. const char *name;
  49. u32 clk_id;
  50. struct clk *clk;
  51. u32 count;
  52. bool has_scaling;
  53. bool has_mem_retention;
  54. };
  55. struct clock_set {
  56. struct clock_info *clock_tbl;
  57. u32 count;
  58. };
  59. struct bus_info {
  60. char *name;
  61. int master;
  62. int slave;
  63. unsigned int range[2];
  64. const char *governor;
  65. struct device *dev;
  66. struct devfreq_dev_profile devfreq_prof;
  67. struct devfreq *devfreq;
  68. struct icc_path *client;
  69. bool is_prfm_gov_used;
  70. };
  71. struct bus_set {
  72. struct bus_info *bus_tbl;
  73. u32 count;
  74. };
  75. enum action_stage {
  76. CVP_ON_INIT,
  77. CVP_ON_USE,
  78. CVP_ON_INVALID,
  79. };
  80. enum reset_clk_state {
  81. RESET_INIT,
  82. RESET_ACQUIRED,
  83. RESET_RELEASED,
  84. };
  85. struct reset_info {
  86. struct reset_control *rst;
  87. enum action_stage required_stage;
  88. enum reset_clk_state state;
  89. const char *name;
  90. };
  91. struct reset_set {
  92. struct reset_info *reset_tbl;
  93. u32 count;
  94. };
  95. struct allowed_clock_rates_table {
  96. u32 clock_rate;
  97. };
  98. struct clock_profile_entry {
  99. u32 codec_mask;
  100. u32 vpp_cycles;
  101. u32 vsp_cycles;
  102. u32 low_power_cycles;
  103. };
  104. struct clock_freq_table {
  105. struct clock_profile_entry *clk_prof_entries;
  106. u32 count;
  107. };
  108. struct subcache_info {
  109. const char *name;
  110. bool isactive;
  111. bool isset;
  112. struct llcc_slice_desc *subcache;
  113. };
  114. struct subcache_set {
  115. struct subcache_info *subcache_tbl;
  116. u32 count;
  117. };
  118. struct msm_cvp_mem_cdsp {
  119. struct device *dev;
  120. };
  121. #define MAX_SILVER_CORE_NUM 8
  122. #define HFI_SESSION_FD 4
  123. #define HFI_SESSION_DMM 2
  124. struct cvp_pm_qos {
  125. u32 silver_count;
  126. u32 latency_us;
  127. u32 off_vote_cnt;
  128. spinlock_t lock;
  129. int silver_cores[MAX_SILVER_CORE_NUM];
  130. struct dev_pm_qos_request *pm_qos_hdls;
  131. };
  132. struct cvp_fw_reg_mappings {
  133. phys_addr_t ipclite_iova;
  134. phys_addr_t ipclite_phyaddr;
  135. uint32_t ipclite_size;
  136. phys_addr_t hwmutex_iova;
  137. phys_addr_t hwmutex_phyaddr;
  138. uint32_t hwmutex_size;
  139. phys_addr_t aon_iova;
  140. phys_addr_t aon_phyaddr;
  141. uint32_t aon_size;
  142. phys_addr_t timer_iova;
  143. phys_addr_t timer_phyaddr;
  144. uint32_t timer_size;
  145. };
  146. struct msm_cvp_platform_resources {
  147. phys_addr_t firmware_base;
  148. phys_addr_t register_base;
  149. phys_addr_t ipcc_reg_base;
  150. phys_addr_t gcc_reg_base;
  151. uint32_t register_size;
  152. uint32_t ipcc_reg_size;
  153. uint32_t gcc_reg_size;
  154. struct cvp_fw_reg_mappings reg_mappings;
  155. uint32_t irq;
  156. uint32_t irq_wd;
  157. uint32_t sku_version;
  158. struct allowed_clock_rates_table *allowed_clks_tbl;
  159. u32 allowed_clks_tbl_size;
  160. struct clock_freq_table clock_freq_tbl;
  161. bool sys_cache_present;
  162. bool sys_cache_res_set;
  163. struct subcache_set subcache_set;
  164. struct reg_set reg_set;
  165. struct addr_set qdss_addr_set;
  166. uint32_t max_ssr_allowed;
  167. struct platform_device *pdev;
  168. struct regulator_set regulator_set;
  169. struct clock_set clock_set;
  170. struct bus_set bus_set;
  171. struct reset_set reset_set;
  172. bool use_non_secure_pil;
  173. bool sw_power_collapsible;
  174. bool dsp_enabled;
  175. struct list_head context_banks;
  176. bool thermal_mitigable;
  177. const char *fw_name;
  178. const char *hfi_version;
  179. bool debug_timeout;
  180. struct cvp_pm_qos pm_qos;
  181. uint32_t max_inst_count;
  182. uint32_t max_secure_inst_count;
  183. int msm_cvp_hw_rsp_timeout;
  184. int msm_cvp_dsp_rsp_timeout;
  185. uint32_t msm_cvp_pwr_collapse_delay;
  186. bool non_fatal_pagefaults;
  187. bool fatal_ssr;
  188. struct msm_cvp_mem_cdsp mem_cdsp;
  189. uint32_t vpu_ver;
  190. uint32_t fw_cycles;
  191. struct msm_cvp_ubwc_config_data *ubwc_config;
  192. uint32_t qos_noc_rge_niu_offset;
  193. uint32_t qos_noc_gce_vadl_tof_niu_offset;
  194. uint32_t qos_noc_cdm_niu_offset;
  195. uint32_t noc_core_err_offset;
  196. uint32_t noc_main_sidebandmanager_offset;
  197. };
  198. static inline bool is_iommu_present(struct msm_cvp_platform_resources *res)
  199. {
  200. return !list_empty(&res->context_banks);
  201. }
  202. int cvp_of_fdt_get_ddrtype(void);
  203. #endif