debugcc-sm8150.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2020, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #define pr_fmt(fmt) "clk: %s: " fmt, __func__
  7. #include <linux/clk.h>
  8. #include <linux/clk-provider.h>
  9. #include <linux/err.h>
  10. #include <linux/kernel.h>
  11. #include <linux/mfd/syscon.h>
  12. #include <linux/module.h>
  13. #include <linux/of.h>
  14. #include <linux/of_device.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/regmap.h>
  17. #include "clk-debug.h"
  18. #include "common.h"
  19. static struct measure_clk_data debug_mux_priv = {
  20. .ctl_reg = 0x62038,
  21. .status_reg = 0x6203C,
  22. .xo_div4_cbcr = 0x43008,
  23. };
  24. static const char *const cpu_cc_debug_mux_parent_names[] = {
  25. "l3_clk",
  26. "perfcl_clk",
  27. "perfpcl_clk",
  28. "pwrcl_clk",
  29. };
  30. static int cpu_cc_debug_mux_sels[] = {
  31. 0x46, /* l3_clk */
  32. 0x45, /* perfcl_clk */
  33. 0x47, /* perfpcl_clk */
  34. 0x44, /* pwrcl_clk */
  35. };
  36. static int apss_cc_debug_mux_pre_divs[] = {
  37. 0x10, /* l3_clk */
  38. 0x10, /* perfcl_clk */
  39. 0x10, /* perfpcl_clk */
  40. 0x10, /* pwrcl_clk */
  41. };
  42. static struct clk_debug_mux cpu_cc_debug_mux = {
  43. .priv = &debug_mux_priv,
  44. .debug_offset = 0x18,
  45. .post_div_offset = 0x18,
  46. .cbcr_offset = 0x0,
  47. .src_sel_mask = 0x7F0,
  48. .src_sel_shift = 4,
  49. .post_div_mask = 0x7800,
  50. .post_div_shift = 11,
  51. .post_div_val = 1,
  52. .mux_sels = cpu_cc_debug_mux_sels,
  53. .num_mux_sels = ARRAY_SIZE(cpu_cc_debug_mux_sels),
  54. .pre_div_vals = apss_cc_debug_mux_pre_divs,
  55. .hw.init = &(struct clk_init_data){
  56. .name = "cpu_cc_debug_mux",
  57. .ops = &clk_debug_mux_ops,
  58. .parent_names = cpu_cc_debug_mux_parent_names,
  59. .num_parents = ARRAY_SIZE(cpu_cc_debug_mux_parent_names),
  60. },
  61. };
  62. static const char *const cam_cc_debug_mux_parent_names[] = {
  63. "cam_cc_bps_ahb_clk",
  64. "cam_cc_bps_areg_clk",
  65. "cam_cc_bps_axi_clk",
  66. "cam_cc_bps_clk",
  67. "cam_cc_camnoc_axi_clk",
  68. "cam_cc_camnoc_dcd_xo_clk",
  69. "cam_cc_cci_0_clk",
  70. "cam_cc_cci_1_clk",
  71. "cam_cc_core_ahb_clk",
  72. "cam_cc_cpas_ahb_clk",
  73. "cam_cc_csi0phytimer_clk",
  74. "cam_cc_csi1phytimer_clk",
  75. "cam_cc_csi2phytimer_clk",
  76. "cam_cc_csi3phytimer_clk",
  77. "cam_cc_csiphy0_clk",
  78. "cam_cc_csiphy1_clk",
  79. "cam_cc_csiphy2_clk",
  80. "cam_cc_csiphy3_clk",
  81. "cam_cc_fd_core_clk",
  82. "cam_cc_fd_core_uar_clk",
  83. "cam_cc_icp_ahb_clk",
  84. "cam_cc_icp_clk",
  85. "cam_cc_ife_0_axi_clk",
  86. "cam_cc_ife_0_clk",
  87. "cam_cc_ife_0_cphy_rx_clk",
  88. "cam_cc_ife_0_csid_clk",
  89. "cam_cc_ife_0_dsp_clk",
  90. "cam_cc_ife_1_axi_clk",
  91. "cam_cc_ife_1_clk",
  92. "cam_cc_ife_1_cphy_rx_clk",
  93. "cam_cc_ife_1_csid_clk",
  94. "cam_cc_ife_1_dsp_clk",
  95. "cam_cc_ife_lite_0_clk",
  96. "cam_cc_ife_lite_0_cphy_rx_clk",
  97. "cam_cc_ife_lite_0_csid_clk",
  98. "cam_cc_ife_lite_1_clk",
  99. "cam_cc_ife_lite_1_cphy_rx_clk",
  100. "cam_cc_ife_lite_1_csid_clk",
  101. "cam_cc_ipe_0_ahb_clk",
  102. "cam_cc_ipe_0_areg_clk",
  103. "cam_cc_ipe_0_axi_clk",
  104. "cam_cc_ipe_0_clk",
  105. "cam_cc_ipe_1_ahb_clk",
  106. "cam_cc_ipe_1_areg_clk",
  107. "cam_cc_ipe_1_axi_clk",
  108. "cam_cc_ipe_1_clk",
  109. "cam_cc_jpeg_clk",
  110. "cam_cc_lrme_clk",
  111. "cam_cc_mclk0_clk",
  112. "cam_cc_mclk1_clk",
  113. "cam_cc_mclk2_clk",
  114. "cam_cc_mclk3_clk",
  115. "measure_only_cam_cc_gdsc_clk",
  116. };
  117. static int cam_cc_debug_mux_sels[] = {
  118. 0xE, /* cam_cc_bps_ahb_clk */
  119. 0xD, /* cam_cc_bps_areg_clk */
  120. 0xC, /* cam_cc_bps_axi_clk */
  121. 0xB, /* cam_cc_bps_clk */
  122. 0x27, /* cam_cc_camnoc_axi_clk */
  123. 0x33, /* cam_cc_camnoc_dcd_xo_clk */
  124. 0x2A, /* cam_cc_cci_0_clk */
  125. 0x3B, /* cam_cc_cci_1_clk */
  126. 0x2E, /* cam_cc_core_ahb_clk */
  127. 0x2C, /* cam_cc_cpas_ahb_clk */
  128. 0x5, /* cam_cc_csi0phytimer_clk */
  129. 0x7, /* cam_cc_csi1phytimer_clk */
  130. 0x9, /* cam_cc_csi2phytimer_clk */
  131. 0x35, /* cam_cc_csi3phytimer_clk */
  132. 0x6, /* cam_cc_csiphy0_clk */
  133. 0x8, /* cam_cc_csiphy1_clk */
  134. 0xA, /* cam_cc_csiphy2_clk */
  135. 0x36, /* cam_cc_csiphy3_clk */
  136. 0x28, /* cam_cc_fd_core_clk */
  137. 0x29, /* cam_cc_fd_core_uar_clk */
  138. 0x37, /* cam_cc_icp_ahb_clk */
  139. 0x26, /* cam_cc_icp_clk */
  140. 0x1B, /* cam_cc_ife_0_axi_clk */
  141. 0x17, /* cam_cc_ife_0_clk */
  142. 0x1A, /* cam_cc_ife_0_cphy_rx_clk */
  143. 0x19, /* cam_cc_ife_0_csid_clk */
  144. 0x18, /* cam_cc_ife_0_dsp_clk */
  145. 0x21, /* cam_cc_ife_1_axi_clk */
  146. 0x1D, /* cam_cc_ife_1_clk */
  147. 0x20, /* cam_cc_ife_1_cphy_rx_clk */
  148. 0x1F, /* cam_cc_ife_1_csid_clk */
  149. 0x1E, /* cam_cc_ife_1_dsp_clk */
  150. 0x22, /* cam_cc_ife_lite_0_clk */
  151. 0x24, /* cam_cc_ife_lite_0_cphy_rx_clk */
  152. 0x23, /* cam_cc_ife_lite_0_csid_clk */
  153. 0x38, /* cam_cc_ife_lite_1_clk */
  154. 0x3A, /* cam_cc_ife_lite_1_cphy_rx_clk */
  155. 0x39, /* cam_cc_ife_lite_1_csid_clk */
  156. 0x12, /* cam_cc_ipe_0_ahb_clk */
  157. 0x11, /* cam_cc_ipe_0_areg_clk */
  158. 0x10, /* cam_cc_ipe_0_axi_clk */
  159. 0xF, /* cam_cc_ipe_0_clk */
  160. 0x16, /* cam_cc_ipe_1_ahb_clk */
  161. 0x15, /* cam_cc_ipe_1_areg_clk */
  162. 0x14, /* cam_cc_ipe_1_axi_clk */
  163. 0x13, /* cam_cc_ipe_1_clk */
  164. 0x25, /* cam_cc_jpeg_clk */
  165. 0x2B, /* cam_cc_lrme_clk */
  166. 0x1, /* cam_cc_mclk0_clk */
  167. 0x2, /* cam_cc_mclk1_clk */
  168. 0x3, /* cam_cc_mclk2_clk */
  169. 0x4, /* cam_cc_mclk3_clk */
  170. 0x3C, /* measure_only_cam_cc_gdsc_clk */
  171. };
  172. static struct clk_debug_mux cam_cc_debug_mux = {
  173. .priv = &debug_mux_priv,
  174. .debug_offset = 0xD000,
  175. .post_div_offset = 0xD004,
  176. .cbcr_offset = 0xD008,
  177. .src_sel_mask = 0xFF,
  178. .src_sel_shift = 0,
  179. .post_div_mask = 0xF,
  180. .post_div_shift = 0,
  181. .post_div_val = 4,
  182. .mux_sels = cam_cc_debug_mux_sels,
  183. .num_mux_sels = ARRAY_SIZE(cam_cc_debug_mux_sels),
  184. .hw.init = &(struct clk_init_data){
  185. .name = "cam_cc_debug_mux",
  186. .ops = &clk_debug_mux_ops,
  187. .parent_names = cam_cc_debug_mux_parent_names,
  188. .num_parents = ARRAY_SIZE(cam_cc_debug_mux_parent_names),
  189. },
  190. };
  191. static const char *const disp_cc_debug_mux_parent_names[] = {
  192. "disp_cc_mdss_ahb_clk",
  193. "disp_cc_mdss_byte0_clk",
  194. "disp_cc_mdss_byte0_intf_clk",
  195. "disp_cc_mdss_byte1_clk",
  196. "disp_cc_mdss_byte1_intf_clk",
  197. "disp_cc_mdss_dp_aux1_clk",
  198. "disp_cc_mdss_dp_aux_clk",
  199. "disp_cc_mdss_dp_crypto1_clk",
  200. "disp_cc_mdss_dp_crypto_clk",
  201. "disp_cc_mdss_dp_link1_clk",
  202. "disp_cc_mdss_dp_link1_intf_clk",
  203. "disp_cc_mdss_dp_link_clk",
  204. "disp_cc_mdss_dp_link_intf_clk",
  205. "disp_cc_mdss_dp_pixel1_clk",
  206. "disp_cc_mdss_dp_pixel2_clk",
  207. "disp_cc_mdss_dp_pixel_clk",
  208. "disp_cc_mdss_edp_aux_clk",
  209. "disp_cc_mdss_edp_gtc_clk",
  210. "disp_cc_mdss_edp_link_clk",
  211. "disp_cc_mdss_edp_link_intf_clk",
  212. "disp_cc_mdss_edp_pixel_clk",
  213. "disp_cc_mdss_esc0_clk",
  214. "disp_cc_mdss_esc1_clk",
  215. "disp_cc_mdss_mdp_clk",
  216. "disp_cc_mdss_mdp_lut_clk",
  217. "disp_cc_mdss_non_gdsc_ahb_clk",
  218. "disp_cc_mdss_pclk0_clk",
  219. "disp_cc_mdss_pclk1_clk",
  220. "disp_cc_mdss_rot_clk",
  221. "disp_cc_mdss_rscc_ahb_clk",
  222. "disp_cc_mdss_rscc_vsync_clk",
  223. "disp_cc_mdss_vsync_clk",
  224. "measure_only_disp_cc_xo_clk",
  225. };
  226. static int disp_cc_debug_mux_sels[] = {
  227. 0x2B, /* disp_cc_mdss_ahb_clk */
  228. 0x15, /* disp_cc_mdss_byte0_clk */
  229. 0x16, /* disp_cc_mdss_byte0_intf_clk */
  230. 0x17, /* disp_cc_mdss_byte1_clk */
  231. 0x18, /* disp_cc_mdss_byte1_intf_clk */
  232. 0x25, /* disp_cc_mdss_dp_aux1_clk */
  233. 0x20, /* disp_cc_mdss_dp_aux_clk */
  234. 0x24, /* disp_cc_mdss_dp_crypto1_clk */
  235. 0x1D, /* disp_cc_mdss_dp_crypto_clk */
  236. 0x22, /* disp_cc_mdss_dp_link1_clk */
  237. 0x23, /* disp_cc_mdss_dp_link1_intf_clk */
  238. 0x1B, /* disp_cc_mdss_dp_link_clk */
  239. 0x1C, /* disp_cc_mdss_dp_link_intf_clk */
  240. 0x1F, /* disp_cc_mdss_dp_pixel1_clk */
  241. 0x21, /* disp_cc_mdss_dp_pixel2_clk */
  242. 0x1E, /* disp_cc_mdss_dp_pixel_clk */
  243. 0x29, /* disp_cc_mdss_edp_aux_clk */
  244. 0x2A, /* disp_cc_mdss_edp_gtc_clk */
  245. 0x27, /* disp_cc_mdss_edp_link_clk */
  246. 0x28, /* disp_cc_mdss_edp_link_intf_clk */
  247. 0x26, /* disp_cc_mdss_edp_pixel_clk */
  248. 0x19, /* disp_cc_mdss_esc0_clk */
  249. 0x1A, /* disp_cc_mdss_esc1_clk */
  250. 0x11, /* disp_cc_mdss_mdp_clk */
  251. 0x13, /* disp_cc_mdss_mdp_lut_clk */
  252. 0x2C, /* disp_cc_mdss_non_gdsc_ahb_clk */
  253. 0xF, /* disp_cc_mdss_pclk0_clk */
  254. 0x10, /* disp_cc_mdss_pclk1_clk */
  255. 0x12, /* disp_cc_mdss_rot_clk */
  256. 0x2E, /* disp_cc_mdss_rscc_ahb_clk */
  257. 0x2D, /* disp_cc_mdss_rscc_vsync_clk */
  258. 0x14, /* disp_cc_mdss_vsync_clk */
  259. 0x36, /* measure_only_disp_cc_xo_clk */
  260. };
  261. static struct clk_debug_mux disp_cc_debug_mux = {
  262. .priv = &debug_mux_priv,
  263. .debug_offset = 0x7000,
  264. .post_div_offset = 0x5008,
  265. .cbcr_offset = 0x500C,
  266. .src_sel_mask = 0xFF,
  267. .src_sel_shift = 0,
  268. .post_div_mask = 0x3,
  269. .post_div_shift = 0,
  270. .post_div_val = 4,
  271. .mux_sels = disp_cc_debug_mux_sels,
  272. .num_mux_sels = ARRAY_SIZE(disp_cc_debug_mux_sels),
  273. .hw.init = &(struct clk_init_data){
  274. .name = "disp_cc_debug_mux",
  275. .ops = &clk_debug_mux_ops,
  276. .parent_names = disp_cc_debug_mux_parent_names,
  277. .num_parents = ARRAY_SIZE(disp_cc_debug_mux_parent_names),
  278. },
  279. };
  280. static const char *const gcc_debug_mux_parent_names[] = {
  281. "cpu_cc_debug_mux",
  282. "cam_cc_debug_mux",
  283. "disp_cc_debug_mux",
  284. "gcc_aggre_noc_pcie_tbu_clk",
  285. "gcc_aggre_ufs_card_axi_clk",
  286. "gcc_aggre_ufs_phy_axi_clk",
  287. "gcc_aggre_usb3_prim_axi_clk",
  288. "gcc_aggre_usb3_sec_axi_clk",
  289. "gcc_boot_rom_ahb_clk",
  290. "gcc_camera_hf_axi_clk",
  291. "gcc_camera_sf_axi_clk",
  292. "gcc_cfg_noc_usb3_prim_axi_clk",
  293. "gcc_cfg_noc_usb3_sec_axi_clk",
  294. "gcc_cpuss_ahb_clk",
  295. "gcc_cpuss_rbcpr_clk",
  296. "gcc_ddrss_gpu_axi_clk",
  297. "gcc_disp_hf_axi_clk",
  298. "gcc_disp_sf_axi_clk",
  299. "gcc_emac_axi_clk",
  300. "gcc_emac_ptp_clk",
  301. "gcc_emac_rgmii_clk",
  302. "gcc_emac_slv_ahb_clk",
  303. "gcc_gp1_clk",
  304. "gcc_gp2_clk",
  305. "gcc_gp3_clk",
  306. "gcc_gpu_gpll0_clk_src",
  307. "gcc_gpu_gpll0_div_clk_src",
  308. "gcc_gpu_memnoc_gfx_clk",
  309. "gcc_gpu_snoc_dvm_gfx_clk",
  310. "gcc_npu_at_clk",
  311. "gcc_npu_axi_clk",
  312. "gcc_npu_gpll0_clk_src",
  313. "gcc_npu_gpll0_div_clk_src",
  314. "gcc_npu_trig_clk",
  315. "gcc_pcie0_phy_refgen_clk",
  316. "gcc_pcie1_phy_refgen_clk",
  317. "gcc_pcie_0_aux_clk",
  318. "gcc_pcie_0_cfg_ahb_clk",
  319. "gcc_pcie_0_mstr_axi_clk",
  320. "gcc_pcie_0_pipe_clk",
  321. "gcc_pcie_0_slv_axi_clk",
  322. "gcc_pcie_0_slv_q2a_axi_clk",
  323. "gcc_pcie_1_aux_clk",
  324. "gcc_pcie_1_cfg_ahb_clk",
  325. "gcc_pcie_1_mstr_axi_clk",
  326. "gcc_pcie_1_pipe_clk",
  327. "gcc_pcie_1_slv_axi_clk",
  328. "gcc_pcie_1_slv_q2a_axi_clk",
  329. "gcc_pcie_phy_aux_clk",
  330. "gcc_pdm2_clk",
  331. "gcc_pdm_ahb_clk",
  332. "gcc_pdm_xo4_clk",
  333. "gcc_prng_ahb_clk",
  334. "gcc_qmip_camera_nrt_ahb_clk",
  335. "gcc_qmip_camera_rt_ahb_clk",
  336. "gcc_qmip_disp_ahb_clk",
  337. "gcc_qmip_video_cvp_ahb_clk",
  338. "gcc_qmip_video_vcodec_ahb_clk",
  339. "gcc_qspi_cnoc_periph_ahb_clk",
  340. "gcc_qspi_core_clk",
  341. "gcc_qupv3_wrap0_s0_clk",
  342. "gcc_qupv3_wrap0_s1_clk",
  343. "gcc_qupv3_wrap0_s2_clk",
  344. "gcc_qupv3_wrap0_s3_clk",
  345. "gcc_qupv3_wrap0_s4_clk",
  346. "gcc_qupv3_wrap0_s5_clk",
  347. "gcc_qupv3_wrap0_s6_clk",
  348. "gcc_qupv3_wrap0_s7_clk",
  349. "gcc_qupv3_wrap1_s0_clk",
  350. "gcc_qupv3_wrap1_s1_clk",
  351. "gcc_qupv3_wrap1_s2_clk",
  352. "gcc_qupv3_wrap1_s3_clk",
  353. "gcc_qupv3_wrap1_s4_clk",
  354. "gcc_qupv3_wrap1_s5_clk",
  355. "gcc_qupv3_wrap2_s0_clk",
  356. "gcc_qupv3_wrap2_s1_clk",
  357. "gcc_qupv3_wrap2_s2_clk",
  358. "gcc_qupv3_wrap2_s3_clk",
  359. "gcc_qupv3_wrap2_s4_clk",
  360. "gcc_qupv3_wrap2_s5_clk",
  361. "gcc_qupv3_wrap_0_m_ahb_clk",
  362. "gcc_qupv3_wrap_0_s_ahb_clk",
  363. "gcc_qupv3_wrap_1_m_ahb_clk",
  364. "gcc_qupv3_wrap_1_s_ahb_clk",
  365. "gcc_qupv3_wrap_2_m_ahb_clk",
  366. "gcc_qupv3_wrap_2_s_ahb_clk",
  367. "gcc_sdcc2_ahb_clk",
  368. "gcc_sdcc2_apps_clk",
  369. "gcc_sdcc4_ahb_clk",
  370. "gcc_sdcc4_apps_clk",
  371. "gcc_sys_noc_cpuss_ahb_clk",
  372. "gcc_tsif_ahb_clk",
  373. "gcc_tsif_inactivity_timers_clk",
  374. "gcc_tsif_ref_clk",
  375. "gcc_ufs_card_ahb_clk",
  376. "gcc_ufs_card_axi_clk",
  377. "gcc_ufs_card_ice_core_clk",
  378. "gcc_ufs_card_phy_aux_clk",
  379. "gcc_ufs_card_rx_symbol_0_clk",
  380. "gcc_ufs_card_rx_symbol_1_clk",
  381. "gcc_ufs_card_tx_symbol_0_clk",
  382. "gcc_ufs_card_unipro_core_clk",
  383. "gcc_ufs_phy_ahb_clk",
  384. "gcc_ufs_phy_axi_clk",
  385. "gcc_ufs_phy_ice_core_clk",
  386. "gcc_ufs_phy_phy_aux_clk",
  387. "gcc_ufs_phy_rx_symbol_0_clk",
  388. "gcc_ufs_phy_rx_symbol_1_clk",
  389. "gcc_ufs_phy_tx_symbol_0_clk",
  390. "gcc_ufs_phy_unipro_core_clk",
  391. "gcc_usb30_prim_master_clk",
  392. "gcc_usb30_prim_mock_utmi_clk",
  393. "gcc_usb30_prim_sleep_clk",
  394. "gcc_usb30_sec_master_clk",
  395. "gcc_usb30_sec_mock_utmi_clk",
  396. "gcc_usb30_sec_sleep_clk",
  397. "gcc_usb3_prim_phy_aux_clk",
  398. "gcc_usb3_prim_phy_com_aux_clk",
  399. "gcc_usb3_prim_phy_pipe_clk",
  400. "gcc_usb3_sec_phy_aux_clk",
  401. "gcc_usb3_sec_phy_com_aux_clk",
  402. "gcc_usb3_sec_phy_pipe_clk",
  403. "gcc_video_axi0_clk",
  404. "gcc_video_axi1_clk",
  405. "gcc_video_axic_clk",
  406. "gpu_cc_debug_mux",
  407. "measure_only_cdsp_clk",
  408. "measure_only_cnoc_clk",
  409. "measure_only_gcc_camera_ahb_clk",
  410. "measure_only_gcc_camera_xo_clk",
  411. "measure_only_gcc_cpuss_dvm_bus_clk",
  412. "measure_only_gcc_cpuss_gnoc_clk",
  413. "measure_only_gcc_disp_ahb_clk",
  414. "measure_only_gcc_disp_xo_clk",
  415. "measure_only_gcc_gpu_cfg_ahb_clk",
  416. "measure_only_gcc_npu_cfg_ahb_clk",
  417. "measure_only_gcc_video_ahb_clk",
  418. "measure_only_gcc_video_xo_clk",
  419. "measure_only_ipa_2x_clk",
  420. "measure_only_snoc_clk",
  421. "npu_cc_debug_mux",
  422. "video_cc_debug_mux",
  423. "mc_cc_debug_mux",
  424. };
  425. static int gcc_debug_mux_sels[] = {
  426. 0xE8, /* cpu_cc_debug_mux */
  427. 0x55, /* cam_cc_debug_mux */
  428. 0x56, /* disp_cc_debug_mux */
  429. 0x36, /* gcc_aggre_noc_pcie_tbu_clk */
  430. 0x141, /* gcc_aggre_ufs_card_axi_clk */
  431. 0x140, /* gcc_aggre_ufs_phy_axi_clk */
  432. 0x13E, /* gcc_aggre_usb3_prim_axi_clk */
  433. 0x13F, /* gcc_aggre_usb3_sec_axi_clk */
  434. 0xA0, /* gcc_boot_rom_ahb_clk */
  435. 0x4D, /* gcc_camera_hf_axi_clk */
  436. 0x4E, /* gcc_camera_sf_axi_clk */
  437. 0x22, /* gcc_cfg_noc_usb3_prim_axi_clk */
  438. 0x23, /* gcc_cfg_noc_usb3_sec_axi_clk */
  439. 0xE0, /* gcc_cpuss_ahb_clk */
  440. 0xE2, /* gcc_cpuss_rbcpr_clk */
  441. 0xC0, /* gcc_ddrss_gpu_axi_clk */
  442. 0x4F, /* gcc_disp_hf_axi_clk */
  443. 0x50, /* gcc_disp_sf_axi_clk */
  444. 0x18D, /* gcc_emac_axi_clk */
  445. 0x190, /* gcc_emac_ptp_clk */
  446. 0x18F, /* gcc_emac_rgmii_clk */
  447. 0x18E, /* gcc_emac_slv_ahb_clk */
  448. 0xF0, /* gcc_gp1_clk */
  449. 0xF1, /* gcc_gp2_clk */
  450. 0xF2, /* gcc_gp3_clk */
  451. 0x166, /* gcc_gpu_gpll0_clk_src */
  452. 0x167, /* gcc_gpu_gpll0_div_clk_src */
  453. 0x163, /* gcc_gpu_memnoc_gfx_clk */
  454. 0x165, /* gcc_gpu_snoc_dvm_gfx_clk */
  455. 0x17D, /* gcc_npu_at_clk */
  456. 0x17B, /* gcc_npu_axi_clk */
  457. 0x17E, /* gcc_npu_gpll0_clk_src */
  458. 0x17F, /* gcc_npu_gpll0_div_clk_src */
  459. 0x17C, /* gcc_npu_trig_clk */
  460. 0x104, /* gcc_pcie0_phy_refgen_clk */
  461. 0x105, /* gcc_pcie1_phy_refgen_clk */
  462. 0xF7, /* gcc_pcie_0_aux_clk */
  463. 0xF6, /* gcc_pcie_0_cfg_ahb_clk */
  464. 0xF5, /* gcc_pcie_0_mstr_axi_clk */
  465. 0xF8, /* gcc_pcie_0_pipe_clk */
  466. 0xF4, /* gcc_pcie_0_slv_axi_clk */
  467. 0xF3, /* gcc_pcie_0_slv_q2a_axi_clk */
  468. 0xFF, /* gcc_pcie_1_aux_clk */
  469. 0xFE, /* gcc_pcie_1_cfg_ahb_clk */
  470. 0xFD, /* gcc_pcie_1_mstr_axi_clk */
  471. 0x100, /* gcc_pcie_1_pipe_clk */
  472. 0xFC, /* gcc_pcie_1_slv_axi_clk */
  473. 0xFB, /* gcc_pcie_1_slv_q2a_axi_clk */
  474. 0x103, /* gcc_pcie_phy_aux_clk */
  475. 0x9A, /* gcc_pdm2_clk */
  476. 0x98, /* gcc_pdm_ahb_clk */
  477. 0x99, /* gcc_pdm_xo4_clk */
  478. 0x9B, /* gcc_prng_ahb_clk */
  479. 0x47, /* gcc_qmip_camera_nrt_ahb_clk */
  480. 0x48, /* gcc_qmip_camera_rt_ahb_clk */
  481. 0x49, /* gcc_qmip_disp_ahb_clk */
  482. 0x45, /* gcc_qmip_video_cvp_ahb_clk */
  483. 0x46, /* gcc_qmip_video_vcodec_ahb_clk */
  484. 0x178, /* gcc_qspi_cnoc_periph_ahb_clk */
  485. 0x179, /* gcc_qspi_core_clk */
  486. 0x86, /* gcc_qupv3_wrap0_s0_clk */
  487. 0x87, /* gcc_qupv3_wrap0_s1_clk */
  488. 0x88, /* gcc_qupv3_wrap0_s2_clk */
  489. 0x89, /* gcc_qupv3_wrap0_s3_clk */
  490. 0x8A, /* gcc_qupv3_wrap0_s4_clk */
  491. 0x8B, /* gcc_qupv3_wrap0_s5_clk */
  492. 0x8C, /* gcc_qupv3_wrap0_s6_clk */
  493. 0x8D, /* gcc_qupv3_wrap0_s7_clk */
  494. 0x92, /* gcc_qupv3_wrap1_s0_clk */
  495. 0x93, /* gcc_qupv3_wrap1_s1_clk */
  496. 0x94, /* gcc_qupv3_wrap1_s2_clk */
  497. 0x95, /* gcc_qupv3_wrap1_s3_clk */
  498. 0x96, /* gcc_qupv3_wrap1_s4_clk */
  499. 0x97, /* gcc_qupv3_wrap1_s5_clk */
  500. 0x185, /* gcc_qupv3_wrap2_s0_clk */
  501. 0x186, /* gcc_qupv3_wrap2_s1_clk */
  502. 0x187, /* gcc_qupv3_wrap2_s2_clk */
  503. 0x188, /* gcc_qupv3_wrap2_s3_clk */
  504. 0x189, /* gcc_qupv3_wrap2_s4_clk */
  505. 0x18A, /* gcc_qupv3_wrap2_s5_clk */
  506. 0x82, /* gcc_qupv3_wrap_0_m_ahb_clk */
  507. 0x83, /* gcc_qupv3_wrap_0_s_ahb_clk */
  508. 0x8E, /* gcc_qupv3_wrap_1_m_ahb_clk */
  509. 0x8F, /* gcc_qupv3_wrap_1_s_ahb_clk */
  510. 0x181, /* gcc_qupv3_wrap_2_m_ahb_clk */
  511. 0x182, /* gcc_qupv3_wrap_2_s_ahb_clk */
  512. 0x7F, /* gcc_sdcc2_ahb_clk */
  513. 0x7E, /* gcc_sdcc2_apps_clk */
  514. 0x81, /* gcc_sdcc4_ahb_clk */
  515. 0x80, /* gcc_sdcc4_apps_clk */
  516. 0xC, /* gcc_sys_noc_cpuss_ahb_clk */
  517. 0x9C, /* gcc_tsif_ahb_clk */
  518. 0x9E, /* gcc_tsif_inactivity_timers_clk */
  519. 0x9D, /* gcc_tsif_ref_clk */
  520. 0x107, /* gcc_ufs_card_ahb_clk */
  521. 0x106, /* gcc_ufs_card_axi_clk */
  522. 0x10D, /* gcc_ufs_card_ice_core_clk */
  523. 0x10E, /* gcc_ufs_card_phy_aux_clk */
  524. 0x109, /* gcc_ufs_card_rx_symbol_0_clk */
  525. 0x10F, /* gcc_ufs_card_rx_symbol_1_clk */
  526. 0x108, /* gcc_ufs_card_tx_symbol_0_clk */
  527. 0x10C, /* gcc_ufs_card_unipro_core_clk */
  528. 0x113, /* gcc_ufs_phy_ahb_clk */
  529. 0x112, /* gcc_ufs_phy_axi_clk */
  530. 0x119, /* gcc_ufs_phy_ice_core_clk */
  531. 0x11A, /* gcc_ufs_phy_phy_aux_clk */
  532. 0x115, /* gcc_ufs_phy_rx_symbol_0_clk */
  533. 0x11B, /* gcc_ufs_phy_rx_symbol_1_clk */
  534. 0x114, /* gcc_ufs_phy_tx_symbol_0_clk */
  535. 0x118, /* gcc_ufs_phy_unipro_core_clk */
  536. 0x6B, /* gcc_usb30_prim_master_clk */
  537. 0x6D, /* gcc_usb30_prim_mock_utmi_clk */
  538. 0x6C, /* gcc_usb30_prim_sleep_clk */
  539. 0x72, /* gcc_usb30_sec_master_clk */
  540. 0x74, /* gcc_usb30_sec_mock_utmi_clk */
  541. 0x73, /* gcc_usb30_sec_sleep_clk */
  542. 0x6E, /* gcc_usb3_prim_phy_aux_clk */
  543. 0x6F, /* gcc_usb3_prim_phy_com_aux_clk */
  544. 0x70, /* gcc_usb3_prim_phy_pipe_clk */
  545. 0x75, /* gcc_usb3_sec_phy_aux_clk */
  546. 0x76, /* gcc_usb3_sec_phy_com_aux_clk */
  547. 0x77, /* gcc_usb3_sec_phy_pipe_clk */
  548. 0x4A, /* gcc_video_axi0_clk */
  549. 0x4B, /* gcc_video_axi1_clk */
  550. 0x4C, /* gcc_video_axic_clk */
  551. 0x162, /* gpu_cc_debug_mux */
  552. 0xDB, /* measure_only_cdsp_clk */
  553. 0x19, /* measure_only_cnoc_clk */
  554. 0x43, /* measure_only_gcc_camera_ahb_clk */
  555. 0x52, /* measure_only_gcc_camera_xo_clk */
  556. 0xE5, /* measure_only_gcc_cpuss_dvm_bus_clk */
  557. 0xE1, /* measure_only_gcc_cpuss_gnoc_clk */
  558. 0x44, /* measure_only_gcc_disp_ahb_clk */
  559. 0x53, /* measure_only_gcc_disp_xo_clk */
  560. 0x160, /* measure_only_gcc_gpu_cfg_ahb_clk */
  561. 0x17A, /* measure_only_gcc_npu_cfg_ahb_clk */
  562. 0x42, /* measure_only_gcc_video_ahb_clk */
  563. 0x51, /* measure_only_gcc_video_xo_clk */
  564. 0x147, /* measure_only_ipa_2x_clk */
  565. 0x7, /* measure_only_snoc_clk */
  566. 0x180, /* npu_cc_debug_mux */
  567. 0x57, /* video_cc_debug_mux */
  568. 0xD0, /* mc_cc_debug_mux */
  569. };
  570. static struct clk_debug_mux gcc_debug_mux = {
  571. .priv = &debug_mux_priv,
  572. .debug_offset = 0x62000,
  573. .post_div_offset = 0x62004,
  574. .cbcr_offset = 0x62008,
  575. .src_sel_mask = 0x3FF,
  576. .src_sel_shift = 0,
  577. .post_div_mask = 0xF,
  578. .post_div_shift = 0,
  579. .post_div_val = 2,
  580. .mux_sels = gcc_debug_mux_sels,
  581. .num_mux_sels = ARRAY_SIZE(gcc_debug_mux_sels),
  582. .hw.init = &(struct clk_init_data){
  583. .name = "gcc_debug_mux",
  584. .ops = &clk_debug_mux_ops,
  585. .parent_names = gcc_debug_mux_parent_names,
  586. .num_parents = ARRAY_SIZE(gcc_debug_mux_parent_names),
  587. },
  588. };
  589. static const char *const gpu_cc_debug_mux_parent_names[] = {
  590. "gpu_cc_crc_ahb_clk",
  591. "gpu_cc_cx_gmu_clk",
  592. "gpu_cc_cx_snoc_dvm_clk",
  593. "gpu_cc_cxo_aon_clk",
  594. "gpu_cc_cxo_clk",
  595. "gpu_cc_gx_gmu_clk",
  596. "gpu_cc_sleep_clk",
  597. "measure_only_gpu_cc_ahb_clk",
  598. "measure_only_gpu_cc_cx_gfx3d_clk",
  599. "measure_only_gpu_cc_cx_gfx3d_slv_clk",
  600. "measure_only_gpu_cc_gx_gfx3d_clk",
  601. };
  602. static int gpu_cc_debug_mux_sels[] = {
  603. 0x11, /* gpu_cc_crc_ahb_clk */
  604. 0x18, /* gpu_cc_cx_gmu_clk */
  605. 0x15, /* gpu_cc_cx_snoc_dvm_clk */
  606. 0xA, /* gpu_cc_cxo_aon_clk */
  607. 0x19, /* gpu_cc_cxo_clk */
  608. 0xF, /* gpu_cc_gx_gmu_clk */
  609. 0x16, /* gpu_cc_sleep_clk */
  610. 0x10, /* measure_only_gpu_cc_ahb_clk */
  611. 0x1A, /* measure_only_gpu_cc_cx_gfx3d_clk */
  612. 0x1B, /* measure_only_gpu_cc_cx_gfx3d_slv_clk */
  613. 0xB, /* measure_only_gpu_cc_gx_gfx3d_clk */
  614. };
  615. static struct clk_debug_mux gpu_cc_debug_mux = {
  616. .priv = &debug_mux_priv,
  617. .debug_offset = 0x1568,
  618. .post_div_offset = 0x10FC,
  619. .cbcr_offset = 0x1100,
  620. .src_sel_mask = 0xFF,
  621. .src_sel_shift = 0,
  622. .post_div_mask = 0x3,
  623. .post_div_shift = 0,
  624. .post_div_val = 2,
  625. .mux_sels = gpu_cc_debug_mux_sels,
  626. .num_mux_sels = ARRAY_SIZE(gpu_cc_debug_mux_sels),
  627. .hw.init = &(struct clk_init_data){
  628. .name = "gpu_cc_debug_mux",
  629. .ops = &clk_debug_mux_ops,
  630. .parent_names = gpu_cc_debug_mux_parent_names,
  631. .num_parents = ARRAY_SIZE(gpu_cc_debug_mux_parent_names),
  632. },
  633. };
  634. static const char *const npu_cc_debug_mux_parent_names[] = {
  635. "measure_only_npu_cc_xo_clk",
  636. "npu_cc_armwic_core_clk",
  637. "npu_cc_bto_core_clk",
  638. "npu_cc_bwmon_clk",
  639. "npu_cc_cal_dp_cdc_clk",
  640. "npu_cc_cal_dp_clk",
  641. "npu_cc_comp_noc_axi_clk",
  642. "npu_cc_conf_noc_ahb_clk",
  643. "npu_cc_npu_core_apb_clk",
  644. "npu_cc_npu_core_atb_clk",
  645. "npu_cc_npu_core_clk",
  646. "npu_cc_npu_core_cti_clk",
  647. "npu_cc_npu_cpc_clk",
  648. "npu_cc_npu_cpc_timer_clk",
  649. "npu_cc_perf_cnt_clk",
  650. "npu_cc_qtimer_core_clk",
  651. "npu_cc_sleep_clk",
  652. };
  653. static int npu_cc_debug_mux_sels[] = {
  654. 0x11, /* measure_only_npu_cc_xo_clk */
  655. 0x4, /* npu_cc_armwic_core_clk */
  656. 0x12, /* npu_cc_bto_core_clk */
  657. 0xF, /* npu_cc_bwmon_clk */
  658. 0x8, /* npu_cc_cal_dp_cdc_clk */
  659. 0x1, /* npu_cc_cal_dp_clk */
  660. 0x9, /* npu_cc_comp_noc_axi_clk */
  661. 0xA, /* npu_cc_conf_noc_ahb_clk */
  662. 0xE, /* npu_cc_npu_core_apb_clk */
  663. 0xB, /* npu_cc_npu_core_atb_clk */
  664. 0x2, /* npu_cc_npu_core_clk */
  665. 0xC, /* npu_cc_npu_core_cti_clk */
  666. 0x3, /* npu_cc_npu_cpc_clk */
  667. 0x5, /* npu_cc_npu_cpc_timer_clk */
  668. 0x10, /* npu_cc_perf_cnt_clk */
  669. 0x6, /* npu_cc_qtimer_core_clk */
  670. 0x7, /* npu_cc_sleep_clk */
  671. };
  672. static struct clk_debug_mux npu_cc_debug_mux = {
  673. .priv = &debug_mux_priv,
  674. .debug_offset = 0x4000,
  675. .post_div_offset = 0x3004,
  676. .cbcr_offset = 0x3008,
  677. .src_sel_mask = 0xFF,
  678. .src_sel_shift = 0,
  679. .post_div_mask = 0x3,
  680. .post_div_shift = 0,
  681. .post_div_val = 2,
  682. .mux_sels = npu_cc_debug_mux_sels,
  683. .num_mux_sels = ARRAY_SIZE(npu_cc_debug_mux_sels),
  684. .hw.init = &(struct clk_init_data){
  685. .name = "npu_cc_debug_mux",
  686. .ops = &clk_debug_mux_ops,
  687. .parent_names = npu_cc_debug_mux_parent_names,
  688. .num_parents = ARRAY_SIZE(npu_cc_debug_mux_parent_names),
  689. },
  690. };
  691. static const char *const video_cc_debug_mux_parent_names[] = {
  692. "measure_only_video_cc_xo_clk",
  693. "video_cc_iris_ahb_clk",
  694. "video_cc_mvs0_core_clk",
  695. "video_cc_mvs1_core_clk",
  696. "video_cc_mvsc_core_clk",
  697. };
  698. static int video_cc_debug_mux_sels[] = {
  699. 0x8, /* measure_only_video_cc_xo_clk */
  700. 0x7, /* video_cc_iris_ahb_clk */
  701. 0x3, /* video_cc_mvs0_core_clk */
  702. 0x5, /* video_cc_mvs1_core_clk */
  703. 0x1, /* video_cc_mvsc_core_clk */
  704. };
  705. static struct clk_debug_mux video_cc_debug_mux = {
  706. .priv = &debug_mux_priv,
  707. .debug_offset = 0xA4C,
  708. .post_div_offset = 0x938,
  709. .cbcr_offset = 0x940,
  710. .src_sel_mask = 0x3F,
  711. .src_sel_shift = 0,
  712. .post_div_mask = 0x7,
  713. .post_div_shift = 0,
  714. .post_div_val = 5,
  715. .mux_sels = video_cc_debug_mux_sels,
  716. .num_mux_sels = ARRAY_SIZE(video_cc_debug_mux_sels),
  717. .hw.init = &(struct clk_init_data){
  718. .name = "video_cc_debug_mux",
  719. .ops = &clk_debug_mux_ops,
  720. .parent_names = video_cc_debug_mux_parent_names,
  721. .num_parents = ARRAY_SIZE(video_cc_debug_mux_parent_names),
  722. },
  723. };
  724. static const char *const mc_cc_debug_mux_parent_names[] = {
  725. "measure_only_mccc_clk",
  726. };
  727. static struct clk_debug_mux mc_cc_debug_mux = {
  728. .period_offset = 0x50,
  729. .hw.init = &(struct clk_init_data){
  730. .name = "mc_cc_debug_mux",
  731. .ops = &clk_debug_mux_ops,
  732. .parent_names = mc_cc_debug_mux_parent_names,
  733. .num_parents = ARRAY_SIZE(mc_cc_debug_mux_parent_names),
  734. },
  735. };
  736. static struct mux_regmap_names mux_list[] = {
  737. { .mux = &cpu_cc_debug_mux, .regmap_name = "qcom,cpucc" },
  738. { .mux = &cam_cc_debug_mux, .regmap_name = "qcom,camcc" },
  739. { .mux = &disp_cc_debug_mux, .regmap_name = "qcom,dispcc" },
  740. { .mux = &gpu_cc_debug_mux, .regmap_name = "qcom,gpucc" },
  741. { .mux = &mc_cc_debug_mux, .regmap_name = "qcom,mccc" },
  742. { .mux = &npu_cc_debug_mux, .regmap_name = "qcom,npucc" },
  743. { .mux = &video_cc_debug_mux, .regmap_name = "qcom,videocc" },
  744. { .mux = &gcc_debug_mux, .regmap_name = "qcom,gcc" },
  745. };
  746. static struct clk_dummy l3_clk = {
  747. .rrate = 1000,
  748. .hw.init = &(struct clk_init_data){
  749. .name = "l3_clk",
  750. .ops = &clk_dummy_ops,
  751. },
  752. };
  753. static struct clk_dummy measure_only_cam_cc_gdsc_clk = {
  754. .rrate = 1000,
  755. .hw.init = &(struct clk_init_data){
  756. .name = "measure_only_cam_cc_gdsc_clk",
  757. .ops = &clk_dummy_ops,
  758. },
  759. };
  760. static struct clk_dummy measure_only_cdsp_clk = {
  761. .rrate = 1000,
  762. .hw.init = &(struct clk_init_data){
  763. .name = "measure_only_cdsp_clk",
  764. .ops = &clk_dummy_ops,
  765. },
  766. };
  767. static struct clk_dummy measure_only_cnoc_clk = {
  768. .rrate = 1000,
  769. .hw.init = &(struct clk_init_data){
  770. .name = "measure_only_cnoc_clk",
  771. .ops = &clk_dummy_ops,
  772. },
  773. };
  774. static struct clk_dummy measure_only_disp_cc_xo_clk = {
  775. .rrate = 1000,
  776. .hw.init = &(struct clk_init_data){
  777. .name = "measure_only_disp_cc_xo_clk",
  778. .ops = &clk_dummy_ops,
  779. },
  780. };
  781. static struct clk_dummy measure_only_gcc_camera_ahb_clk = {
  782. .rrate = 1000,
  783. .hw.init = &(struct clk_init_data){
  784. .name = "measure_only_gcc_camera_ahb_clk",
  785. .ops = &clk_dummy_ops,
  786. },
  787. };
  788. static struct clk_dummy measure_only_gcc_camera_xo_clk = {
  789. .rrate = 1000,
  790. .hw.init = &(struct clk_init_data){
  791. .name = "measure_only_gcc_camera_xo_clk",
  792. .ops = &clk_dummy_ops,
  793. },
  794. };
  795. static struct clk_dummy measure_only_gcc_cpuss_dvm_bus_clk = {
  796. .rrate = 1000,
  797. .hw.init = &(struct clk_init_data){
  798. .name = "measure_only_gcc_cpuss_dvm_bus_clk",
  799. .ops = &clk_dummy_ops,
  800. },
  801. };
  802. static struct clk_dummy measure_only_gcc_cpuss_gnoc_clk = {
  803. .rrate = 1000,
  804. .hw.init = &(struct clk_init_data){
  805. .name = "measure_only_gcc_cpuss_gnoc_clk",
  806. .ops = &clk_dummy_ops,
  807. },
  808. };
  809. static struct clk_dummy measure_only_gcc_disp_ahb_clk = {
  810. .rrate = 1000,
  811. .hw.init = &(struct clk_init_data){
  812. .name = "measure_only_gcc_disp_ahb_clk",
  813. .ops = &clk_dummy_ops,
  814. },
  815. };
  816. static struct clk_dummy measure_only_gcc_disp_xo_clk = {
  817. .rrate = 1000,
  818. .hw.init = &(struct clk_init_data){
  819. .name = "measure_only_gcc_disp_xo_clk",
  820. .ops = &clk_dummy_ops,
  821. },
  822. };
  823. static struct clk_dummy measure_only_gcc_gpu_cfg_ahb_clk = {
  824. .rrate = 1000,
  825. .hw.init = &(struct clk_init_data){
  826. .name = "measure_only_gcc_gpu_cfg_ahb_clk",
  827. .ops = &clk_dummy_ops,
  828. },
  829. };
  830. static struct clk_dummy measure_only_gcc_npu_cfg_ahb_clk = {
  831. .rrate = 1000,
  832. .hw.init = &(struct clk_init_data){
  833. .name = "measure_only_gcc_npu_cfg_ahb_clk",
  834. .ops = &clk_dummy_ops,
  835. },
  836. };
  837. static struct clk_dummy measure_only_gcc_video_ahb_clk = {
  838. .rrate = 1000,
  839. .hw.init = &(struct clk_init_data){
  840. .name = "measure_only_gcc_video_ahb_clk",
  841. .ops = &clk_dummy_ops,
  842. },
  843. };
  844. static struct clk_dummy measure_only_gcc_video_xo_clk = {
  845. .rrate = 1000,
  846. .hw.init = &(struct clk_init_data){
  847. .name = "measure_only_gcc_video_xo_clk",
  848. .ops = &clk_dummy_ops,
  849. },
  850. };
  851. static struct clk_dummy measure_only_gpu_cc_ahb_clk = {
  852. .rrate = 1000,
  853. .hw.init = &(struct clk_init_data){
  854. .name = "measure_only_gpu_cc_ahb_clk",
  855. .ops = &clk_dummy_ops,
  856. },
  857. };
  858. static struct clk_dummy measure_only_gpu_cc_cx_gfx3d_clk = {
  859. .rrate = 1000,
  860. .hw.init = &(struct clk_init_data){
  861. .name = "measure_only_gpu_cc_cx_gfx3d_clk",
  862. .ops = &clk_dummy_ops,
  863. },
  864. };
  865. static struct clk_dummy measure_only_gpu_cc_cx_gfx3d_slv_clk = {
  866. .rrate = 1000,
  867. .hw.init = &(struct clk_init_data){
  868. .name = "measure_only_gpu_cc_cx_gfx3d_slv_clk",
  869. .ops = &clk_dummy_ops,
  870. },
  871. };
  872. static struct clk_dummy measure_only_gpu_cc_gx_gfx3d_clk = {
  873. .rrate = 1000,
  874. .hw.init = &(struct clk_init_data){
  875. .name = "measure_only_gpu_cc_gx_gfx3d_clk",
  876. .ops = &clk_dummy_ops,
  877. },
  878. };
  879. static struct clk_dummy measure_only_ipa_2x_clk = {
  880. .rrate = 1000,
  881. .hw.init = &(struct clk_init_data){
  882. .name = "measure_only_ipa_2x_clk",
  883. .ops = &clk_dummy_ops,
  884. },
  885. };
  886. static struct clk_dummy measure_only_mccc_clk = {
  887. .rrate = 1000,
  888. .hw.init = &(struct clk_init_data){
  889. .name = "measure_only_mccc_clk",
  890. .ops = &clk_dummy_ops,
  891. },
  892. };
  893. static struct clk_dummy measure_only_npu_cc_xo_clk = {
  894. .rrate = 1000,
  895. .hw.init = &(struct clk_init_data){
  896. .name = "measure_only_npu_cc_xo_clk",
  897. .ops = &clk_dummy_ops,
  898. },
  899. };
  900. static struct clk_dummy measure_only_snoc_clk = {
  901. .rrate = 1000,
  902. .hw.init = &(struct clk_init_data){
  903. .name = "measure_only_snoc_clk",
  904. .ops = &clk_dummy_ops,
  905. },
  906. };
  907. static struct clk_dummy perfcl_clk = {
  908. .rrate = 1000,
  909. .hw.init = &(struct clk_init_data){
  910. .name = "perfcl_clk",
  911. .ops = &clk_dummy_ops,
  912. },
  913. };
  914. static struct clk_dummy perfpcl_clk = {
  915. .rrate = 1000,
  916. .hw.init = &(struct clk_init_data){
  917. .name = "perfpcl_clk",
  918. .ops = &clk_dummy_ops,
  919. },
  920. };
  921. static struct clk_dummy pwrcl_clk = {
  922. .rrate = 1000,
  923. .hw.init = &(struct clk_init_data){
  924. .name = "pwrcl_clk",
  925. .ops = &clk_dummy_ops,
  926. },
  927. };
  928. static struct clk_dummy measure_only_video_cc_xo_clk = {
  929. .rrate = 1000,
  930. .hw.init = &(struct clk_init_data){
  931. .name = "measure_only_video_cc_xo_clk",
  932. .ops = &clk_dummy_ops,
  933. },
  934. };
  935. static struct clk_hw *debugcc_sm8150_hws[] = {
  936. &l3_clk.hw,
  937. &measure_only_cam_cc_gdsc_clk.hw,
  938. &measure_only_cdsp_clk.hw,
  939. &measure_only_cnoc_clk.hw,
  940. &measure_only_disp_cc_xo_clk.hw,
  941. &measure_only_gcc_camera_ahb_clk.hw,
  942. &measure_only_gcc_camera_xo_clk.hw,
  943. &measure_only_gcc_cpuss_dvm_bus_clk.hw,
  944. &measure_only_gcc_cpuss_gnoc_clk.hw,
  945. &measure_only_gcc_disp_ahb_clk.hw,
  946. &measure_only_gcc_disp_xo_clk.hw,
  947. &measure_only_gcc_gpu_cfg_ahb_clk.hw,
  948. &measure_only_gcc_npu_cfg_ahb_clk.hw,
  949. &measure_only_gcc_video_ahb_clk.hw,
  950. &measure_only_gcc_video_xo_clk.hw,
  951. &measure_only_gpu_cc_ahb_clk.hw,
  952. &measure_only_gpu_cc_cx_gfx3d_clk.hw,
  953. &measure_only_gpu_cc_cx_gfx3d_slv_clk.hw,
  954. &measure_only_gpu_cc_gx_gfx3d_clk.hw,
  955. &measure_only_ipa_2x_clk.hw,
  956. &measure_only_mccc_clk.hw,
  957. &measure_only_npu_cc_xo_clk.hw,
  958. &measure_only_snoc_clk.hw,
  959. &perfcl_clk.hw,
  960. &perfpcl_clk.hw,
  961. &pwrcl_clk.hw,
  962. &measure_only_video_cc_xo_clk.hw,
  963. };
  964. static const struct of_device_id clk_debug_match_table[] = {
  965. { .compatible = "qcom,sm8150-debugcc" },
  966. { }
  967. };
  968. static int clk_debug_sm8150_probe(struct platform_device *pdev)
  969. {
  970. struct clk *clk;
  971. int ret, i;
  972. BUILD_BUG_ON(ARRAY_SIZE(cpu_cc_debug_mux_parent_names) !=
  973. ARRAY_SIZE(cpu_cc_debug_mux_sels));
  974. BUILD_BUG_ON(ARRAY_SIZE(cam_cc_debug_mux_parent_names) !=
  975. ARRAY_SIZE(cam_cc_debug_mux_sels));
  976. BUILD_BUG_ON(ARRAY_SIZE(disp_cc_debug_mux_parent_names) !=
  977. ARRAY_SIZE(disp_cc_debug_mux_sels));
  978. BUILD_BUG_ON(ARRAY_SIZE(gcc_debug_mux_parent_names) !=
  979. ARRAY_SIZE(gcc_debug_mux_sels));
  980. BUILD_BUG_ON(ARRAY_SIZE(gpu_cc_debug_mux_parent_names) !=
  981. ARRAY_SIZE(gpu_cc_debug_mux_sels));
  982. BUILD_BUG_ON(ARRAY_SIZE(npu_cc_debug_mux_parent_names) !=
  983. ARRAY_SIZE(npu_cc_debug_mux_sels));
  984. BUILD_BUG_ON(ARRAY_SIZE(video_cc_debug_mux_parent_names) !=
  985. ARRAY_SIZE(video_cc_debug_mux_sels));
  986. clk = devm_clk_get(&pdev->dev, "xo_clk_src");
  987. if (IS_ERR(clk)) {
  988. if (PTR_ERR(clk) != -EPROBE_DEFER)
  989. dev_err(&pdev->dev, "Unable to get xo clock\n");
  990. return PTR_ERR(clk);
  991. }
  992. debug_mux_priv.cxo = clk;
  993. for (i = 0; i < ARRAY_SIZE(mux_list); i++) {
  994. if (IS_ERR_OR_NULL(mux_list[i].mux->regmap)) {
  995. ret = map_debug_bases(pdev,
  996. mux_list[i].regmap_name, mux_list[i].mux);
  997. if (ret == -EBADR)
  998. continue;
  999. else if (ret)
  1000. return ret;
  1001. }
  1002. }
  1003. for (i = 0; i < ARRAY_SIZE(debugcc_sm8150_hws); i++) {
  1004. clk = devm_clk_register(&pdev->dev, debugcc_sm8150_hws[i]);
  1005. if (IS_ERR(clk)) {
  1006. dev_err(&pdev->dev, "Unable to register %s, err:(%d)\n",
  1007. clk_hw_get_name(debugcc_sm8150_hws[i]),
  1008. PTR_ERR(clk));
  1009. return PTR_ERR(clk);
  1010. }
  1011. }
  1012. for (i = 0; i < ARRAY_SIZE(mux_list); i++) {
  1013. ret = devm_clk_register_debug_mux(&pdev->dev, mux_list[i].mux);
  1014. if (ret) {
  1015. dev_err(&pdev->dev, "Unable to register mux clk %s, err:(%d)\n",
  1016. clk_hw_get_name(&mux_list[i].mux->hw),
  1017. ret);
  1018. return ret;
  1019. }
  1020. }
  1021. ret = clk_debug_measure_register(&gcc_debug_mux.hw);
  1022. if (ret) {
  1023. dev_err(&pdev->dev, "Could not register Measure clocks\n");
  1024. return ret;
  1025. }
  1026. dev_info(&pdev->dev, "Registered debug measure clocks\n");
  1027. return ret;
  1028. }
  1029. static struct platform_driver clk_debug_driver = {
  1030. .probe = clk_debug_sm8150_probe,
  1031. .driver = {
  1032. .name = "sm8150-debugcc",
  1033. .of_match_table = clk_debug_match_table,
  1034. },
  1035. };
  1036. static int __init clk_debug_sm8150_init(void)
  1037. {
  1038. return platform_driver_register(&clk_debug_driver);
  1039. }
  1040. fs_initcall(clk_debug_sm8150_init);
  1041. MODULE_DESCRIPTION("QTI DEBUG CC SM8150 Driver");
  1042. MODULE_LICENSE("GPL");