debugcc-cliffs.c 35 KB

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