debugcc-volcano.c 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #define pr_fmt(fmt) "clk: %s: " fmt, __func__
  6. #include <linux/clk.h>
  7. #include <linux/clk-provider.h>
  8. #include <linux/err.h>
  9. #include <linux/kernel.h>
  10. #include <linux/mfd/syscon.h>
  11. #include <linux/module.h>
  12. #include <linux/of.h>
  13. #include <linux/of_device.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/regmap.h>
  16. #include "clk-debug.h"
  17. #include "common.h"
  18. static struct measure_clk_data debug_mux_priv = {
  19. .ctl_reg = 0x62048,
  20. .status_reg = 0x6204C,
  21. .xo_div4_cbcr = 0x62008,
  22. };
  23. static const char *const apss_cc_debug_mux_parent_names[] = {
  24. "measure_only_apcs_gold_post_acd_clk",
  25. "measure_only_apcs_gold_pre_acd_clk",
  26. "measure_only_apcs_goldplus_post_acd_clk",
  27. "measure_only_apcs_goldplus_pre_acd_clk",
  28. "measure_only_apcs_l3_post_acd_clk",
  29. "measure_only_apcs_l3_pre_acd_clk",
  30. "measure_only_apcs_silver_post_acd_clk",
  31. "measure_only_apcs_silver_pre_acd_clk",
  32. };
  33. static int apss_cc_debug_mux_sels[] = {
  34. 0x4, /* measure_only_apcs_gold_post_acd_clk */
  35. 0x3, /* measure_only_apcs_gold_pre_acd_clk */
  36. 0x8, /* measure_only_apcs_goldplus_post_acd_clk */
  37. 0x7, /* measure_only_apcs_goldplus_pre_acd_clk */
  38. 0x6, /* measure_only_apcs_l3_post_acd_clk */
  39. 0x5, /* measure_only_apcs_l3_pre_acd_clk */
  40. 0x2, /* measure_only_apcs_silver_post_acd_clk */
  41. 0x1, /* measure_only_apcs_silver_pre_acd_clk */
  42. };
  43. static int apss_cc_debug_mux_pre_divs[] = {
  44. 0x8, /* measure_only_apcs_gold_post_acd_clk */
  45. 0x8, /* measure_only_apcs_gold_pre_acd_clk */
  46. 0x8, /* measure_only_apcs_goldplus_post_acd_clk */
  47. 0x8, /* measure_only_apcs_goldplus_pre_acd_clk */
  48. 0x4, /* measure_only_apcs_l3_post_acd_clk */
  49. 0x4, /* measure_only_apcs_l3_pre_acd_clk */
  50. 0x4, /* measure_only_apcs_silver_post_acd_clk */
  51. 0x4, /* measure_only_apcs_silver_pre_acd_clk */
  52. };
  53. static struct clk_debug_mux apss_cc_debug_mux = {
  54. .priv = &debug_mux_priv,
  55. .debug_offset = 0x20100,
  56. .post_div_offset = 0x20104,
  57. .cbcr_offset = 0x20108,
  58. .src_sel_mask = 0xFF,
  59. .src_sel_shift = 0,
  60. .post_div_mask = 0xF,
  61. .post_div_shift = 0,
  62. .post_div_val = 4,
  63. .mux_sels = apss_cc_debug_mux_sels,
  64. .num_mux_sels = ARRAY_SIZE(apss_cc_debug_mux_sels),
  65. .pre_div_vals = apss_cc_debug_mux_pre_divs,
  66. .hw.init = &(const struct clk_init_data){
  67. .name = "apss_cc_debug_mux",
  68. .ops = &clk_debug_mux_ops,
  69. .parent_names = apss_cc_debug_mux_parent_names,
  70. .num_parents = ARRAY_SIZE(apss_cc_debug_mux_parent_names),
  71. },
  72. };
  73. static const char *const cam_cc_debug_mux_parent_names[] = {
  74. "cam_cc_bps_ahb_clk",
  75. "cam_cc_bps_areg_clk",
  76. "cam_cc_bps_clk",
  77. "cam_cc_camnoc_atb_clk",
  78. "cam_cc_camnoc_axi_hf_clk",
  79. "cam_cc_camnoc_axi_sf_clk",
  80. "cam_cc_camnoc_nrt_axi_clk",
  81. "cam_cc_camnoc_rt_axi_clk",
  82. "cam_cc_cci_0_clk",
  83. "cam_cc_cci_1_clk",
  84. "cam_cc_core_ahb_clk",
  85. "cam_cc_cpas_ahb_clk",
  86. "cam_cc_cre_ahb_clk",
  87. "cam_cc_cre_clk",
  88. "cam_cc_csi0phytimer_clk",
  89. "cam_cc_csi1phytimer_clk",
  90. "cam_cc_csi2phytimer_clk",
  91. "cam_cc_csi3phytimer_clk",
  92. "cam_cc_csiphy0_clk",
  93. "cam_cc_csiphy1_clk",
  94. "cam_cc_csiphy2_clk",
  95. "cam_cc_csiphy3_clk",
  96. "cam_cc_icp_atb_clk",
  97. "cam_cc_icp_clk",
  98. "cam_cc_icp_cti_clk",
  99. "cam_cc_icp_ts_clk",
  100. "cam_cc_mclk0_clk",
  101. "cam_cc_mclk1_clk",
  102. "cam_cc_mclk2_clk",
  103. "cam_cc_mclk3_clk",
  104. "cam_cc_mclk4_clk",
  105. "cam_cc_ope_0_ahb_clk",
  106. "cam_cc_ope_0_areg_clk",
  107. "cam_cc_ope_0_clk",
  108. "cam_cc_soc_ahb_clk",
  109. "cam_cc_sys_tmr_clk",
  110. "cam_cc_tfe_0_ahb_clk",
  111. "cam_cc_tfe_0_clk",
  112. "cam_cc_tfe_0_cphy_rx_clk",
  113. "cam_cc_tfe_0_csid_clk",
  114. "cam_cc_tfe_1_ahb_clk",
  115. "cam_cc_tfe_1_clk",
  116. "cam_cc_tfe_1_cphy_rx_clk",
  117. "cam_cc_tfe_1_csid_clk",
  118. "cam_cc_tfe_2_ahb_clk",
  119. "cam_cc_tfe_2_clk",
  120. "cam_cc_tfe_2_cphy_rx_clk",
  121. "cam_cc_tfe_2_csid_clk",
  122. "cam_cc_top_shift_clk",
  123. "measure_only_cam_cc_gdsc_clk",
  124. "measure_only_cam_cc_sleep_clk",
  125. };
  126. static int cam_cc_debug_mux_sels[] = {
  127. 0x12, /* cam_cc_bps_ahb_clk */
  128. 0x11, /* cam_cc_bps_areg_clk */
  129. 0xE, /* cam_cc_bps_clk */
  130. 0x3E, /* cam_cc_camnoc_atb_clk */
  131. 0x39, /* cam_cc_camnoc_axi_hf_clk */
  132. 0x38, /* cam_cc_camnoc_axi_sf_clk */
  133. 0x3F, /* cam_cc_camnoc_nrt_axi_clk */
  134. 0x3C, /* cam_cc_camnoc_rt_axi_clk */
  135. 0x35, /* cam_cc_cci_0_clk */
  136. 0x36, /* cam_cc_cci_1_clk */
  137. 0x42, /* cam_cc_core_ahb_clk */
  138. 0x37, /* cam_cc_cpas_ahb_clk */
  139. 0x47, /* cam_cc_cre_ahb_clk */
  140. 0x46, /* cam_cc_cre_clk */
  141. 0x6, /* cam_cc_csi0phytimer_clk */
  142. 0x8, /* cam_cc_csi1phytimer_clk */
  143. 0xA, /* cam_cc_csi2phytimer_clk */
  144. 0xC, /* cam_cc_csi3phytimer_clk */
  145. 0x7, /* cam_cc_csiphy0_clk */
  146. 0x9, /* cam_cc_csiphy1_clk */
  147. 0xB, /* cam_cc_csiphy2_clk */
  148. 0xD, /* cam_cc_csiphy3_clk */
  149. 0x2E, /* cam_cc_icp_atb_clk */
  150. 0x32, /* cam_cc_icp_clk */
  151. 0x2F, /* cam_cc_icp_cti_clk */
  152. 0x30, /* cam_cc_icp_ts_clk */
  153. 0x1, /* cam_cc_mclk0_clk */
  154. 0x2, /* cam_cc_mclk1_clk */
  155. 0x3, /* cam_cc_mclk2_clk */
  156. 0x4, /* cam_cc_mclk3_clk */
  157. 0x5, /* cam_cc_mclk4_clk */
  158. 0x17, /* cam_cc_ope_0_ahb_clk */
  159. 0x16, /* cam_cc_ope_0_areg_clk */
  160. 0x13, /* cam_cc_ope_0_clk */
  161. 0x41, /* cam_cc_soc_ahb_clk */
  162. 0x34, /* cam_cc_sys_tmr_clk */
  163. 0x1F, /* cam_cc_tfe_0_ahb_clk */
  164. 0x18, /* cam_cc_tfe_0_clk */
  165. 0x1E, /* cam_cc_tfe_0_cphy_rx_clk */
  166. 0x1B, /* cam_cc_tfe_0_csid_clk */
  167. 0x26, /* cam_cc_tfe_1_ahb_clk */
  168. 0x20, /* cam_cc_tfe_1_clk */
  169. 0x25, /* cam_cc_tfe_1_cphy_rx_clk */
  170. 0x23, /* cam_cc_tfe_1_csid_clk */
  171. 0x2D, /* cam_cc_tfe_2_ahb_clk */
  172. 0x27, /* cam_cc_tfe_2_clk */
  173. 0x2C, /* cam_cc_tfe_2_cphy_rx_clk */
  174. 0x2A, /* cam_cc_tfe_2_csid_clk */
  175. 0x44, /* cam_cc_top_shift_clk */
  176. 0x43, /* measure_only_cam_cc_gdsc_clk */
  177. 0x45, /* measure_only_cam_cc_sleep_clk */
  178. };
  179. static struct clk_debug_mux cam_cc_debug_mux = {
  180. .priv = &debug_mux_priv,
  181. .debug_offset = 0x30128,
  182. .post_div_offset = 0x26004,
  183. .cbcr_offset = 0x26008,
  184. .src_sel_mask = 0xFF,
  185. .src_sel_shift = 0,
  186. .post_div_mask = 0xF,
  187. .post_div_shift = 0,
  188. .post_div_val = 2,
  189. .mux_sels = cam_cc_debug_mux_sels,
  190. .num_mux_sels = ARRAY_SIZE(cam_cc_debug_mux_sels),
  191. .hw.init = &(const struct clk_init_data){
  192. .name = "cam_cc_debug_mux",
  193. .ops = &clk_debug_mux_ops,
  194. .parent_names = cam_cc_debug_mux_parent_names,
  195. .num_parents = ARRAY_SIZE(cam_cc_debug_mux_parent_names),
  196. },
  197. };
  198. static const char *const disp_cc_debug_mux_parent_names[] = {
  199. "disp_cc_mdss_accu_clk",
  200. "disp_cc_mdss_ahb1_clk",
  201. "disp_cc_mdss_ahb_clk",
  202. "disp_cc_mdss_byte0_clk",
  203. "disp_cc_mdss_byte0_intf_clk",
  204. "disp_cc_mdss_dptx0_aux_clk",
  205. "disp_cc_mdss_dptx0_crypto_clk",
  206. "disp_cc_mdss_dptx0_link_clk",
  207. "disp_cc_mdss_dptx0_link_intf_clk",
  208. "disp_cc_mdss_dptx0_pixel0_clk",
  209. "disp_cc_mdss_dptx0_pixel1_clk",
  210. "disp_cc_mdss_dptx0_usb_router_link_intf_clk",
  211. "disp_cc_mdss_esc0_clk",
  212. "disp_cc_mdss_mdp1_clk",
  213. "disp_cc_mdss_mdp_clk",
  214. "disp_cc_mdss_mdp_lut1_clk",
  215. "disp_cc_mdss_mdp_lut_clk",
  216. "disp_cc_mdss_non_gdsc_ahb_clk",
  217. "disp_cc_mdss_pclk0_clk",
  218. "disp_cc_mdss_rscc_ahb_clk",
  219. "disp_cc_mdss_rscc_vsync_clk",
  220. "disp_cc_mdss_vsync1_clk",
  221. "disp_cc_mdss_vsync_clk",
  222. "measure_only_disp_cc_sleep_clk",
  223. "measure_only_disp_cc_xo_clk",
  224. };
  225. static int disp_cc_debug_mux_sels[] = {
  226. 0x70, /* disp_cc_mdss_accu_clk */
  227. 0x5D, /* disp_cc_mdss_ahb1_clk */
  228. 0x5A, /* disp_cc_mdss_ahb_clk */
  229. 0x24, /* disp_cc_mdss_byte0_clk */
  230. 0x25, /* disp_cc_mdss_byte0_intf_clk */
  231. 0x51, /* disp_cc_mdss_dptx0_aux_clk */
  232. 0x33, /* disp_cc_mdss_dptx0_crypto_clk */
  233. 0x30, /* disp_cc_mdss_dptx0_link_clk */
  234. 0x32, /* disp_cc_mdss_dptx0_link_intf_clk */
  235. 0x3C, /* disp_cc_mdss_dptx0_pixel0_clk */
  236. 0x3D, /* disp_cc_mdss_dptx0_pixel1_clk */
  237. 0x31, /* disp_cc_mdss_dptx0_usb_router_link_intf_clk */
  238. 0x17, /* disp_cc_mdss_esc0_clk */
  239. 0x5B, /* disp_cc_mdss_mdp1_clk */
  240. 0x58, /* disp_cc_mdss_mdp_clk */
  241. 0x5C, /* disp_cc_mdss_mdp_lut1_clk */
  242. 0x59, /* disp_cc_mdss_mdp_lut_clk */
  243. 0x5E, /* disp_cc_mdss_non_gdsc_ahb_clk */
  244. 0x20, /* disp_cc_mdss_pclk0_clk */
  245. 0x5F, /* disp_cc_mdss_rscc_ahb_clk */
  246. 0x56, /* disp_cc_mdss_rscc_vsync_clk */
  247. 0x55, /* disp_cc_mdss_vsync1_clk */
  248. 0x50, /* disp_cc_mdss_vsync_clk */
  249. 0x67, /* measure_only_disp_cc_sleep_clk */
  250. 0x57, /* measure_only_disp_cc_xo_clk */
  251. };
  252. static struct clk_debug_mux disp_cc_debug_mux = {
  253. .priv = &debug_mux_priv,
  254. .debug_offset = 0x11000,
  255. .post_div_offset = 0xD000,
  256. .cbcr_offset = 0xD004,
  257. .src_sel_mask = 0x1FF,
  258. .src_sel_shift = 0,
  259. .post_div_mask = 0xF,
  260. .post_div_shift = 0,
  261. .post_div_val = 4,
  262. .mux_sels = disp_cc_debug_mux_sels,
  263. .num_mux_sels = ARRAY_SIZE(disp_cc_debug_mux_sels),
  264. .hw.init = &(const struct clk_init_data){
  265. .name = "disp_cc_debug_mux",
  266. .ops = &clk_debug_mux_ops,
  267. .parent_names = disp_cc_debug_mux_parent_names,
  268. .num_parents = ARRAY_SIZE(disp_cc_debug_mux_parent_names),
  269. },
  270. };
  271. static const char *const gcc_debug_mux_parent_names[] = {
  272. "apss_cc_debug_mux",
  273. "cam_cc_debug_mux",
  274. "disp_cc_debug_mux",
  275. "gcc_aggre_noc_pcie_axi_clk",
  276. "gcc_aggre_ufs_phy_axi_clk",
  277. "gcc_aggre_usb3_prim_axi_clk",
  278. "gcc_boot_rom_ahb_clk",
  279. "gcc_camera_hf_axi_clk",
  280. "gcc_camera_sf_axi_clk",
  281. "gcc_cfg_noc_pcie_anoc_ahb_clk",
  282. "gcc_cfg_noc_usb3_prim_axi_clk",
  283. "gcc_cnoc_pcie_sf_axi_clk",
  284. "gcc_ddrss_gpu_axi_clk",
  285. "gcc_ddrss_pcie_sf_qtb_clk",
  286. "gcc_disp_gpll0_div_clk_src",
  287. "gcc_disp_hf_axi_clk",
  288. "gcc_gp1_clk",
  289. "gcc_gp2_clk",
  290. "gcc_gp3_clk",
  291. "gcc_gpu_gpll0_clk_src",
  292. "gcc_gpu_gpll0_div_clk_src",
  293. "gcc_gpu_memnoc_gfx_clk",
  294. "gcc_gpu_snoc_dvm_gfx_clk",
  295. "gcc_pcie_0_aux_clk",
  296. "gcc_pcie_0_cfg_ahb_clk",
  297. "gcc_pcie_0_mstr_axi_clk",
  298. "gcc_pcie_0_phy_rchng_clk",
  299. "gcc_pcie_0_pipe_clk",
  300. "gcc_pcie_0_pipe_div2_clk",
  301. "gcc_pcie_0_slv_axi_clk",
  302. "gcc_pcie_0_slv_q2a_axi_clk",
  303. "gcc_pcie_1_aux_clk",
  304. "gcc_pcie_1_cfg_ahb_clk",
  305. "gcc_pcie_1_mstr_axi_clk",
  306. "gcc_pcie_1_phy_rchng_clk",
  307. "gcc_pcie_1_pipe_clk",
  308. "gcc_pcie_1_pipe_div2_clk",
  309. "gcc_pcie_1_slv_axi_clk",
  310. "gcc_pcie_1_slv_q2a_axi_clk",
  311. "gcc_pcie_rscc_cfg_ahb_clk",
  312. "gcc_pcie_rscc_xo_clk",
  313. "gcc_pdm2_clk",
  314. "gcc_pdm_ahb_clk",
  315. "gcc_pdm_xo4_clk",
  316. "gcc_qmip_camera_nrt_ahb_clk",
  317. "gcc_qmip_camera_rt_ahb_clk",
  318. "gcc_qmip_disp_ahb_clk",
  319. "gcc_qmip_gpu_ahb_clk",
  320. "gcc_qmip_pcie_ahb_clk",
  321. "gcc_qmip_video_cv_cpu_ahb_clk",
  322. "gcc_qmip_video_cvp_ahb_clk",
  323. "gcc_qmip_video_v_cpu_ahb_clk",
  324. "gcc_qmip_video_vcodec_ahb_clk",
  325. "gcc_qupv3_wrap0_core_2x_clk",
  326. "gcc_qupv3_wrap0_core_clk",
  327. "gcc_qupv3_wrap0_qspi_ref_clk",
  328. "gcc_qupv3_wrap0_s0_clk",
  329. "gcc_qupv3_wrap0_s1_clk",
  330. "gcc_qupv3_wrap0_s2_clk",
  331. "gcc_qupv3_wrap0_s3_clk",
  332. "gcc_qupv3_wrap0_s4_clk",
  333. "gcc_qupv3_wrap0_s5_clk",
  334. "gcc_qupv3_wrap0_s6_clk",
  335. "gcc_qupv3_wrap1_core_2x_clk",
  336. "gcc_qupv3_wrap1_core_clk",
  337. "gcc_qupv3_wrap1_qspi_ref_clk",
  338. "gcc_qupv3_wrap1_s0_clk",
  339. "gcc_qupv3_wrap1_s1_clk",
  340. "gcc_qupv3_wrap1_s2_clk",
  341. "gcc_qupv3_wrap1_s3_clk",
  342. "gcc_qupv3_wrap1_s4_clk",
  343. "gcc_qupv3_wrap1_s5_clk",
  344. "gcc_qupv3_wrap1_s6_clk",
  345. "gcc_qupv3_wrap_0_m_ahb_clk",
  346. "gcc_qupv3_wrap_0_s_ahb_clk",
  347. "gcc_qupv3_wrap_1_m_ahb_clk",
  348. "gcc_qupv3_wrap_1_s_ahb_clk",
  349. "gcc_sdcc1_ahb_clk",
  350. "gcc_sdcc1_apps_clk",
  351. "gcc_sdcc1_ice_core_clk",
  352. "gcc_sdcc2_ahb_clk",
  353. "gcc_sdcc2_apps_clk",
  354. "gcc_ufs_phy_ahb_clk",
  355. "gcc_ufs_phy_axi_clk",
  356. "gcc_ufs_phy_ice_core_clk",
  357. "gcc_ufs_phy_phy_aux_clk",
  358. "gcc_ufs_phy_rx_symbol_0_clk",
  359. "gcc_ufs_phy_rx_symbol_1_clk",
  360. "gcc_ufs_phy_tx_symbol_0_clk",
  361. "gcc_ufs_phy_unipro_core_clk",
  362. "gcc_usb30_prim_atb_clk",
  363. "gcc_usb30_prim_master_clk",
  364. "gcc_usb30_prim_mock_utmi_clk",
  365. "gcc_usb30_prim_sleep_clk",
  366. "gcc_usb3_prim_phy_aux_clk",
  367. "gcc_usb3_prim_phy_com_aux_clk",
  368. "gcc_usb3_prim_phy_pipe_clk",
  369. "gcc_video_axi0_clk",
  370. "gpu_cc_debug_mux",
  371. "mc_cc_debug_mux",
  372. "measure_only_cnoc_clk",
  373. "measure_only_gcc_camera_ahb_clk",
  374. "measure_only_gcc_camera_hf_xo_clk",
  375. "measure_only_gcc_camera_sf_xo_clk",
  376. "measure_only_gcc_disp_ahb_clk",
  377. "measure_only_gcc_disp_xo_clk",
  378. "measure_only_gcc_gpu_cfg_ahb_clk",
  379. "measure_only_gcc_video_ahb_clk",
  380. "measure_only_gcc_video_xo_clk",
  381. "measure_only_ipa_2x_clk",
  382. "measure_only_memnoc_clk",
  383. "measure_only_pcie_0_pipe_clk",
  384. "measure_only_pcie_1_pipe_clk",
  385. "measure_only_snoc_clk",
  386. "measure_only_ufs_phy_rx_symbol_0_clk",
  387. "measure_only_ufs_phy_rx_symbol_1_clk",
  388. "measure_only_ufs_phy_tx_symbol_0_clk",
  389. "measure_only_usb3_phy_wrapper_gcc_usb30_pipe_clk",
  390. "video_cc_debug_mux",
  391. };
  392. static int gcc_debug_mux_sels[] = {
  393. 0x13D, /* apss_cc_debug_mux */
  394. 0x87, /* cam_cc_debug_mux */
  395. 0x8C, /* disp_cc_debug_mux */
  396. 0x4D, /* gcc_aggre_noc_pcie_axi_clk */
  397. 0x4F, /* gcc_aggre_ufs_phy_axi_clk */
  398. 0x4E, /* gcc_aggre_usb3_prim_axi_clk */
  399. 0xE9, /* gcc_boot_rom_ahb_clk */
  400. 0x83, /* gcc_camera_hf_axi_clk */
  401. 0x84, /* gcc_camera_sf_axi_clk */
  402. 0x39, /* gcc_cfg_noc_pcie_anoc_ahb_clk */
  403. 0x20, /* gcc_cfg_noc_usb3_prim_axi_clk */
  404. 0x19, /* gcc_cnoc_pcie_sf_axi_clk */
  405. 0x105, /* gcc_ddrss_gpu_axi_clk */
  406. 0x106, /* gcc_ddrss_pcie_sf_qtb_clk */
  407. 0x8D, /* gcc_disp_gpll0_div_clk_src */
  408. 0x8A, /* gcc_disp_hf_axi_clk */
  409. 0x148, /* gcc_gp1_clk */
  410. 0x149, /* gcc_gp2_clk */
  411. 0x14A, /* gcc_gp3_clk */
  412. 0x18B, /* gcc_gpu_gpll0_clk_src */
  413. 0x18C, /* gcc_gpu_gpll0_div_clk_src */
  414. 0x188, /* gcc_gpu_memnoc_gfx_clk */
  415. 0x18A, /* gcc_gpu_snoc_dvm_gfx_clk */
  416. 0x150, /* gcc_pcie_0_aux_clk */
  417. 0x14F, /* gcc_pcie_0_cfg_ahb_clk */
  418. 0x14E, /* gcc_pcie_0_mstr_axi_clk */
  419. 0x152, /* gcc_pcie_0_phy_rchng_clk */
  420. 0x151, /* gcc_pcie_0_pipe_clk */
  421. 0x153, /* gcc_pcie_0_pipe_div2_clk */
  422. 0x14D, /* gcc_pcie_0_slv_axi_clk */
  423. 0x14C, /* gcc_pcie_0_slv_q2a_axi_clk */
  424. 0x1B7, /* gcc_pcie_1_aux_clk */
  425. 0x1B6, /* gcc_pcie_1_cfg_ahb_clk */
  426. 0x1B5, /* gcc_pcie_1_mstr_axi_clk */
  427. 0x1B9, /* gcc_pcie_1_phy_rchng_clk */
  428. 0x1B8, /* gcc_pcie_1_pipe_clk */
  429. 0x1BA, /* gcc_pcie_1_pipe_div2_clk */
  430. 0x1B4, /* gcc_pcie_1_slv_axi_clk */
  431. 0x1B3, /* gcc_pcie_1_slv_q2a_axi_clk */
  432. 0x1A0, /* gcc_pcie_rscc_cfg_ahb_clk */
  433. 0x1A1, /* gcc_pcie_rscc_xo_clk */
  434. 0xDA, /* gcc_pdm2_clk */
  435. 0xD8, /* gcc_pdm_ahb_clk */
  436. 0xD9, /* gcc_pdm_xo4_clk */
  437. 0x81, /* gcc_qmip_camera_nrt_ahb_clk */
  438. 0x82, /* gcc_qmip_camera_rt_ahb_clk */
  439. 0x89, /* gcc_qmip_disp_ahb_clk */
  440. 0x185, /* gcc_qmip_gpu_ahb_clk */
  441. 0x14B, /* gcc_qmip_pcie_ahb_clk */
  442. 0x92, /* gcc_qmip_video_cv_cpu_ahb_clk */
  443. 0x8F, /* gcc_qmip_video_cvp_ahb_clk */
  444. 0x91, /* gcc_qmip_video_v_cpu_ahb_clk */
  445. 0x90, /* gcc_qmip_video_vcodec_ahb_clk */
  446. 0xC3, /* gcc_qupv3_wrap0_core_2x_clk */
  447. 0xC2, /* gcc_qupv3_wrap0_core_clk */
  448. 0xCB, /* gcc_qupv3_wrap0_qspi_ref_clk */
  449. 0xC4, /* gcc_qupv3_wrap0_s0_clk */
  450. 0xC5, /* gcc_qupv3_wrap0_s1_clk */
  451. 0xC6, /* gcc_qupv3_wrap0_s2_clk */
  452. 0xC7, /* gcc_qupv3_wrap0_s3_clk */
  453. 0xC8, /* gcc_qupv3_wrap0_s4_clk */
  454. 0xC9, /* gcc_qupv3_wrap0_s5_clk */
  455. 0xCA, /* gcc_qupv3_wrap0_s6_clk */
  456. 0xCF, /* gcc_qupv3_wrap1_core_2x_clk */
  457. 0xCE, /* gcc_qupv3_wrap1_core_clk */
  458. 0xD7, /* gcc_qupv3_wrap1_qspi_ref_clk */
  459. 0xD0, /* gcc_qupv3_wrap1_s0_clk */
  460. 0xD1, /* gcc_qupv3_wrap1_s1_clk */
  461. 0xD2, /* gcc_qupv3_wrap1_s2_clk */
  462. 0xD3, /* gcc_qupv3_wrap1_s3_clk */
  463. 0xD4, /* gcc_qupv3_wrap1_s4_clk */
  464. 0xD5, /* gcc_qupv3_wrap1_s5_clk */
  465. 0xD6, /* gcc_qupv3_wrap1_s6_clk */
  466. 0xC0, /* gcc_qupv3_wrap_0_m_ahb_clk */
  467. 0xC1, /* gcc_qupv3_wrap_0_s_ahb_clk */
  468. 0xCC, /* gcc_qupv3_wrap_1_m_ahb_clk */
  469. 0xCD, /* gcc_qupv3_wrap_1_s_ahb_clk */
  470. 0x1AF, /* gcc_sdcc1_ahb_clk */
  471. 0x1B0, /* gcc_sdcc1_apps_clk */
  472. 0x1B1, /* gcc_sdcc1_ice_core_clk */
  473. 0xBE, /* gcc_sdcc2_ahb_clk */
  474. 0xBD, /* gcc_sdcc2_apps_clk */
  475. 0x157, /* gcc_ufs_phy_ahb_clk */
  476. 0x156, /* gcc_ufs_phy_axi_clk */
  477. 0x15D, /* gcc_ufs_phy_ice_core_clk */
  478. 0x15E, /* gcc_ufs_phy_phy_aux_clk */
  479. 0x159, /* gcc_ufs_phy_rx_symbol_0_clk */
  480. 0x15F, /* gcc_ufs_phy_rx_symbol_1_clk */
  481. 0x158, /* gcc_ufs_phy_tx_symbol_0_clk */
  482. 0x15C, /* gcc_ufs_phy_unipro_core_clk */
  483. 0xB8, /* gcc_usb30_prim_atb_clk */
  484. 0xAF, /* gcc_usb30_prim_master_clk */
  485. 0xB1, /* gcc_usb30_prim_mock_utmi_clk */
  486. 0xB0, /* gcc_usb30_prim_sleep_clk */
  487. 0xB2, /* gcc_usb3_prim_phy_aux_clk */
  488. 0xB3, /* gcc_usb3_prim_phy_com_aux_clk */
  489. 0xB4, /* gcc_usb3_prim_phy_pipe_clk */
  490. 0x93, /* gcc_video_axi0_clk */
  491. 0x187, /* gpu_cc_debug_mux */
  492. 0x112, /* mc_cc_debug_mux */
  493. 0x17, /* measure_only_cnoc_clk */
  494. 0x80, /* measure_only_gcc_camera_ahb_clk */
  495. 0x85, /* measure_only_gcc_camera_hf_xo_clk */
  496. 0x86, /* measure_only_gcc_camera_sf_xo_clk */
  497. 0x88, /* measure_only_gcc_disp_ahb_clk */
  498. 0x8B, /* measure_only_gcc_disp_xo_clk */
  499. 0x184, /* measure_only_gcc_gpu_cfg_ahb_clk */
  500. 0x8E, /* measure_only_gcc_video_ahb_clk */
  501. 0x94, /* measure_only_gcc_video_xo_clk */
  502. 0x170, /* measure_only_ipa_2x_clk */
  503. 0x10A, /* measure_only_memnoc_clk */
  504. 0x154, /* measure_only_pcie_0_pipe_clk */
  505. 0x1BB, /* measure_only_pcie_1_pipe_clk */
  506. 0xB, /* measure_only_snoc_clk */
  507. 0x15B, /* measure_only_ufs_phy_rx_symbol_0_clk */
  508. 0x161, /* measure_only_ufs_phy_rx_symbol_1_clk */
  509. 0x15A, /* measure_only_ufs_phy_tx_symbol_0_clk */
  510. 0xB9, /* measure_only_usb3_phy_wrapper_gcc_usb30_pipe_clk */
  511. 0x95, /* video_cc_debug_mux */
  512. };
  513. static struct clk_debug_mux gcc_debug_mux = {
  514. .priv = &debug_mux_priv,
  515. .debug_offset = 0x62024,
  516. .post_div_offset = 0x62000,
  517. .cbcr_offset = 0x62004,
  518. .src_sel_mask = 0x3FF,
  519. .src_sel_shift = 0,
  520. .post_div_mask = 0xF,
  521. .post_div_shift = 0,
  522. .post_div_val = 2,
  523. .mux_sels = gcc_debug_mux_sels,
  524. .num_mux_sels = ARRAY_SIZE(gcc_debug_mux_sels),
  525. .hw.init = &(const struct clk_init_data){
  526. .name = "gcc_debug_mux",
  527. .ops = &clk_debug_mux_ops,
  528. .parent_names = gcc_debug_mux_parent_names,
  529. .num_parents = ARRAY_SIZE(gcc_debug_mux_parent_names),
  530. },
  531. };
  532. static const char *const gpu_cc_debug_mux_parent_names[] = {
  533. "gpu_cc_ahb_clk",
  534. "gpu_cc_cx_accu_shift_clk",
  535. "gpu_cc_cx_ff_clk",
  536. "gpu_cc_cx_gmu_clk",
  537. "gpu_cc_cxo_clk",
  538. "gpu_cc_dpm_clk",
  539. "gpu_cc_freq_measure_clk",
  540. "gpu_cc_gx_accu_shift_clk",
  541. "gpu_cc_gx_acd_ahb_ff_clk",
  542. "gpu_cc_gx_gmu_clk",
  543. "gpu_cc_gx_rcg_ahb_ff_clk",
  544. "gpu_cc_hub_aon_clk",
  545. "gpu_cc_hub_cx_int_clk",
  546. "gpu_cc_memnoc_gfx_clk",
  547. "gx_clkctl_debug_mux",
  548. "measure_only_gpu_cc_cb_clk",
  549. "measure_only_gpu_cc_cxo_aon_clk",
  550. "measure_only_gpu_cc_demet_clk",
  551. "measure_only_gpu_cc_gx_ahb_ff_clk",
  552. "measure_only_gpu_cc_rscc_hub_aon_clk",
  553. "measure_only_gpu_cc_rscc_xo_aon_clk",
  554. "measure_only_gpu_cc_sleep_clk",
  555. };
  556. static int gpu_cc_debug_mux_sels[] = {
  557. 0x17, /* gpu_cc_ahb_clk */
  558. 0x24, /* gpu_cc_cx_accu_shift_clk */
  559. 0x20, /* gpu_cc_cx_ff_clk */
  560. 0x1D, /* gpu_cc_cx_gmu_clk */
  561. 0x1E, /* gpu_cc_cxo_clk */
  562. 0x25, /* gpu_cc_dpm_clk */
  563. 0xF, /* gpu_cc_freq_measure_clk */
  564. 0x15, /* gpu_cc_gx_accu_shift_clk */
  565. 0x13, /* gpu_cc_gx_acd_ahb_ff_clk */
  566. 0x11, /* gpu_cc_gx_gmu_clk */
  567. 0x14, /* gpu_cc_gx_rcg_ahb_ff_clk */
  568. 0x2A, /* gpu_cc_hub_aon_clk */
  569. 0x1F, /* gpu_cc_hub_cx_int_clk */
  570. 0x21, /* gpu_cc_memnoc_gfx_clk */
  571. 0xB, /* gx_clkctl_debug_mux */
  572. 0x28, /* measure_only_gpu_cc_cb_clk */
  573. 0xE, /* measure_only_gpu_cc_cxo_aon_clk */
  574. 0x10, /* measure_only_gpu_cc_demet_clk */
  575. 0x12, /* measure_only_gpu_cc_gx_ahb_ff_clk */
  576. 0x29, /* measure_only_gpu_cc_rscc_hub_aon_clk */
  577. 0xD, /* measure_only_gpu_cc_rscc_xo_aon_clk */
  578. 0x1B, /* measure_only_gpu_cc_sleep_clk */
  579. };
  580. static struct clk_debug_mux gpu_cc_debug_mux = {
  581. .priv = &debug_mux_priv,
  582. .debug_offset = 0x9564,
  583. .post_div_offset = 0x9270,
  584. .cbcr_offset = 0x9274,
  585. .src_sel_mask = 0xFF,
  586. .src_sel_shift = 0,
  587. .post_div_mask = 0xF,
  588. .post_div_shift = 0,
  589. .post_div_val = 2,
  590. .mux_sels = gpu_cc_debug_mux_sels,
  591. .num_mux_sels = ARRAY_SIZE(gpu_cc_debug_mux_sels),
  592. .hw.init = &(const struct clk_init_data){
  593. .name = "gpu_cc_debug_mux",
  594. .ops = &clk_debug_mux_ops,
  595. .parent_names = gpu_cc_debug_mux_parent_names,
  596. .num_parents = ARRAY_SIZE(gpu_cc_debug_mux_parent_names),
  597. },
  598. };
  599. static const char *const gx_clkctl_debug_mux_parent_names[] = {
  600. "measure_only_gx_clkctl_acd_gfx3d_clk",
  601. "measure_only_gx_clkctl_demet_clk",
  602. "measure_only_gx_clkctl_gx_accu_clk",
  603. "measure_only_gx_clkctl_gx_gfx3d_clk",
  604. "measure_only_gx_clkctl_gx_gfx3d_rdvm_clk",
  605. "measure_only_gx_clkctl_mnd1x_gfx3d_clk",
  606. };
  607. static int gx_clkctl_debug_mux_sels[] = {
  608. 0x8, /* measure_only_gx_clkctl_acd_gfx3d_clk */
  609. 0x2, /* measure_only_gx_clkctl_demet_clk */
  610. 0xA, /* measure_only_gx_clkctl_gx_accu_clk */
  611. 0x3, /* measure_only_gx_clkctl_gx_gfx3d_clk */
  612. 0x6, /* measure_only_gx_clkctl_gx_gfx3d_rdvm_clk */
  613. 0x7, /* measure_only_gx_clkctl_mnd1x_gfx3d_clk */
  614. };
  615. static struct clk_debug_mux gx_clkctl_debug_mux = {
  616. .priv = &debug_mux_priv,
  617. .debug_offset = 0x4144,
  618. .post_div_offset = U32_MAX,
  619. .cbcr_offset = 0x4088,
  620. .src_sel_mask = 0xFF,
  621. .src_sel_shift = 0,
  622. .post_div_mask = 0x1,
  623. .post_div_shift = 0,
  624. .post_div_val = 1,
  625. .mux_sels = gx_clkctl_debug_mux_sels,
  626. .num_mux_sels = ARRAY_SIZE(gx_clkctl_debug_mux_sels),
  627. .hw.init = &(const struct clk_init_data){
  628. .name = "gx_clkctl_debug_mux",
  629. .ops = &clk_debug_mux_ops,
  630. .parent_names = gx_clkctl_debug_mux_parent_names,
  631. .num_parents = ARRAY_SIZE(gx_clkctl_debug_mux_parent_names),
  632. },
  633. };
  634. static const char *const video_cc_debug_mux_parent_names[] = {
  635. "measure_only_video_cc_ahb_clk",
  636. "measure_only_video_cc_sleep_clk",
  637. "measure_only_video_cc_xo_clk",
  638. "video_cc_mvs0_clk",
  639. "video_cc_mvs0_shift_clk",
  640. "video_cc_mvs0c_clk",
  641. "video_cc_mvs0c_shift_clk",
  642. };
  643. static int video_cc_debug_mux_sels[] = {
  644. 0x5, /* measure_only_video_cc_ahb_clk */
  645. 0x9, /* measure_only_video_cc_sleep_clk */
  646. 0x6, /* measure_only_video_cc_xo_clk */
  647. 0x3, /* video_cc_mvs0_clk */
  648. 0x7, /* video_cc_mvs0_shift_clk */
  649. 0x1, /* video_cc_mvs0c_clk */
  650. 0x8, /* video_cc_mvs0c_shift_clk */
  651. };
  652. static struct clk_debug_mux video_cc_debug_mux = {
  653. .priv = &debug_mux_priv,
  654. .debug_offset = 0x9A4C,
  655. .post_div_offset = 0x80F8,
  656. .cbcr_offset = 0x80FC,
  657. .src_sel_mask = 0x3F,
  658. .src_sel_shift = 0,
  659. .post_div_mask = 0xF,
  660. .post_div_shift = 0,
  661. .post_div_val = 3,
  662. .mux_sels = video_cc_debug_mux_sels,
  663. .num_mux_sels = ARRAY_SIZE(video_cc_debug_mux_sels),
  664. .hw.init = &(const struct clk_init_data){
  665. .name = "video_cc_debug_mux",
  666. .ops = &clk_debug_mux_ops,
  667. .parent_names = video_cc_debug_mux_parent_names,
  668. .num_parents = ARRAY_SIZE(video_cc_debug_mux_parent_names),
  669. },
  670. };
  671. static const char *const mc_cc_debug_mux_parent_names[] = {
  672. "measure_only_mccc_clk",
  673. };
  674. static struct clk_debug_mux mc_cc_debug_mux = {
  675. .period_offset = 0x50,
  676. .hw.init = &(struct clk_init_data){
  677. .name = "mc_cc_debug_mux",
  678. .ops = &clk_debug_mux_ops,
  679. .parent_names = mc_cc_debug_mux_parent_names,
  680. .num_parents = ARRAY_SIZE(mc_cc_debug_mux_parent_names),
  681. },
  682. };
  683. static struct mux_regmap_names mux_list[] = {
  684. { .mux = &mc_cc_debug_mux, .regmap_name = "qcom,mccc" },
  685. { .mux = &video_cc_debug_mux, .regmap_name = "qcom,videocc" },
  686. { .mux = &gx_clkctl_debug_mux, .regmap_name = "qcom,gxclkctl" },
  687. { .mux = &gpu_cc_debug_mux, .regmap_name = "qcom,gpucc" },
  688. { .mux = &disp_cc_debug_mux, .regmap_name = "qcom,dispcc" },
  689. { .mux = &cam_cc_debug_mux, .regmap_name = "qcom,camcc" },
  690. { .mux = &apss_cc_debug_mux, .regmap_name = "qcom,apsscc" },
  691. { .mux = &gcc_debug_mux, .regmap_name = "qcom,gcc" },
  692. };
  693. static struct clk_dummy measure_only_apcs_gold_post_acd_clk = {
  694. .rrate = 1000,
  695. .hw.init = &(const struct clk_init_data){
  696. .name = "measure_only_apcs_gold_post_acd_clk",
  697. .ops = &clk_dummy_ops,
  698. },
  699. };
  700. static struct clk_dummy measure_only_apcs_gold_pre_acd_clk = {
  701. .rrate = 1000,
  702. .hw.init = &(const struct clk_init_data){
  703. .name = "measure_only_apcs_gold_pre_acd_clk",
  704. .ops = &clk_dummy_ops,
  705. },
  706. };
  707. static struct clk_dummy measure_only_apcs_goldplus_post_acd_clk = {
  708. .rrate = 1000,
  709. .hw.init = &(const struct clk_init_data){
  710. .name = "measure_only_apcs_goldplus_post_acd_clk",
  711. .ops = &clk_dummy_ops,
  712. },
  713. };
  714. static struct clk_dummy measure_only_apcs_goldplus_pre_acd_clk = {
  715. .rrate = 1000,
  716. .hw.init = &(const struct clk_init_data){
  717. .name = "measure_only_apcs_goldplus_pre_acd_clk",
  718. .ops = &clk_dummy_ops,
  719. },
  720. };
  721. static struct clk_dummy measure_only_apcs_l3_post_acd_clk = {
  722. .rrate = 1000,
  723. .hw.init = &(const struct clk_init_data){
  724. .name = "measure_only_apcs_l3_post_acd_clk",
  725. .ops = &clk_dummy_ops,
  726. },
  727. };
  728. static struct clk_dummy measure_only_apcs_l3_pre_acd_clk = {
  729. .rrate = 1000,
  730. .hw.init = &(const struct clk_init_data){
  731. .name = "measure_only_apcs_l3_pre_acd_clk",
  732. .ops = &clk_dummy_ops,
  733. },
  734. };
  735. static struct clk_dummy measure_only_apcs_silver_post_acd_clk = {
  736. .rrate = 1000,
  737. .hw.init = &(const struct clk_init_data){
  738. .name = "measure_only_apcs_silver_post_acd_clk",
  739. .ops = &clk_dummy_ops,
  740. },
  741. };
  742. static struct clk_dummy measure_only_apcs_silver_pre_acd_clk = {
  743. .rrate = 1000,
  744. .hw.init = &(const struct clk_init_data){
  745. .name = "measure_only_apcs_silver_pre_acd_clk",
  746. .ops = &clk_dummy_ops,
  747. },
  748. };
  749. static struct clk_dummy measure_only_cam_cc_gdsc_clk = {
  750. .rrate = 1000,
  751. .hw.init = &(const struct clk_init_data){
  752. .name = "measure_only_cam_cc_gdsc_clk",
  753. .ops = &clk_dummy_ops,
  754. },
  755. };
  756. static struct clk_dummy measure_only_cam_cc_sleep_clk = {
  757. .rrate = 1000,
  758. .hw.init = &(const struct clk_init_data){
  759. .name = "measure_only_cam_cc_sleep_clk",
  760. .ops = &clk_dummy_ops,
  761. },
  762. };
  763. static struct clk_dummy measure_only_cnoc_clk = {
  764. .rrate = 1000,
  765. .hw.init = &(const struct clk_init_data){
  766. .name = "measure_only_cnoc_clk",
  767. .ops = &clk_dummy_ops,
  768. },
  769. };
  770. static struct clk_dummy measure_only_disp_cc_sleep_clk = {
  771. .rrate = 1000,
  772. .hw.init = &(const struct clk_init_data){
  773. .name = "measure_only_disp_cc_sleep_clk",
  774. .ops = &clk_dummy_ops,
  775. },
  776. };
  777. static struct clk_dummy measure_only_disp_cc_xo_clk = {
  778. .rrate = 1000,
  779. .hw.init = &(const struct clk_init_data){
  780. .name = "measure_only_disp_cc_xo_clk",
  781. .ops = &clk_dummy_ops,
  782. },
  783. };
  784. static struct clk_dummy measure_only_gcc_camera_ahb_clk = {
  785. .rrate = 1000,
  786. .hw.init = &(const struct clk_init_data){
  787. .name = "measure_only_gcc_camera_ahb_clk",
  788. .ops = &clk_dummy_ops,
  789. },
  790. };
  791. static struct clk_dummy measure_only_gcc_camera_hf_xo_clk = {
  792. .rrate = 1000,
  793. .hw.init = &(const struct clk_init_data){
  794. .name = "measure_only_gcc_camera_hf_xo_clk",
  795. .ops = &clk_dummy_ops,
  796. },
  797. };
  798. static struct clk_dummy measure_only_gcc_camera_sf_xo_clk = {
  799. .rrate = 1000,
  800. .hw.init = &(const struct clk_init_data){
  801. .name = "measure_only_gcc_camera_sf_xo_clk",
  802. .ops = &clk_dummy_ops,
  803. },
  804. };
  805. static struct clk_dummy measure_only_gcc_disp_ahb_clk = {
  806. .rrate = 1000,
  807. .hw.init = &(const struct clk_init_data){
  808. .name = "measure_only_gcc_disp_ahb_clk",
  809. .ops = &clk_dummy_ops,
  810. },
  811. };
  812. static struct clk_dummy measure_only_gcc_disp_xo_clk = {
  813. .rrate = 1000,
  814. .hw.init = &(const struct clk_init_data){
  815. .name = "measure_only_gcc_disp_xo_clk",
  816. .ops = &clk_dummy_ops,
  817. },
  818. };
  819. static struct clk_dummy measure_only_gcc_gpu_cfg_ahb_clk = {
  820. .rrate = 1000,
  821. .hw.init = &(const struct clk_init_data){
  822. .name = "measure_only_gcc_gpu_cfg_ahb_clk",
  823. .ops = &clk_dummy_ops,
  824. },
  825. };
  826. static struct clk_dummy measure_only_gcc_video_ahb_clk = {
  827. .rrate = 1000,
  828. .hw.init = &(const struct clk_init_data){
  829. .name = "measure_only_gcc_video_ahb_clk",
  830. .ops = &clk_dummy_ops,
  831. },
  832. };
  833. static struct clk_dummy measure_only_gcc_video_xo_clk = {
  834. .rrate = 1000,
  835. .hw.init = &(const struct clk_init_data){
  836. .name = "measure_only_gcc_video_xo_clk",
  837. .ops = &clk_dummy_ops,
  838. },
  839. };
  840. static struct clk_dummy measure_only_gpu_cc_cb_clk = {
  841. .rrate = 1000,
  842. .hw.init = &(const struct clk_init_data){
  843. .name = "measure_only_gpu_cc_cb_clk",
  844. .ops = &clk_dummy_ops,
  845. },
  846. };
  847. static struct clk_dummy measure_only_gpu_cc_cxo_aon_clk = {
  848. .rrate = 1000,
  849. .hw.init = &(const struct clk_init_data){
  850. .name = "measure_only_gpu_cc_cxo_aon_clk",
  851. .ops = &clk_dummy_ops,
  852. },
  853. };
  854. static struct clk_dummy measure_only_gpu_cc_demet_clk = {
  855. .rrate = 1000,
  856. .hw.init = &(const struct clk_init_data){
  857. .name = "measure_only_gpu_cc_demet_clk",
  858. .ops = &clk_dummy_ops,
  859. },
  860. };
  861. static struct clk_dummy measure_only_gpu_cc_gx_ahb_ff_clk = {
  862. .rrate = 1000,
  863. .hw.init = &(const struct clk_init_data){
  864. .name = "measure_only_gpu_cc_gx_ahb_ff_clk",
  865. .ops = &clk_dummy_ops,
  866. },
  867. };
  868. static struct clk_dummy measure_only_gpu_cc_rscc_hub_aon_clk = {
  869. .rrate = 1000,
  870. .hw.init = &(const struct clk_init_data){
  871. .name = "measure_only_gpu_cc_rscc_hub_aon_clk",
  872. .ops = &clk_dummy_ops,
  873. },
  874. };
  875. static struct clk_dummy measure_only_gpu_cc_rscc_xo_aon_clk = {
  876. .rrate = 1000,
  877. .hw.init = &(const struct clk_init_data){
  878. .name = "measure_only_gpu_cc_rscc_xo_aon_clk",
  879. .ops = &clk_dummy_ops,
  880. },
  881. };
  882. static struct clk_dummy measure_only_gpu_cc_sleep_clk = {
  883. .rrate = 1000,
  884. .hw.init = &(const struct clk_init_data){
  885. .name = "measure_only_gpu_cc_sleep_clk",
  886. .ops = &clk_dummy_ops,
  887. },
  888. };
  889. static struct clk_dummy measure_only_gx_clkctl_acd_gfx3d_clk = {
  890. .rrate = 1000,
  891. .hw.init = &(const struct clk_init_data){
  892. .name = "measure_only_gx_clkctl_acd_gfx3d_clk",
  893. .ops = &clk_dummy_ops,
  894. },
  895. };
  896. static struct clk_dummy measure_only_gx_clkctl_demet_clk = {
  897. .rrate = 1000,
  898. .hw.init = &(const struct clk_init_data){
  899. .name = "measure_only_gx_clkctl_demet_clk",
  900. .ops = &clk_dummy_ops,
  901. },
  902. };
  903. static struct clk_dummy measure_only_gx_clkctl_gx_accu_clk = {
  904. .rrate = 1000,
  905. .hw.init = &(const struct clk_init_data){
  906. .name = "measure_only_gx_clkctl_gx_accu_clk",
  907. .ops = &clk_dummy_ops,
  908. },
  909. };
  910. static struct clk_dummy measure_only_gx_clkctl_gx_gfx3d_clk = {
  911. .rrate = 1000,
  912. .hw.init = &(const struct clk_init_data){
  913. .name = "measure_only_gx_clkctl_gx_gfx3d_clk",
  914. .ops = &clk_dummy_ops,
  915. },
  916. };
  917. static struct clk_dummy measure_only_gx_clkctl_gx_gfx3d_rdvm_clk = {
  918. .rrate = 1000,
  919. .hw.init = &(const struct clk_init_data){
  920. .name = "measure_only_gx_clkctl_gx_gfx3d_rdvm_clk",
  921. .ops = &clk_dummy_ops,
  922. },
  923. };
  924. static struct clk_dummy measure_only_gx_clkctl_mnd1x_gfx3d_clk = {
  925. .rrate = 1000,
  926. .hw.init = &(const struct clk_init_data){
  927. .name = "measure_only_gx_clkctl_mnd1x_gfx3d_clk",
  928. .ops = &clk_dummy_ops,
  929. },
  930. };
  931. static struct clk_dummy measure_only_ipa_2x_clk = {
  932. .rrate = 1000,
  933. .hw.init = &(const struct clk_init_data){
  934. .name = "measure_only_ipa_2x_clk",
  935. .ops = &clk_dummy_ops,
  936. },
  937. };
  938. static struct clk_dummy measure_only_mccc_clk = {
  939. .rrate = 1000,
  940. .hw.init = &(const struct clk_init_data){
  941. .name = "measure_only_mccc_clk",
  942. .ops = &clk_dummy_ops,
  943. },
  944. };
  945. static struct clk_dummy measure_only_memnoc_clk = {
  946. .rrate = 1000,
  947. .hw.init = &(const struct clk_init_data){
  948. .name = "measure_only_memnoc_clk",
  949. .ops = &clk_dummy_ops,
  950. },
  951. };
  952. static struct clk_dummy measure_only_pcie_0_pipe_clk = {
  953. .rrate = 1000,
  954. .hw.init = &(const struct clk_init_data){
  955. .name = "measure_only_pcie_0_pipe_clk",
  956. .ops = &clk_dummy_ops,
  957. },
  958. };
  959. static struct clk_dummy measure_only_pcie_1_pipe_clk = {
  960. .rrate = 1000,
  961. .hw.init = &(const struct clk_init_data){
  962. .name = "measure_only_pcie_1_pipe_clk",
  963. .ops = &clk_dummy_ops,
  964. },
  965. };
  966. static struct clk_dummy measure_only_snoc_clk = {
  967. .rrate = 1000,
  968. .hw.init = &(const struct clk_init_data){
  969. .name = "measure_only_snoc_clk",
  970. .ops = &clk_dummy_ops,
  971. },
  972. };
  973. static struct clk_dummy measure_only_ufs_phy_rx_symbol_0_clk = {
  974. .rrate = 1000,
  975. .hw.init = &(const struct clk_init_data){
  976. .name = "measure_only_ufs_phy_rx_symbol_0_clk",
  977. .ops = &clk_dummy_ops,
  978. },
  979. };
  980. static struct clk_dummy measure_only_ufs_phy_rx_symbol_1_clk = {
  981. .rrate = 1000,
  982. .hw.init = &(const struct clk_init_data){
  983. .name = "measure_only_ufs_phy_rx_symbol_1_clk",
  984. .ops = &clk_dummy_ops,
  985. },
  986. };
  987. static struct clk_dummy measure_only_ufs_phy_tx_symbol_0_clk = {
  988. .rrate = 1000,
  989. .hw.init = &(const struct clk_init_data){
  990. .name = "measure_only_ufs_phy_tx_symbol_0_clk",
  991. .ops = &clk_dummy_ops,
  992. },
  993. };
  994. static struct clk_dummy measure_only_usb3_phy_wrapper_gcc_usb30_pipe_clk = {
  995. .rrate = 1000,
  996. .hw.init = &(const struct clk_init_data){
  997. .name = "measure_only_usb3_phy_wrapper_gcc_usb30_pipe_clk",
  998. .ops = &clk_dummy_ops,
  999. },
  1000. };
  1001. static struct clk_dummy measure_only_video_cc_ahb_clk = {
  1002. .rrate = 1000,
  1003. .hw.init = &(const struct clk_init_data){
  1004. .name = "measure_only_video_cc_ahb_clk",
  1005. .ops = &clk_dummy_ops,
  1006. },
  1007. };
  1008. static struct clk_dummy measure_only_video_cc_sleep_clk = {
  1009. .rrate = 1000,
  1010. .hw.init = &(const struct clk_init_data){
  1011. .name = "measure_only_video_cc_sleep_clk",
  1012. .ops = &clk_dummy_ops,
  1013. },
  1014. };
  1015. static struct clk_dummy measure_only_video_cc_xo_clk = {
  1016. .rrate = 1000,
  1017. .hw.init = &(const struct clk_init_data){
  1018. .name = "measure_only_video_cc_xo_clk",
  1019. .ops = &clk_dummy_ops,
  1020. },
  1021. };
  1022. static struct clk_hw *debugcc_volcano_hws[] = {
  1023. &measure_only_apcs_gold_post_acd_clk.hw,
  1024. &measure_only_apcs_gold_pre_acd_clk.hw,
  1025. &measure_only_apcs_goldplus_post_acd_clk.hw,
  1026. &measure_only_apcs_goldplus_pre_acd_clk.hw,
  1027. &measure_only_apcs_l3_post_acd_clk.hw,
  1028. &measure_only_apcs_l3_pre_acd_clk.hw,
  1029. &measure_only_apcs_silver_post_acd_clk.hw,
  1030. &measure_only_apcs_silver_pre_acd_clk.hw,
  1031. &measure_only_cam_cc_gdsc_clk.hw,
  1032. &measure_only_cam_cc_sleep_clk.hw,
  1033. &measure_only_cnoc_clk.hw,
  1034. &measure_only_disp_cc_sleep_clk.hw,
  1035. &measure_only_disp_cc_xo_clk.hw,
  1036. &measure_only_gcc_camera_ahb_clk.hw,
  1037. &measure_only_gcc_camera_hf_xo_clk.hw,
  1038. &measure_only_gcc_camera_sf_xo_clk.hw,
  1039. &measure_only_gcc_disp_ahb_clk.hw,
  1040. &measure_only_gcc_disp_xo_clk.hw,
  1041. &measure_only_gcc_gpu_cfg_ahb_clk.hw,
  1042. &measure_only_gcc_video_ahb_clk.hw,
  1043. &measure_only_gcc_video_xo_clk.hw,
  1044. &measure_only_gpu_cc_cb_clk.hw,
  1045. &measure_only_gpu_cc_cxo_aon_clk.hw,
  1046. &measure_only_gpu_cc_demet_clk.hw,
  1047. &measure_only_gpu_cc_gx_ahb_ff_clk.hw,
  1048. &measure_only_gpu_cc_rscc_hub_aon_clk.hw,
  1049. &measure_only_gpu_cc_rscc_xo_aon_clk.hw,
  1050. &measure_only_gpu_cc_sleep_clk.hw,
  1051. &measure_only_gx_clkctl_acd_gfx3d_clk.hw,
  1052. &measure_only_gx_clkctl_demet_clk.hw,
  1053. &measure_only_gx_clkctl_gx_accu_clk.hw,
  1054. &measure_only_gx_clkctl_gx_gfx3d_clk.hw,
  1055. &measure_only_gx_clkctl_gx_gfx3d_rdvm_clk.hw,
  1056. &measure_only_gx_clkctl_mnd1x_gfx3d_clk.hw,
  1057. &measure_only_ipa_2x_clk.hw,
  1058. &measure_only_mccc_clk.hw,
  1059. &measure_only_memnoc_clk.hw,
  1060. &measure_only_pcie_0_pipe_clk.hw,
  1061. &measure_only_pcie_1_pipe_clk.hw,
  1062. &measure_only_snoc_clk.hw,
  1063. &measure_only_ufs_phy_rx_symbol_0_clk.hw,
  1064. &measure_only_ufs_phy_rx_symbol_1_clk.hw,
  1065. &measure_only_ufs_phy_tx_symbol_0_clk.hw,
  1066. &measure_only_usb3_phy_wrapper_gcc_usb30_pipe_clk.hw,
  1067. &measure_only_video_cc_ahb_clk.hw,
  1068. &measure_only_video_cc_sleep_clk.hw,
  1069. &measure_only_video_cc_xo_clk.hw,
  1070. };
  1071. static const struct of_device_id clk_debug_match_table[] = {
  1072. { .compatible = "qcom,volcano-debugcc" },
  1073. { }
  1074. };
  1075. static int clk_debug_volcano_probe(struct platform_device *pdev)
  1076. {
  1077. struct clk *clk;
  1078. int ret = 0, i;
  1079. BUILD_BUG_ON(ARRAY_SIZE(apss_cc_debug_mux_parent_names) !=
  1080. ARRAY_SIZE(apss_cc_debug_mux_sels));
  1081. BUILD_BUG_ON(ARRAY_SIZE(cam_cc_debug_mux_parent_names) !=
  1082. ARRAY_SIZE(cam_cc_debug_mux_sels));
  1083. BUILD_BUG_ON(ARRAY_SIZE(disp_cc_debug_mux_parent_names) !=
  1084. ARRAY_SIZE(disp_cc_debug_mux_sels));
  1085. BUILD_BUG_ON(ARRAY_SIZE(gcc_debug_mux_parent_names) != ARRAY_SIZE(gcc_debug_mux_sels));
  1086. BUILD_BUG_ON(ARRAY_SIZE(gpu_cc_debug_mux_parent_names) !=
  1087. ARRAY_SIZE(gpu_cc_debug_mux_sels));
  1088. BUILD_BUG_ON(ARRAY_SIZE(gx_clkctl_debug_mux_parent_names) !=
  1089. ARRAY_SIZE(gx_clkctl_debug_mux_sels));
  1090. BUILD_BUG_ON(ARRAY_SIZE(video_cc_debug_mux_parent_names) !=
  1091. ARRAY_SIZE(video_cc_debug_mux_sels));
  1092. clk = devm_clk_get(&pdev->dev, "xo_clk_src");
  1093. if (IS_ERR(clk)) {
  1094. if (PTR_ERR(clk) != -EPROBE_DEFER)
  1095. dev_err(&pdev->dev, "Unable to get xo clock\n");
  1096. return PTR_ERR(clk);
  1097. }
  1098. debug_mux_priv.cxo = clk;
  1099. for (i = 0; i < ARRAY_SIZE(mux_list); i++) {
  1100. if (IS_ERR_OR_NULL(mux_list[i].mux->regmap)) {
  1101. ret = map_debug_bases(pdev, mux_list[i].regmap_name,
  1102. mux_list[i].mux);
  1103. if (ret == -EBADR)
  1104. continue;
  1105. else if (ret)
  1106. return ret;
  1107. }
  1108. }
  1109. for (i = 0; i < ARRAY_SIZE(debugcc_volcano_hws); i++) {
  1110. clk = devm_clk_register(&pdev->dev, debugcc_volcano_hws[i]);
  1111. if (IS_ERR(clk)) {
  1112. dev_err(&pdev->dev, "Unable to register %s, err:(%ld)\n",
  1113. qcom_clk_hw_get_name(debugcc_volcano_hws[i]),
  1114. PTR_ERR(clk));
  1115. return PTR_ERR(clk);
  1116. }
  1117. }
  1118. for (i = 0; i < ARRAY_SIZE(mux_list); i++) {
  1119. ret = devm_clk_register_debug_mux(&pdev->dev, mux_list[i].mux);
  1120. if (ret) {
  1121. dev_err(&pdev->dev, "Unable to register mux clk %s, err:(%d)\n",
  1122. qcom_clk_hw_get_name(&mux_list[i].mux->hw),
  1123. ret);
  1124. return ret;
  1125. }
  1126. }
  1127. ret = clk_debug_measure_register(&gcc_debug_mux.hw);
  1128. if (ret) {
  1129. dev_err(&pdev->dev, "Could not register Measure clocks\n");
  1130. return ret;
  1131. }
  1132. dev_info(&pdev->dev, "Registered debug measure clocks\n");
  1133. return ret;
  1134. }
  1135. static struct platform_driver clk_debug_driver = {
  1136. .probe = clk_debug_volcano_probe,
  1137. .driver = {
  1138. .name = "volcano-debugcc",
  1139. .of_match_table = clk_debug_match_table,
  1140. },
  1141. };
  1142. static int __init clk_debug_volcano_init(void)
  1143. {
  1144. return platform_driver_register(&clk_debug_driver);
  1145. }
  1146. fs_initcall(clk_debug_volcano_init);
  1147. MODULE_DESCRIPTION("QTI DEBUG CC VOLCANO Driver");
  1148. MODULE_LICENSE("GPL");