debugcc-monaco_auto.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2023, 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 = 0x72038,
  20. .status_reg = 0x7203C,
  21. .xo_div4_cbcr = 0x6E008,
  22. };
  23. static const char *const apss_cc_debug_mux_parent_names[] = {
  24. "measure_only_apcs_cl1_l3_post_acd_clk",
  25. "measure_only_apcs_gold_post_acd_clk",
  26. "measure_only_apcs_goldplus_post_acd_clk",
  27. "measure_only_apcs_l3_post_acd_clk",
  28. "measure_only_apcs_cl1_silver_post_acd_clk",
  29. };
  30. static int apss_cc_debug_mux_sels[] = {
  31. 0x61, /* measure_only_apcs_cl1_l3_post_acd_clk */
  32. 0x801, /* measure_only_apcs_gold_post_acd_clk */
  33. 0x2001, /* measure_only_apcs_goldplus_post_acd_clk */
  34. 0x25, /* measure_only_apcs_l3_post_acd_clk */
  35. 0x805, /* measure_only_apcs_cl1_silver_post_acd_clk */
  36. };
  37. static int apss_cc_debug_mux_pre_divs[] = {
  38. 0x4, /* measure_only_apcs_cl1_l3_post_acd_clk */
  39. 0x8, /* measure_only_apcs_gold_post_acd_clk */
  40. 0x8, /* measure_only_apcs_goldplus_post_acd_clk */
  41. 0x4, /* measure_only_apcs_l3_post_acd_clk */
  42. 0x8, /* measure_only_apcs_cl1_silver_post_acd_clk */
  43. };
  44. static struct clk_debug_mux apss_cc_debug_mux = {
  45. .priv = &debug_mux_priv,
  46. .debug_offset = 0x18,
  47. .post_div_offset = 0x18,
  48. .cbcr_offset = 0x0,
  49. .src_sel_mask = 0x381f0,
  50. .src_sel_shift = 4,
  51. .post_div_mask = 0x7800,
  52. .post_div_shift = 11,
  53. .post_div_val = 1,
  54. .mux_sels = apss_cc_debug_mux_sels,
  55. .num_mux_sels = ARRAY_SIZE(apss_cc_debug_mux_sels),
  56. .pre_div_vals = apss_cc_debug_mux_pre_divs,
  57. .hw.init = &(const struct clk_init_data){
  58. .name = "apss_cc_debug_mux",
  59. .ops = &clk_debug_mux_ops,
  60. .parent_names = apss_cc_debug_mux_parent_names,
  61. .num_parents = ARRAY_SIZE(apss_cc_debug_mux_parent_names),
  62. },
  63. };
  64. static const char *const cam_cc_debug_mux_parent_names[] = {
  65. "cam_cc_camnoc_axi_clk",
  66. "cam_cc_camnoc_dcd_xo_clk",
  67. "cam_cc_camnoc_xo_clk",
  68. "cam_cc_cci_0_clk",
  69. "cam_cc_cci_1_clk",
  70. "cam_cc_cci_2_clk",
  71. "cam_cc_core_ahb_clk",
  72. "cam_cc_cpas_ahb_clk",
  73. "cam_cc_cpas_fast_ahb_clk",
  74. "cam_cc_cpas_ife_0_clk",
  75. "cam_cc_cpas_ife_1_clk",
  76. "cam_cc_cpas_ife_lite_clk",
  77. "cam_cc_cpas_ipe_clk",
  78. "cam_cc_cpas_sfe_lite_0_clk",
  79. "cam_cc_cpas_sfe_lite_1_clk",
  80. "cam_cc_csi0phytimer_clk",
  81. "cam_cc_csi1phytimer_clk",
  82. "cam_cc_csi2phytimer_clk",
  83. "cam_cc_csid_clk",
  84. "cam_cc_csid_csiphy_rx_clk",
  85. "cam_cc_csiphy0_clk",
  86. "cam_cc_csiphy1_clk",
  87. "cam_cc_csiphy2_clk",
  88. "cam_cc_icp_ahb_clk",
  89. "cam_cc_icp_clk",
  90. "cam_cc_ife_0_clk",
  91. "cam_cc_ife_0_fast_ahb_clk",
  92. "cam_cc_ife_1_clk",
  93. "cam_cc_ife_1_fast_ahb_clk",
  94. "cam_cc_ife_lite_ahb_clk",
  95. "cam_cc_ife_lite_clk",
  96. "cam_cc_ife_lite_cphy_rx_clk",
  97. "cam_cc_ife_lite_csid_clk",
  98. "cam_cc_ipe_ahb_clk",
  99. "cam_cc_ipe_clk",
  100. "cam_cc_ipe_fast_ahb_clk",
  101. "cam_cc_mclk0_clk",
  102. "cam_cc_mclk1_clk",
  103. "cam_cc_mclk2_clk",
  104. "cam_cc_sfe_lite_0_clk",
  105. "cam_cc_sfe_lite_0_fast_ahb_clk",
  106. "cam_cc_sfe_lite_1_clk",
  107. "cam_cc_sfe_lite_1_fast_ahb_clk",
  108. "cam_cc_sleep_clk",
  109. "cam_cc_titan_top_accu_shift_clk",
  110. "measure_only_cam_cc_gdsc_clk",
  111. };
  112. static int cam_cc_debug_mux_sels[] = {
  113. 0x35, /* cam_cc_camnoc_axi_clk */
  114. 0x36, /* cam_cc_camnoc_dcd_xo_clk */
  115. 0x37, /* cam_cc_camnoc_xo_clk */
  116. 0x30, /* cam_cc_cci_0_clk */
  117. 0x31, /* cam_cc_cci_1_clk */
  118. 0x5, /* cam_cc_cci_2_clk */
  119. 0x3A, /* cam_cc_core_ahb_clk */
  120. 0x32, /* cam_cc_cpas_ahb_clk */
  121. 0x33, /* cam_cc_cpas_fast_ahb_clk */
  122. 0x18, /* cam_cc_cpas_ife_0_clk */
  123. 0x1D, /* cam_cc_cpas_ife_1_clk */
  124. 0x22, /* cam_cc_cpas_ife_lite_clk */
  125. 0x13, /* cam_cc_cpas_ipe_clk */
  126. 0x27, /* cam_cc_cpas_sfe_lite_0_clk */
  127. 0x2B, /* cam_cc_cpas_sfe_lite_1_clk */
  128. 0x9, /* cam_cc_csi0phytimer_clk */
  129. 0xC, /* cam_cc_csi1phytimer_clk */
  130. 0xE, /* cam_cc_csi2phytimer_clk */
  131. 0x34, /* cam_cc_csid_clk */
  132. 0xB, /* cam_cc_csid_csiphy_rx_clk */
  133. 0xA, /* cam_cc_csiphy0_clk */
  134. 0xD, /* cam_cc_csiphy1_clk */
  135. 0xF, /* cam_cc_csiphy2_clk */
  136. 0x2F, /* cam_cc_icp_ahb_clk */
  137. 0x2E, /* cam_cc_icp_clk */
  138. 0x17, /* cam_cc_ife_0_clk */
  139. 0x1B, /* cam_cc_ife_0_fast_ahb_clk */
  140. 0x1C, /* cam_cc_ife_1_clk */
  141. 0x20, /* cam_cc_ife_1_fast_ahb_clk */
  142. 0x25, /* cam_cc_ife_lite_ahb_clk */
  143. 0x21, /* cam_cc_ife_lite_clk */
  144. 0x24, /* cam_cc_ife_lite_cphy_rx_clk */
  145. 0x23, /* cam_cc_ife_lite_csid_clk */
  146. 0x15, /* cam_cc_ipe_ahb_clk */
  147. 0x12, /* cam_cc_ipe_clk */
  148. 0x16, /* cam_cc_ipe_fast_ahb_clk */
  149. 0x1, /* cam_cc_mclk0_clk */
  150. 0x2, /* cam_cc_mclk1_clk */
  151. 0x3, /* cam_cc_mclk2_clk */
  152. 0x26, /* cam_cc_sfe_lite_0_clk */
  153. 0x29, /* cam_cc_sfe_lite_0_fast_ahb_clk */
  154. 0x2A, /* cam_cc_sfe_lite_1_clk */
  155. 0x2D, /* cam_cc_sfe_lite_1_fast_ahb_clk */
  156. 0x3C, /* cam_cc_sleep_clk */
  157. 0x4, /* cam_cc_titan_top_accu_shift_clk */
  158. 0x3B, /* measure_only_cam_cc_gdsc_clk */
  159. };
  160. static struct clk_debug_mux cam_cc_debug_mux = {
  161. .priv = &debug_mux_priv,
  162. .debug_offset = 0x150F8,
  163. .post_div_offset = 0x14004,
  164. .cbcr_offset = 0x14008,
  165. .src_sel_mask = 0xFF,
  166. .src_sel_shift = 0,
  167. .post_div_mask = 0xF,
  168. .post_div_shift = 0,
  169. .post_div_val = 4,
  170. .mux_sels = cam_cc_debug_mux_sels,
  171. .num_mux_sels = ARRAY_SIZE(cam_cc_debug_mux_sels),
  172. .hw.init = &(const struct clk_init_data){
  173. .name = "cam_cc_debug_mux",
  174. .ops = &clk_debug_mux_ops,
  175. .parent_names = cam_cc_debug_mux_parent_names,
  176. .num_parents = ARRAY_SIZE(cam_cc_debug_mux_parent_names),
  177. },
  178. };
  179. static const char *const disp_cc_debug_mux_parent_names[] = {
  180. "disp_cc_mdss_ahb1_clk",
  181. "disp_cc_mdss_ahb_clk",
  182. "disp_cc_mdss_byte0_clk",
  183. "disp_cc_mdss_byte0_intf_clk",
  184. "disp_cc_mdss_byte1_clk",
  185. "disp_cc_mdss_byte1_intf_clk",
  186. "disp_cc_mdss_dptx0_aux_clk",
  187. "disp_cc_mdss_dptx0_crypto_clk",
  188. "disp_cc_mdss_dptx0_link_clk",
  189. "disp_cc_mdss_dptx0_link_intf_clk",
  190. "disp_cc_mdss_dptx0_pixel0_clk",
  191. "disp_cc_mdss_dptx0_pixel1_clk",
  192. "disp_cc_mdss_dptx0_pixel2_clk",
  193. "disp_cc_mdss_dptx0_pixel3_clk",
  194. "disp_cc_mdss_dptx0_usb_router_link_intf_clk",
  195. "disp_cc_mdss_dptx1_aux_clk",
  196. "disp_cc_mdss_dptx1_crypto_clk",
  197. "disp_cc_mdss_dptx1_link_clk",
  198. "disp_cc_mdss_dptx1_link_intf_clk",
  199. "disp_cc_mdss_dptx1_pixel0_clk",
  200. "disp_cc_mdss_dptx1_pixel1_clk",
  201. "disp_cc_mdss_dptx1_usb_router_link_intf_clk",
  202. "disp_cc_mdss_esc0_clk",
  203. "disp_cc_mdss_esc1_clk",
  204. "disp_cc_mdss_mdp1_clk",
  205. "disp_cc_mdss_mdp_clk",
  206. "disp_cc_mdss_mdp_lut1_clk",
  207. "disp_cc_mdss_mdp_lut_clk",
  208. "disp_cc_mdss_non_gdsc_ahb_clk",
  209. "disp_cc_mdss_pclk0_clk",
  210. "disp_cc_mdss_pclk1_clk",
  211. "disp_cc_mdss_rscc_ahb_clk",
  212. "disp_cc_mdss_rscc_vsync_clk",
  213. "disp_cc_mdss_vsync1_clk",
  214. "disp_cc_mdss_vsync_clk",
  215. "disp_cc_sleep_clk",
  216. "measure_only_disp_cc_xo_clk",
  217. };
  218. static int disp_cc_debug_mux_sels[] = {
  219. 0x27, /* disp_cc_mdss_ahb1_clk */
  220. 0x26, /* disp_cc_mdss_ahb_clk */
  221. 0x12, /* disp_cc_mdss_byte0_clk */
  222. 0x13, /* disp_cc_mdss_byte0_intf_clk */
  223. 0x14, /* disp_cc_mdss_byte1_clk */
  224. 0x15, /* disp_cc_mdss_byte1_intf_clk */
  225. 0x1C, /* disp_cc_mdss_dptx0_aux_clk */
  226. 0x1B, /* disp_cc_mdss_dptx0_crypto_clk */
  227. 0x18, /* disp_cc_mdss_dptx0_link_clk */
  228. 0x19, /* disp_cc_mdss_dptx0_link_intf_clk */
  229. 0x1D, /* disp_cc_mdss_dptx0_pixel0_clk */
  230. 0x1E, /* disp_cc_mdss_dptx0_pixel1_clk */
  231. 0x28, /* disp_cc_mdss_dptx0_pixel2_clk */
  232. 0x29, /* disp_cc_mdss_dptx0_pixel3_clk */
  233. 0x1A, /* disp_cc_mdss_dptx0_usb_router_link_intf_clk */
  234. 0x25, /* disp_cc_mdss_dptx1_aux_clk */
  235. 0x24, /* disp_cc_mdss_dptx1_crypto_clk */
  236. 0x21, /* disp_cc_mdss_dptx1_link_clk */
  237. 0x22, /* disp_cc_mdss_dptx1_link_intf_clk */
  238. 0x1F, /* disp_cc_mdss_dptx1_pixel0_clk */
  239. 0x20, /* disp_cc_mdss_dptx1_pixel1_clk */
  240. 0x23, /* disp_cc_mdss_dptx1_usb_router_link_intf_clk */
  241. 0x16, /* disp_cc_mdss_esc0_clk */
  242. 0x17, /* disp_cc_mdss_esc1_clk */
  243. 0xD, /* disp_cc_mdss_mdp1_clk */
  244. 0xC, /* disp_cc_mdss_mdp_clk */
  245. 0xF, /* disp_cc_mdss_mdp_lut1_clk */
  246. 0xE, /* disp_cc_mdss_mdp_lut_clk */
  247. 0x2A, /* disp_cc_mdss_non_gdsc_ahb_clk */
  248. 0xA, /* disp_cc_mdss_pclk0_clk */
  249. 0xB, /* disp_cc_mdss_pclk1_clk */
  250. 0x2C, /* disp_cc_mdss_rscc_ahb_clk */
  251. 0x2B, /* disp_cc_mdss_rscc_vsync_clk */
  252. 0x11, /* disp_cc_mdss_vsync1_clk */
  253. 0x10, /* disp_cc_mdss_vsync_clk */
  254. 0x35, /* disp_cc_sleep_clk */
  255. 0x34, /* measure_only_disp_cc_xo_clk */
  256. };
  257. static struct clk_debug_mux disp_cc_debug_mux = {
  258. .priv = &debug_mux_priv,
  259. .debug_offset = 0x11000,
  260. .post_div_offset = 0xB000,
  261. .cbcr_offset = 0xB004,
  262. .src_sel_mask = 0xFF,
  263. .src_sel_shift = 0,
  264. .post_div_mask = 0xF,
  265. .post_div_shift = 0,
  266. .post_div_val = 4,
  267. .mux_sels = disp_cc_debug_mux_sels,
  268. .num_mux_sels = ARRAY_SIZE(disp_cc_debug_mux_sels),
  269. .hw.init = &(const struct clk_init_data){
  270. .name = "disp_cc_debug_mux",
  271. .ops = &clk_debug_mux_ops,
  272. .parent_names = disp_cc_debug_mux_parent_names,
  273. .num_parents = ARRAY_SIZE(disp_cc_debug_mux_parent_names),
  274. },
  275. };
  276. static const char *const gcc_debug_mux_parent_names[] = {
  277. "apss_cc_debug_mux",
  278. "cam_cc_debug_mux",
  279. "disp_cc_debug_mux",
  280. "gcc_aggre_noc_qupv3_axi_clk",
  281. "gcc_aggre_ufs_phy_axi_clk",
  282. "gcc_aggre_usb2_prim_axi_clk",
  283. "gcc_aggre_usb3_prim_axi_clk",
  284. "gcc_ahb2phy0_clk",
  285. "gcc_ahb2phy2_clk",
  286. "gcc_ahb2phy3_clk",
  287. "gcc_boot_rom_ahb_clk",
  288. "gcc_camera_hf_axi_clk",
  289. "gcc_camera_sf_axi_clk",
  290. "gcc_camera_throttle_xo_clk",
  291. "gcc_cfg_noc_usb2_prim_axi_clk",
  292. "gcc_cfg_noc_usb3_prim_axi_clk",
  293. "gcc_ddrss_gpu_axi_clk",
  294. "gcc_disp_hf_axi_clk",
  295. "gcc_emac0_axi_clk",
  296. "gcc_emac0_phy_aux_clk",
  297. "gcc_emac0_ptp_clk",
  298. "gcc_emac0_rgmii_clk",
  299. "gcc_emac0_slv_ahb_clk",
  300. "gcc_gp1_clk",
  301. "gcc_gp2_clk",
  302. "gcc_gp3_clk",
  303. "gcc_gp4_clk",
  304. "gcc_gp5_clk",
  305. "gcc_gpu_gpll0_clk_src",
  306. "gcc_gpu_gpll0_div_clk_src",
  307. "gcc_gpu_memnoc_gfx_center_pipeline_clk",
  308. "gcc_gpu_memnoc_gfx_clk",
  309. "gcc_gpu_snoc_dvm_gfx_clk",
  310. "gcc_gpu_tcu_throttle_ahb_clk",
  311. "gcc_gpu_tcu_throttle_clk",
  312. "gcc_pcie_0_aux_clk",
  313. "gcc_pcie_0_cfg_ahb_clk",
  314. "gcc_pcie_0_mstr_axi_clk",
  315. "gcc_pcie_0_phy_aux_clk",
  316. "gcc_pcie_0_phy_rchng_clk",
  317. "gcc_pcie_0_pipe_clk",
  318. "gcc_pcie_0_pipediv2_clk",
  319. "gcc_pcie_0_slv_axi_clk",
  320. "gcc_pcie_0_slv_q2a_axi_clk",
  321. "gcc_pcie_1_aux_clk",
  322. "gcc_pcie_1_cfg_ahb_clk",
  323. "gcc_pcie_1_mstr_axi_clk",
  324. "gcc_pcie_1_phy_aux_clk",
  325. "gcc_pcie_1_phy_rchng_clk",
  326. "gcc_pcie_1_pipe_clk",
  327. "gcc_pcie_1_pipediv2_clk",
  328. "gcc_pcie_1_slv_axi_clk",
  329. "gcc_pcie_1_slv_q2a_axi_clk",
  330. "gcc_pcie_throttle_cfg_clk",
  331. "gcc_pdm2_clk",
  332. "gcc_pdm_ahb_clk",
  333. "gcc_pdm_xo4_clk",
  334. "gcc_qmip_camera_nrt_ahb_clk",
  335. "gcc_qmip_camera_rt_ahb_clk",
  336. "gcc_qmip_disp_ahb_clk",
  337. "gcc_qmip_disp_rot_ahb_clk",
  338. "gcc_qmip_video_cvp_ahb_clk",
  339. "gcc_qmip_video_vcodec_ahb_clk",
  340. "gcc_qmip_video_vcpu_ahb_clk",
  341. "gcc_qupv3_wrap0_core_2x_clk",
  342. "gcc_qupv3_wrap0_core_clk",
  343. "gcc_qupv3_wrap0_s0_clk",
  344. "gcc_qupv3_wrap0_s1_clk",
  345. "gcc_qupv3_wrap0_s2_clk",
  346. "gcc_qupv3_wrap0_s3_clk",
  347. "gcc_qupv3_wrap0_s4_clk",
  348. "gcc_qupv3_wrap0_s5_clk",
  349. "gcc_qupv3_wrap0_s6_clk",
  350. "gcc_qupv3_wrap0_s7_clk",
  351. "gcc_qupv3_wrap1_core_2x_clk",
  352. "gcc_qupv3_wrap1_core_clk",
  353. "gcc_qupv3_wrap1_s0_clk",
  354. "gcc_qupv3_wrap1_s1_clk",
  355. "gcc_qupv3_wrap1_s2_clk",
  356. "gcc_qupv3_wrap1_s3_clk",
  357. "gcc_qupv3_wrap1_s4_clk",
  358. "gcc_qupv3_wrap1_s5_clk",
  359. "gcc_qupv3_wrap1_s6_clk",
  360. "gcc_qupv3_wrap1_s7_clk",
  361. "gcc_qupv3_wrap3_core_2x_clk",
  362. "gcc_qupv3_wrap3_core_clk",
  363. "gcc_qupv3_wrap3_qspi_clk",
  364. "gcc_qupv3_wrap3_s0_clk",
  365. "gcc_qupv3_wrap_0_m_ahb_clk",
  366. "gcc_qupv3_wrap_0_s_ahb_clk",
  367. "gcc_qupv3_wrap_1_m_ahb_clk",
  368. "gcc_qupv3_wrap_1_s_ahb_clk",
  369. "gcc_qupv3_wrap_3_m_ahb_clk",
  370. "gcc_qupv3_wrap_3_s_ahb_clk",
  371. "gcc_sdcc1_ahb_clk",
  372. "gcc_sdcc1_apps_clk",
  373. "gcc_sdcc1_ice_core_clk",
  374. "gcc_tscss_ahb_clk",
  375. "gcc_tscss_etu_clk",
  376. "gcc_tscss_global_cntr_clk",
  377. "gcc_ufs_phy_ahb_clk",
  378. "gcc_ufs_phy_axi_clk",
  379. "gcc_ufs_phy_ice_core_clk",
  380. "gcc_ufs_phy_phy_aux_clk",
  381. "gcc_ufs_phy_rx_symbol_0_clk",
  382. "gcc_ufs_phy_rx_symbol_1_clk",
  383. "gcc_ufs_phy_tx_symbol_0_clk",
  384. "gcc_ufs_phy_unipro_core_clk",
  385. "gcc_usb20_master_clk",
  386. "gcc_usb20_mock_utmi_clk",
  387. "gcc_usb20_sleep_clk",
  388. "gcc_usb30_prim_master_clk",
  389. "gcc_usb30_prim_mock_utmi_clk",
  390. "gcc_usb30_prim_sleep_clk",
  391. "gcc_usb3_prim_phy_aux_clk",
  392. "gcc_usb3_prim_phy_com_aux_clk",
  393. "gcc_usb3_prim_phy_pipe_clk",
  394. "gcc_video_axi0_clk",
  395. "gcc_video_axi1_clk",
  396. "gpu_cc_debug_mux",
  397. "measure_only_cnoc_clk",
  398. "measure_only_gcc_camera_ahb_clk",
  399. "measure_only_gcc_camera_xo_clk",
  400. "measure_only_gcc_disp_ahb_clk",
  401. "measure_only_gcc_disp_xo_clk",
  402. "measure_only_gcc_gpu_cfg_ahb_clk",
  403. "measure_only_gcc_video_ahb_clk",
  404. "measure_only_gcc_video_xo_clk",
  405. "measure_only_ipa_2x_clk",
  406. "measure_only_memnoc_clk",
  407. "measure_only_pcie_0_pipe_clk",
  408. "measure_only_pcie_1_pipe_clk",
  409. "measure_only_pcie_phy_aux_clk",
  410. "measure_only_snoc_clk",
  411. "measure_only_ufs_phy_rx_symbol_0_clk",
  412. "measure_only_ufs_phy_rx_symbol_1_clk",
  413. "measure_only_ufs_phy_tx_symbol_0_clk",
  414. "measure_only_usb3_phy_wrapper_gcc_usb30_prim_pipe_clk",
  415. "mc_cc_debug_mux",
  416. "video_cc_debug_mux",
  417. };
  418. static int gcc_debug_mux_sels[] = {
  419. 0x164, /* apss_cc_debug_mux */
  420. 0x99, /* cam_cc_debug_mux */
  421. 0xA1, /* disp_cc_debug_mux */
  422. 0x1FE, /* gcc_aggre_noc_qupv3_axi_clk */
  423. 0x1CC, /* gcc_aggre_ufs_phy_axi_clk */
  424. 0x1CA, /* gcc_aggre_usb2_prim_axi_clk */
  425. 0x1C9, /* gcc_aggre_usb3_prim_axi_clk */
  426. 0xE8, /* gcc_ahb2phy0_clk */
  427. 0xE9, /* gcc_ahb2phy2_clk */
  428. 0xEA, /* gcc_ahb2phy3_clk */
  429. 0x111, /* gcc_boot_rom_ahb_clk */
  430. 0x91, /* gcc_camera_hf_axi_clk */
  431. 0x93, /* gcc_camera_sf_axi_clk */
  432. 0x96, /* gcc_camera_throttle_xo_clk */
  433. 0x38, /* gcc_cfg_noc_usb2_prim_axi_clk */
  434. 0x37, /* gcc_cfg_noc_usb3_prim_axi_clk */
  435. 0x13A, /* gcc_ddrss_gpu_axi_clk */
  436. 0x9D, /* gcc_disp_hf_axi_clk */
  437. 0x1F2, /* gcc_emac0_axi_clk */
  438. 0x1F4, /* gcc_emac0_phy_aux_clk */
  439. 0x1F5, /* gcc_emac0_ptp_clk */
  440. 0x1F6, /* gcc_emac0_rgmii_clk */
  441. 0x1F3, /* gcc_emac0_slv_ahb_clk */
  442. 0x175, /* gcc_gp1_clk */
  443. 0x176, /* gcc_gp2_clk */
  444. 0x177, /* gcc_gp3_clk */
  445. 0x20E, /* gcc_gp4_clk */
  446. 0x20F, /* gcc_gp5_clk */
  447. 0x1E8, /* gcc_gpu_gpll0_clk_src */
  448. 0x1E9, /* gcc_gpu_gpll0_div_clk_src */
  449. 0x1EA, /* gcc_gpu_memnoc_gfx_center_pipeline_clk */
  450. 0x1E4, /* gcc_gpu_memnoc_gfx_clk */
  451. 0x1E7, /* gcc_gpu_snoc_dvm_gfx_clk */
  452. 0x1E1, /* gcc_gpu_tcu_throttle_ahb_clk */
  453. 0x1E5, /* gcc_gpu_tcu_throttle_clk */
  454. 0x18A, /* gcc_pcie_0_aux_clk */
  455. 0x188, /* gcc_pcie_0_cfg_ahb_clk */
  456. 0x187, /* gcc_pcie_0_mstr_axi_clk */
  457. 0x189, /* gcc_pcie_0_phy_aux_clk */
  458. 0x18D, /* gcc_pcie_0_phy_rchng_clk */
  459. 0x18B, /* gcc_pcie_0_pipe_clk */
  460. 0x18C, /* gcc_pcie_0_pipediv2_clk */
  461. 0x186, /* gcc_pcie_0_slv_axi_clk */
  462. 0x185, /* gcc_pcie_0_slv_q2a_axi_clk */
  463. 0x17D, /* gcc_pcie_1_aux_clk */
  464. 0x17B, /* gcc_pcie_1_cfg_ahb_clk */
  465. 0x17A, /* gcc_pcie_1_mstr_axi_clk */
  466. 0x17C, /* gcc_pcie_1_phy_aux_clk */
  467. 0x180, /* gcc_pcie_1_phy_rchng_clk */
  468. 0x17E, /* gcc_pcie_1_pipe_clk */
  469. 0x17F, /* gcc_pcie_1_pipediv2_clk */
  470. 0x179, /* gcc_pcie_1_slv_axi_clk */
  471. 0x178, /* gcc_pcie_1_slv_q2a_axi_clk */
  472. 0x6E, /* gcc_pcie_throttle_cfg_clk */
  473. 0x109, /* gcc_pdm2_clk */
  474. 0x107, /* gcc_pdm_ahb_clk */
  475. 0x108, /* gcc_pdm_xo4_clk */
  476. 0x8F, /* gcc_qmip_camera_nrt_ahb_clk */
  477. 0x90, /* gcc_qmip_camera_rt_ahb_clk */
  478. 0x9B, /* gcc_qmip_disp_ahb_clk */
  479. 0x9C, /* gcc_qmip_disp_rot_ahb_clk */
  480. 0xA3, /* gcc_qmip_video_cvp_ahb_clk */
  481. 0xA4, /* gcc_qmip_video_vcodec_ahb_clk */
  482. 0xA5, /* gcc_qmip_video_vcpu_ahb_clk */
  483. 0xF2, /* gcc_qupv3_wrap0_core_2x_clk */
  484. 0xF1, /* gcc_qupv3_wrap0_core_clk */
  485. 0xF3, /* gcc_qupv3_wrap0_s0_clk */
  486. 0xF4, /* gcc_qupv3_wrap0_s1_clk */
  487. 0xF5, /* gcc_qupv3_wrap0_s2_clk */
  488. 0xF6, /* gcc_qupv3_wrap0_s3_clk */
  489. 0xF7, /* gcc_qupv3_wrap0_s4_clk */
  490. 0xF8, /* gcc_qupv3_wrap0_s5_clk */
  491. 0xF9, /* gcc_qupv3_wrap0_s6_clk */
  492. 0xFA, /* gcc_qupv3_wrap0_s7_clk */
  493. 0xFE, /* gcc_qupv3_wrap1_core_2x_clk */
  494. 0xFD, /* gcc_qupv3_wrap1_core_clk */
  495. 0xFF, /* gcc_qupv3_wrap1_s0_clk */
  496. 0x100, /* gcc_qupv3_wrap1_s1_clk */
  497. 0x101, /* gcc_qupv3_wrap1_s2_clk */
  498. 0x102, /* gcc_qupv3_wrap1_s3_clk */
  499. 0x103, /* gcc_qupv3_wrap1_s4_clk */
  500. 0x104, /* gcc_qupv3_wrap1_s5_clk */
  501. 0x105, /* gcc_qupv3_wrap1_s6_clk */
  502. 0x106, /* gcc_qupv3_wrap1_s7_clk */
  503. 0x1FF, /* gcc_qupv3_wrap3_core_2x_clk */
  504. 0x1FD, /* gcc_qupv3_wrap3_core_clk */
  505. 0x201, /* gcc_qupv3_wrap3_qspi_clk */
  506. 0x200, /* gcc_qupv3_wrap3_s0_clk */
  507. 0xEF, /* gcc_qupv3_wrap_0_m_ahb_clk */
  508. 0xF0, /* gcc_qupv3_wrap_0_s_ahb_clk */
  509. 0xFB, /* gcc_qupv3_wrap_1_m_ahb_clk */
  510. 0xFC, /* gcc_qupv3_wrap_1_s_ahb_clk */
  511. 0x1FB, /* gcc_qupv3_wrap_3_m_ahb_clk */
  512. 0x1FC, /* gcc_qupv3_wrap_3_s_ahb_clk */
  513. 0xEC, /* gcc_sdcc1_ahb_clk */
  514. 0xEB, /* gcc_sdcc1_apps_clk */
  515. 0xEE, /* gcc_sdcc1_ice_core_clk */
  516. 0x1DE, /* gcc_tscss_ahb_clk */
  517. 0x1DD, /* gcc_tscss_etu_clk */
  518. 0x1DC, /* gcc_tscss_global_cntr_clk */
  519. 0x191, /* gcc_ufs_phy_ahb_clk */
  520. 0x190, /* gcc_ufs_phy_axi_clk */
  521. 0x197, /* gcc_ufs_phy_ice_core_clk */
  522. 0x198, /* gcc_ufs_phy_phy_aux_clk */
  523. 0x193, /* gcc_ufs_phy_rx_symbol_0_clk */
  524. 0x199, /* gcc_ufs_phy_rx_symbol_1_clk */
  525. 0x192, /* gcc_ufs_phy_tx_symbol_0_clk */
  526. 0x196, /* gcc_ufs_phy_unipro_core_clk */
  527. 0xE1, /* gcc_usb20_master_clk */
  528. 0xE3, /* gcc_usb20_mock_utmi_clk */
  529. 0xE2, /* gcc_usb20_sleep_clk */
  530. 0xD8, /* gcc_usb30_prim_master_clk */
  531. 0xDA, /* gcc_usb30_prim_mock_utmi_clk */
  532. 0xD9, /* gcc_usb30_prim_sleep_clk */
  533. 0xDB, /* gcc_usb3_prim_phy_aux_clk */
  534. 0xDC, /* gcc_usb3_prim_phy_com_aux_clk */
  535. 0xDD, /* gcc_usb3_prim_phy_pipe_clk */
  536. 0xA6, /* gcc_video_axi0_clk */
  537. 0xA7, /* gcc_video_axi1_clk */
  538. 0x1E3, /* gpu_cc_debug_mux */
  539. 0x2E, /* measure_only_cnoc_clk */
  540. 0x8E, /* measure_only_gcc_camera_ahb_clk */
  541. 0x95, /* measure_only_gcc_camera_xo_clk */
  542. 0x9A, /* measure_only_gcc_disp_ahb_clk */
  543. 0x9E, /* measure_only_gcc_disp_xo_clk */
  544. 0x1E0, /* measure_only_gcc_gpu_cfg_ahb_clk */
  545. 0xA2, /* measure_only_gcc_video_ahb_clk */
  546. 0xA8, /* measure_only_gcc_video_xo_clk */
  547. 0x1D8, /* measure_only_ipa_2x_clk */
  548. 0x141, /* measure_only_memnoc_clk */
  549. 0x18E, /* measure_only_pcie_0_pipe_clk */
  550. 0x181, /* measure_only_pcie_1_pipe_clk */
  551. 0x15, /* measure_only_pcie_phy_aux_clk */
  552. 0x19, /* measure_only_snoc_clk */
  553. 0x195, /* measure_only_ufs_phy_rx_symbol_0_clk */
  554. 0x19A, /* measure_only_ufs_phy_rx_symbol_1_clk */
  555. 0x194, /* measure_only_ufs_phy_tx_symbol_0_clk */
  556. 0xE4, /* measure_only_usb3_phy_wrapper_gcc_usb30_prim_pipe_clk */
  557. 0x145, /* mc_cc_debug_mux */
  558. 0xAB, /* video_cc_debug_mux */
  559. };
  560. static struct clk_debug_mux gcc_debug_mux = {
  561. .priv = &debug_mux_priv,
  562. .debug_offset = 0x72024,
  563. .post_div_offset = 0x6E000,
  564. .cbcr_offset = 0x6E004,
  565. .src_sel_mask = 0x1FFF,
  566. .src_sel_shift = 0,
  567. .post_div_mask = 0xF,
  568. .post_div_shift = 0,
  569. .post_div_val = 2,
  570. .mux_sels = gcc_debug_mux_sels,
  571. .num_mux_sels = ARRAY_SIZE(gcc_debug_mux_sels),
  572. .hw.init = &(const struct clk_init_data){
  573. .name = "gcc_debug_mux",
  574. .ops = &clk_debug_mux_ops,
  575. .parent_names = gcc_debug_mux_parent_names,
  576. .num_parents = ARRAY_SIZE(gcc_debug_mux_parent_names),
  577. },
  578. };
  579. static const char *const gpu_cc_debug_mux_parent_names[] = {
  580. "gpu_cc_ahb_clk",
  581. "gpu_cc_crc_ahb_clk",
  582. "gpu_cc_cx_accu_shift_clk",
  583. "gpu_cc_cx_ff_clk",
  584. "gpu_cc_cx_gmu_clk",
  585. "gpu_cc_cx_snoc_dvm_clk",
  586. "gpu_cc_cxo_aon_clk",
  587. "gpu_cc_cxo_clk",
  588. "gpu_cc_demet_clk",
  589. "gpu_cc_gx_accu_shift_clk",
  590. "gpu_cc_hub_aon_clk",
  591. "gpu_cc_hub_cx_int_clk",
  592. "gpu_cc_memnoc_gfx_clk",
  593. "gpu_cc_sleep_clk",
  594. "measure_only_gcc_gpu_cfg_ahb_clk",
  595. "measure_only_gpu_cc_cb_clk",
  596. };
  597. static int gpu_cc_debug_mux_sels[] = {
  598. 0x16, /* gpu_cc_ahb_clk */
  599. 0x17, /* gpu_cc_crc_ahb_clk */
  600. 0x31, /* gpu_cc_cx_accu_shift_clk */
  601. 0x21, /* gpu_cc_cx_ff_clk */
  602. 0x1E, /* gpu_cc_cx_gmu_clk */
  603. 0x1B, /* gpu_cc_cx_snoc_dvm_clk */
  604. 0xB, /* gpu_cc_cxo_aon_clk */
  605. 0x1F, /* gpu_cc_cxo_clk */
  606. 0xD, /* gpu_cc_demet_clk */
  607. 0x30, /* gpu_cc_gx_accu_shift_clk */
  608. 0x2F, /* gpu_cc_hub_aon_clk */
  609. 0x20, /* gpu_cc_hub_cx_int_clk */
  610. 0x22, /* gpu_cc_memnoc_gfx_clk */
  611. 0x1C, /* gpu_cc_sleep_clk */
  612. 0x1, /* measure_only_gcc_gpu_cfg_ahb_clk */
  613. 0x2E, /* measure_only_gpu_cc_cb_clk */
  614. };
  615. static struct clk_debug_mux gpu_cc_debug_mux = {
  616. .priv = &debug_mux_priv,
  617. .debug_offset = 0x9564,
  618. .post_div_offset = 0x9270,
  619. .cbcr_offset = 0x9274,
  620. .src_sel_mask = 0xFF,
  621. .src_sel_shift = 0,
  622. .post_div_mask = 0xF,
  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 = &(const 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 video_cc_debug_mux_parent_names[] = {
  635. "measure_only_video_cc_ahb_clk",
  636. "measure_only_video_cc_xo_clk",
  637. "video_cc_mvs0_clk",
  638. "video_cc_mvs0c_clk",
  639. "video_cc_mvs1_clk",
  640. "video_cc_mvs1c_clk",
  641. "video_cc_sleep_clk",
  642. };
  643. static int video_cc_debug_mux_sels[] = {
  644. 0x7, /* measure_only_video_cc_ahb_clk */
  645. 0xB, /* measure_only_video_cc_xo_clk */
  646. 0x3, /* video_cc_mvs0_clk */
  647. 0x1, /* video_cc_mvs0c_clk */
  648. 0x5, /* video_cc_mvs1_clk */
  649. 0x9, /* video_cc_mvs1c_clk */
  650. 0xC, /* video_cc_sleep_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 = 0x80F0,
  656. .cbcr_offset = 0x80F4,
  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 = &gpu_cc_debug_mux, .regmap_name = "qcom,gpucc" },
  687. { .mux = &disp_cc_debug_mux, .regmap_name = "qcom,dispcc" },
  688. { .mux = &cam_cc_debug_mux, .regmap_name = "qcom,camcc" },
  689. { .mux = &apss_cc_debug_mux, .regmap_name = "qcom,apsscc" },
  690. { .mux = &gcc_debug_mux, .regmap_name = "qcom,gcc" },
  691. };
  692. static struct clk_dummy measure_only_apcs_cl1_l3_post_acd_clk = {
  693. .rrate = 1000,
  694. .hw.init = &(const struct clk_init_data){
  695. .name = "measure_only_apcs_cl1_l3_post_acd_clk",
  696. .ops = &clk_dummy_ops,
  697. },
  698. };
  699. static struct clk_dummy measure_only_apcs_gold_post_acd_clk = {
  700. .rrate = 1000,
  701. .hw.init = &(const struct clk_init_data){
  702. .name = "measure_only_apcs_gold_post_acd_clk",
  703. .ops = &clk_dummy_ops,
  704. },
  705. };
  706. static struct clk_dummy measure_only_apcs_goldplus_post_acd_clk = {
  707. .rrate = 1000,
  708. .hw.init = &(const struct clk_init_data){
  709. .name = "measure_only_apcs_goldplus_post_acd_clk",
  710. .ops = &clk_dummy_ops,
  711. },
  712. };
  713. static struct clk_dummy measure_only_apcs_l3_post_acd_clk = {
  714. .rrate = 1000,
  715. .hw.init = &(const struct clk_init_data){
  716. .name = "measure_only_apcs_l3_post_acd_clk",
  717. .ops = &clk_dummy_ops,
  718. },
  719. };
  720. static struct clk_dummy measure_only_apcs_cl1_silver_post_acd_clk = {
  721. .rrate = 1000,
  722. .hw.init = &(const struct clk_init_data){
  723. .name = "measure_only_apcs_cl1_silver_post_acd_clk",
  724. .ops = &clk_dummy_ops,
  725. },
  726. };
  727. static struct clk_dummy measure_only_cam_cc_gdsc_clk = {
  728. .rrate = 1000,
  729. .hw.init = &(const struct clk_init_data){
  730. .name = "measure_only_cam_cc_gdsc_clk",
  731. .ops = &clk_dummy_ops,
  732. },
  733. };
  734. static struct clk_dummy measure_only_cnoc_clk = {
  735. .rrate = 1000,
  736. .hw.init = &(const struct clk_init_data){
  737. .name = "measure_only_cnoc_clk",
  738. .ops = &clk_dummy_ops,
  739. },
  740. };
  741. static struct clk_dummy measure_only_disp_cc_xo_clk = {
  742. .rrate = 1000,
  743. .hw.init = &(const struct clk_init_data){
  744. .name = "measure_only_disp_cc_xo_clk",
  745. .ops = &clk_dummy_ops,
  746. },
  747. };
  748. static struct clk_dummy measure_only_gcc_camera_ahb_clk = {
  749. .rrate = 1000,
  750. .hw.init = &(const struct clk_init_data){
  751. .name = "measure_only_gcc_camera_ahb_clk",
  752. .ops = &clk_dummy_ops,
  753. },
  754. };
  755. static struct clk_dummy measure_only_gcc_camera_xo_clk = {
  756. .rrate = 1000,
  757. .hw.init = &(const struct clk_init_data){
  758. .name = "measure_only_gcc_camera_xo_clk",
  759. .ops = &clk_dummy_ops,
  760. },
  761. };
  762. static struct clk_dummy measure_only_gcc_disp_ahb_clk = {
  763. .rrate = 1000,
  764. .hw.init = &(const struct clk_init_data){
  765. .name = "measure_only_gcc_disp_ahb_clk",
  766. .ops = &clk_dummy_ops,
  767. },
  768. };
  769. static struct clk_dummy measure_only_gcc_disp_xo_clk = {
  770. .rrate = 1000,
  771. .hw.init = &(const struct clk_init_data){
  772. .name = "measure_only_gcc_disp_xo_clk",
  773. .ops = &clk_dummy_ops,
  774. },
  775. };
  776. static struct clk_dummy measure_only_gcc_gpu_cfg_ahb_clk = {
  777. .rrate = 1000,
  778. .hw.init = &(const struct clk_init_data){
  779. .name = "measure_only_gcc_gpu_cfg_ahb_clk",
  780. .ops = &clk_dummy_ops,
  781. },
  782. };
  783. static struct clk_dummy measure_only_gcc_video_ahb_clk = {
  784. .rrate = 1000,
  785. .hw.init = &(const struct clk_init_data){
  786. .name = "measure_only_gcc_video_ahb_clk",
  787. .ops = &clk_dummy_ops,
  788. },
  789. };
  790. static struct clk_dummy measure_only_gcc_video_xo_clk = {
  791. .rrate = 1000,
  792. .hw.init = &(const struct clk_init_data){
  793. .name = "measure_only_gcc_video_xo_clk",
  794. .ops = &clk_dummy_ops,
  795. },
  796. };
  797. static struct clk_dummy measure_only_gpu_cc_cb_clk = {
  798. .rrate = 1000,
  799. .hw.init = &(const struct clk_init_data){
  800. .name = "measure_only_gpu_cc_cb_clk",
  801. .ops = &clk_dummy_ops,
  802. },
  803. };
  804. static struct clk_dummy measure_only_ipa_2x_clk = {
  805. .rrate = 1000,
  806. .hw.init = &(const struct clk_init_data){
  807. .name = "measure_only_ipa_2x_clk",
  808. .ops = &clk_dummy_ops,
  809. },
  810. };
  811. static struct clk_dummy measure_only_mccc_clk = {
  812. .rrate = 1000,
  813. .hw.init = &(const struct clk_init_data){
  814. .name = "measure_only_mccc_clk",
  815. .ops = &clk_dummy_ops,
  816. },
  817. };
  818. static struct clk_dummy measure_only_memnoc_clk = {
  819. .rrate = 1000,
  820. .hw.init = &(const struct clk_init_data){
  821. .name = "measure_only_memnoc_clk",
  822. .ops = &clk_dummy_ops,
  823. },
  824. };
  825. static struct clk_dummy measure_only_pcie_0_pipe_clk = {
  826. .rrate = 1000,
  827. .hw.init = &(const struct clk_init_data){
  828. .name = "measure_only_pcie_0_pipe_clk",
  829. .ops = &clk_dummy_ops,
  830. },
  831. };
  832. static struct clk_dummy measure_only_pcie_1_pipe_clk = {
  833. .rrate = 1000,
  834. .hw.init = &(const struct clk_init_data){
  835. .name = "measure_only_pcie_1_pipe_clk",
  836. .ops = &clk_dummy_ops,
  837. },
  838. };
  839. static struct clk_dummy measure_only_pcie_phy_aux_clk = {
  840. .rrate = 1000,
  841. .hw.init = &(const struct clk_init_data){
  842. .name = "measure_only_pcie_phy_aux_clk",
  843. .ops = &clk_dummy_ops,
  844. },
  845. };
  846. static struct clk_dummy measure_only_snoc_clk = {
  847. .rrate = 1000,
  848. .hw.init = &(const struct clk_init_data){
  849. .name = "measure_only_snoc_clk",
  850. .ops = &clk_dummy_ops,
  851. },
  852. };
  853. static struct clk_dummy measure_only_ufs_phy_rx_symbol_0_clk = {
  854. .rrate = 1000,
  855. .hw.init = &(const struct clk_init_data){
  856. .name = "measure_only_ufs_phy_rx_symbol_0_clk",
  857. .ops = &clk_dummy_ops,
  858. },
  859. };
  860. static struct clk_dummy measure_only_ufs_phy_rx_symbol_1_clk = {
  861. .rrate = 1000,
  862. .hw.init = &(const struct clk_init_data){
  863. .name = "measure_only_ufs_phy_rx_symbol_1_clk",
  864. .ops = &clk_dummy_ops,
  865. },
  866. };
  867. static struct clk_dummy measure_only_ufs_phy_tx_symbol_0_clk = {
  868. .rrate = 1000,
  869. .hw.init = &(const struct clk_init_data){
  870. .name = "measure_only_ufs_phy_tx_symbol_0_clk",
  871. .ops = &clk_dummy_ops,
  872. },
  873. };
  874. static struct clk_dummy measure_only_usb3_phy_wrapper_gcc_usb30_prim_pipe_clk = {
  875. .rrate = 1000,
  876. .hw.init = &(const struct clk_init_data){
  877. .name = "measure_only_usb3_phy_wrapper_gcc_usb30_prim_pipe_clk",
  878. .ops = &clk_dummy_ops,
  879. },
  880. };
  881. static struct clk_dummy measure_only_video_cc_ahb_clk = {
  882. .rrate = 1000,
  883. .hw.init = &(const struct clk_init_data){
  884. .name = "measure_only_video_cc_ahb_clk",
  885. .ops = &clk_dummy_ops,
  886. },
  887. };
  888. static struct clk_dummy measure_only_video_cc_xo_clk = {
  889. .rrate = 1000,
  890. .hw.init = &(const struct clk_init_data){
  891. .name = "measure_only_video_cc_xo_clk",
  892. .ops = &clk_dummy_ops,
  893. },
  894. };
  895. static struct clk_hw *debugcc_monaco_auto_hws[] = {
  896. &measure_only_apcs_cl1_l3_post_acd_clk.hw,
  897. &measure_only_apcs_gold_post_acd_clk.hw,
  898. &measure_only_apcs_goldplus_post_acd_clk.hw,
  899. &measure_only_apcs_l3_post_acd_clk.hw,
  900. &measure_only_apcs_cl1_silver_post_acd_clk.hw,
  901. &measure_only_cam_cc_gdsc_clk.hw,
  902. &measure_only_cnoc_clk.hw,
  903. &measure_only_disp_cc_xo_clk.hw,
  904. &measure_only_gcc_camera_ahb_clk.hw,
  905. &measure_only_gcc_camera_xo_clk.hw,
  906. &measure_only_gcc_disp_ahb_clk.hw,
  907. &measure_only_gcc_disp_xo_clk.hw,
  908. &measure_only_gcc_gpu_cfg_ahb_clk.hw,
  909. &measure_only_gcc_video_ahb_clk.hw,
  910. &measure_only_gcc_video_xo_clk.hw,
  911. &measure_only_gpu_cc_cb_clk.hw,
  912. &measure_only_ipa_2x_clk.hw,
  913. &measure_only_mccc_clk.hw,
  914. &measure_only_memnoc_clk.hw,
  915. &measure_only_pcie_0_pipe_clk.hw,
  916. &measure_only_pcie_1_pipe_clk.hw,
  917. &measure_only_pcie_phy_aux_clk.hw,
  918. &measure_only_snoc_clk.hw,
  919. &measure_only_ufs_phy_rx_symbol_0_clk.hw,
  920. &measure_only_ufs_phy_rx_symbol_1_clk.hw,
  921. &measure_only_ufs_phy_tx_symbol_0_clk.hw,
  922. &measure_only_usb3_phy_wrapper_gcc_usb30_prim_pipe_clk.hw,
  923. &measure_only_video_cc_ahb_clk.hw,
  924. &measure_only_video_cc_xo_clk.hw,
  925. };
  926. static const struct of_device_id clk_debug_match_table[] = {
  927. { .compatible = "qcom,monaco_auto-debugcc" },
  928. { }
  929. };
  930. static int clk_debug_monaco_auto_probe(struct platform_device *pdev)
  931. {
  932. struct clk *clk;
  933. int ret, i;
  934. BUILD_BUG_ON(ARRAY_SIZE(apss_cc_debug_mux_parent_names) !=
  935. ARRAY_SIZE(apss_cc_debug_mux_sels));
  936. BUILD_BUG_ON(ARRAY_SIZE(cam_cc_debug_mux_parent_names) !=
  937. ARRAY_SIZE(cam_cc_debug_mux_sels));
  938. BUILD_BUG_ON(ARRAY_SIZE(disp_cc_debug_mux_parent_names) !=
  939. ARRAY_SIZE(disp_cc_debug_mux_sels));
  940. BUILD_BUG_ON(ARRAY_SIZE(gcc_debug_mux_parent_names) != ARRAY_SIZE(gcc_debug_mux_sels));
  941. BUILD_BUG_ON(ARRAY_SIZE(gpu_cc_debug_mux_parent_names) !=
  942. ARRAY_SIZE(gpu_cc_debug_mux_sels));
  943. BUILD_BUG_ON(ARRAY_SIZE(video_cc_debug_mux_parent_names) !=
  944. ARRAY_SIZE(video_cc_debug_mux_sels));
  945. clk = devm_clk_get(&pdev->dev, "xo_clk_src");
  946. if (IS_ERR(clk)) {
  947. if (PTR_ERR(clk) != -EPROBE_DEFER)
  948. dev_err(&pdev->dev, "Unable to get xo clock\n");
  949. return PTR_ERR(clk);
  950. }
  951. debug_mux_priv.cxo = clk;
  952. for (i = 0; i < ARRAY_SIZE(mux_list); i++) {
  953. if (IS_ERR_OR_NULL(mux_list[i].mux->regmap)) {
  954. ret = map_debug_bases(pdev, mux_list[i].regmap_name,
  955. mux_list[i].mux);
  956. if (ret == -EBADR)
  957. continue;
  958. else if (ret)
  959. return ret;
  960. }
  961. }
  962. for (i = 0; i < ARRAY_SIZE(debugcc_monaco_auto_hws); i++) {
  963. clk = devm_clk_register(&pdev->dev, debugcc_monaco_auto_hws[i]);
  964. if (IS_ERR(clk)) {
  965. dev_err(&pdev->dev, "Unable to register %s, err:(%d)\n",
  966. clk_hw_get_name(debugcc_monaco_auto_hws[i]),
  967. PTR_ERR(clk));
  968. return PTR_ERR(clk);
  969. }
  970. }
  971. for (i = 0; i < ARRAY_SIZE(mux_list); i++) {
  972. if (!mux_list[i].mux->regmap)
  973. continue;
  974. ret = devm_clk_register_debug_mux(&pdev->dev, mux_list[i].mux);
  975. if (ret) {
  976. dev_err(&pdev->dev, "Unable to register mux clk %s, err:(%d)\n",
  977. qcom_clk_hw_get_name(&mux_list[i].mux->hw),
  978. ret);
  979. return ret;
  980. }
  981. }
  982. ret = clk_debug_measure_register(&gcc_debug_mux.hw);
  983. if (ret) {
  984. dev_err(&pdev->dev, "Could not register Measure clocks\n");
  985. return ret;
  986. }
  987. dev_info(&pdev->dev, "Registered debug measure clocks\n");
  988. return ret;
  989. }
  990. static struct platform_driver clk_debug_driver = {
  991. .probe = clk_debug_monaco_auto_probe,
  992. .driver = {
  993. .name = "monaco_auto-debugcc",
  994. .of_match_table = clk_debug_match_table,
  995. },
  996. };
  997. static int __init clk_debug_monaco_auto_init(void)
  998. {
  999. return platform_driver_register(&clk_debug_driver);
  1000. }
  1001. fs_initcall(clk_debug_monaco_auto_init);
  1002. MODULE_DESCRIPTION("QTI DEBUG CC MONACO_AUTO Driver");
  1003. MODULE_LICENSE("GPL");