debugcc-lemans.c 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2022-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_cl0_gold_post_acd_clk",
  26. "measure_only_apcs_cl1_goldplus_post_acd_clk",
  27. "measure_only_apcs_cl0_l3_post_acd_clk",
  28. };
  29. static int apss_cc_debug_mux_sels[] = {
  30. 0x61, /* measure_only_apcs_cl1_l3_post_acd_clk */
  31. 0x21, /* measure_only_apcs_cl0_gold_post_acd_clk */
  32. 0x25, /* measure_only_apcs_cl1_goldplus_post_acd_clk */
  33. 0x41, /* measure_only_apcs_cl0_l3_post_acd_clk */
  34. };
  35. static int apss_cc_debug_mux_pre_divs[] = {
  36. 0x4, /* measure_only_apcs_cl1_l3_post_acd_clk */
  37. 0x8, /* measure_only_apcs_cl0_gold_post_acd_clk */
  38. 0x8, /* measure_only_apcs_cl1_goldplus_post_acd_clk */
  39. 0x4, /* measure_only_apcs_cl0_l3_post_acd_clk */
  40. };
  41. static struct clk_debug_mux apss_cc_debug_mux = {
  42. .priv = &debug_mux_priv,
  43. .debug_offset = 0x18,
  44. .post_div_offset = 0x18,
  45. .cbcr_offset = 0x0,
  46. .src_sel_mask = 0x7F0,
  47. .src_sel_shift = 4,
  48. .post_div_mask = 0x7800,
  49. .post_div_shift = 11,
  50. .post_div_val = 1,
  51. .mux_sels = apss_cc_debug_mux_sels,
  52. .pre_div_vals = apss_cc_debug_mux_pre_divs,
  53. .hw.init = &(const struct clk_init_data){
  54. .name = "apss_cc_debug_mux",
  55. .ops = &clk_debug_mux_ops,
  56. .parent_names = apss_cc_debug_mux_parent_names,
  57. .num_parents = ARRAY_SIZE(apss_cc_debug_mux_parent_names),
  58. },
  59. };
  60. static const char *const cam_cc_debug_mux_parent_names[] = {
  61. "cam_cc_camnoc_axi_clk",
  62. "cam_cc_camnoc_dcd_xo_clk",
  63. "cam_cc_camnoc_xo_clk",
  64. "cam_cc_cci_0_clk",
  65. "cam_cc_cci_1_clk",
  66. "cam_cc_cci_2_clk",
  67. "cam_cc_cci_3_clk",
  68. "cam_cc_core_ahb_clk",
  69. "cam_cc_cpas_ahb_clk",
  70. "cam_cc_cpas_fast_ahb_clk",
  71. "cam_cc_cpas_ife_0_clk",
  72. "cam_cc_cpas_ife_1_clk",
  73. "cam_cc_cpas_ife_lite_clk",
  74. "cam_cc_cpas_ipe_clk",
  75. "cam_cc_cpas_sfe_lite_0_clk",
  76. "cam_cc_cpas_sfe_lite_1_clk",
  77. "cam_cc_csi0phytimer_clk",
  78. "cam_cc_csi1phytimer_clk",
  79. "cam_cc_csi2phytimer_clk",
  80. "cam_cc_csi3phytimer_clk",
  81. "cam_cc_csid_clk",
  82. "cam_cc_csid_csiphy_rx_clk",
  83. "cam_cc_csiphy0_clk",
  84. "cam_cc_csiphy1_clk",
  85. "cam_cc_csiphy2_clk",
  86. "cam_cc_csiphy3_clk",
  87. "cam_cc_icp_ahb_clk",
  88. "cam_cc_icp_clk",
  89. "cam_cc_ife_0_clk",
  90. "cam_cc_ife_0_fast_ahb_clk",
  91. "cam_cc_ife_1_clk",
  92. "cam_cc_ife_1_fast_ahb_clk",
  93. "cam_cc_ife_lite_ahb_clk",
  94. "cam_cc_ife_lite_clk",
  95. "cam_cc_ife_lite_cphy_rx_clk",
  96. "cam_cc_ife_lite_csid_clk",
  97. "cam_cc_ipe_ahb_clk",
  98. "cam_cc_ipe_clk",
  99. "cam_cc_ipe_fast_ahb_clk",
  100. "cam_cc_mclk0_clk",
  101. "cam_cc_mclk1_clk",
  102. "cam_cc_mclk2_clk",
  103. "cam_cc_mclk3_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. "measure_only_cam_cc_gdsc_clk",
  110. };
  111. static int cam_cc_debug_mux_sels[] = {
  112. 0x35, /* cam_cc_camnoc_axi_clk */
  113. 0x36, /* cam_cc_camnoc_dcd_xo_clk */
  114. 0x37, /* cam_cc_camnoc_xo_clk */
  115. 0x30, /* cam_cc_cci_0_clk */
  116. 0x31, /* cam_cc_cci_1_clk */
  117. 0x5, /* cam_cc_cci_2_clk */
  118. 0x6, /* cam_cc_cci_3_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. 0x10, /* cam_cc_csi3phytimer_clk */
  132. 0x34, /* cam_cc_csid_clk */
  133. 0xB, /* cam_cc_csid_csiphy_rx_clk */
  134. 0xA, /* cam_cc_csiphy0_clk */
  135. 0xD, /* cam_cc_csiphy1_clk */
  136. 0xF, /* cam_cc_csiphy2_clk */
  137. 0x11, /* cam_cc_csiphy3_clk */
  138. 0x2F, /* cam_cc_icp_ahb_clk */
  139. 0x2E, /* cam_cc_icp_clk */
  140. 0x17, /* cam_cc_ife_0_clk */
  141. 0x1B, /* cam_cc_ife_0_fast_ahb_clk */
  142. 0x1C, /* cam_cc_ife_1_clk */
  143. 0x20, /* cam_cc_ife_1_fast_ahb_clk */
  144. 0x25, /* cam_cc_ife_lite_ahb_clk */
  145. 0x21, /* cam_cc_ife_lite_clk */
  146. 0x24, /* cam_cc_ife_lite_cphy_rx_clk */
  147. 0x23, /* cam_cc_ife_lite_csid_clk */
  148. 0x15, /* cam_cc_ipe_ahb_clk */
  149. 0x12, /* cam_cc_ipe_clk */
  150. 0x16, /* cam_cc_ipe_fast_ahb_clk */
  151. 0x1, /* cam_cc_mclk0_clk */
  152. 0x2, /* cam_cc_mclk1_clk */
  153. 0x3, /* cam_cc_mclk2_clk */
  154. 0x4, /* cam_cc_mclk3_clk */
  155. 0x26, /* cam_cc_sfe_lite_0_clk */
  156. 0x29, /* cam_cc_sfe_lite_0_fast_ahb_clk */
  157. 0x2A, /* cam_cc_sfe_lite_1_clk */
  158. 0x2D, /* cam_cc_sfe_lite_1_fast_ahb_clk */
  159. 0x3C, /* cam_cc_sleep_clk */
  160. 0x3B, /* measure_only_cam_cc_gdsc_clk */
  161. };
  162. static struct clk_debug_mux cam_cc_debug_mux = {
  163. .priv = &debug_mux_priv,
  164. .debug_offset = 0x150F8,
  165. .post_div_offset = 0x14004,
  166. .cbcr_offset = 0x14008,
  167. .src_sel_mask = 0xFF,
  168. .src_sel_shift = 0,
  169. .post_div_mask = 0xF,
  170. .post_div_shift = 0,
  171. .post_div_val = 4,
  172. .mux_sels = cam_cc_debug_mux_sels,
  173. .hw.init = &(const struct clk_init_data){
  174. .name = "cam_cc_debug_mux",
  175. .ops = &clk_debug_mux_ops,
  176. .parent_names = cam_cc_debug_mux_parent_names,
  177. .num_parents = ARRAY_SIZE(cam_cc_debug_mux_parent_names),
  178. },
  179. };
  180. static const char *const disp_cc_0_debug_mux_parent_names[] = {
  181. "mdss_0_disp_cc_mdss_ahb1_clk",
  182. "mdss_0_disp_cc_mdss_ahb_clk",
  183. "mdss_0_disp_cc_mdss_byte0_clk",
  184. "mdss_0_disp_cc_mdss_byte0_intf_clk",
  185. "mdss_0_disp_cc_mdss_byte1_clk",
  186. "mdss_0_disp_cc_mdss_byte1_intf_clk",
  187. "mdss_0_disp_cc_mdss_dptx0_aux_clk",
  188. "mdss_0_disp_cc_mdss_dptx0_crypto_clk",
  189. "mdss_0_disp_cc_mdss_dptx0_link_clk",
  190. "mdss_0_disp_cc_mdss_dptx0_link_intf_clk",
  191. "mdss_0_disp_cc_mdss_dptx0_pixel0_clk",
  192. "mdss_0_disp_cc_mdss_dptx0_pixel1_clk",
  193. "mdss_0_disp_cc_mdss_dptx0_pixel2_clk",
  194. "mdss_0_disp_cc_mdss_dptx0_pixel3_clk",
  195. "mdss_0_disp_cc_mdss_dptx0_usb_router_link_intf_clk",
  196. "mdss_0_disp_cc_mdss_dptx1_aux_clk",
  197. "mdss_0_disp_cc_mdss_dptx1_crypto_clk",
  198. "mdss_0_disp_cc_mdss_dptx1_link_clk",
  199. "mdss_0_disp_cc_mdss_dptx1_link_intf_clk",
  200. "mdss_0_disp_cc_mdss_dptx1_pixel0_clk",
  201. "mdss_0_disp_cc_mdss_dptx1_pixel1_clk",
  202. "mdss_0_disp_cc_mdss_dptx1_usb_router_link_intf_clk",
  203. "mdss_0_disp_cc_mdss_esc0_clk",
  204. "mdss_0_disp_cc_mdss_esc1_clk",
  205. "mdss_0_disp_cc_mdss_mdp1_clk",
  206. "mdss_0_disp_cc_mdss_mdp_clk",
  207. "mdss_0_disp_cc_mdss_mdp_lut1_clk",
  208. "mdss_0_disp_cc_mdss_mdp_lut_clk",
  209. "mdss_0_disp_cc_mdss_non_gdsc_ahb_clk",
  210. "mdss_0_disp_cc_mdss_pclk0_clk",
  211. "mdss_0_disp_cc_mdss_pclk1_clk",
  212. "mdss_0_disp_cc_mdss_rscc_ahb_clk",
  213. "mdss_0_disp_cc_mdss_rscc_vsync_clk",
  214. "mdss_0_disp_cc_mdss_vsync1_clk",
  215. "mdss_0_disp_cc_mdss_vsync_clk",
  216. "mdss_0_disp_cc_sleep_clk",
  217. "measure_only_mdss_0_disp_cc_xo_clk",
  218. };
  219. static int disp_cc_0_debug_mux_sels[] = {
  220. 0x27, /* mdss_0_disp_cc_mdss_ahb1_clk */
  221. 0x26, /* mdss_0_disp_cc_mdss_ahb_clk */
  222. 0x12, /* mdss_0_disp_cc_mdss_byte0_clk */
  223. 0x13, /* mdss_0_disp_cc_mdss_byte0_intf_clk */
  224. 0x14, /* mdss_0_disp_cc_mdss_byte1_clk */
  225. 0x15, /* mdss_0_disp_cc_mdss_byte1_intf_clk */
  226. 0x1C, /* mdss_0_disp_cc_mdss_dptx0_aux_clk */
  227. 0x1B, /* mdss_0_disp_cc_mdss_dptx0_crypto_clk */
  228. 0x18, /* mdss_0_disp_cc_mdss_dptx0_link_clk */
  229. 0x19, /* mdss_0_disp_cc_mdss_dptx0_link_intf_clk */
  230. 0x1D, /* mdss_0_disp_cc_mdss_dptx0_pixel0_clk */
  231. 0x1E, /* mdss_0_disp_cc_mdss_dptx0_pixel1_clk */
  232. 0x28, /* mdss_0_disp_cc_mdss_dptx0_pixel2_clk */
  233. 0x29, /* mdss_0_disp_cc_mdss_dptx0_pixel3_clk */
  234. 0x1A, /* mdss_0_disp_cc_mdss_dptx0_usb_router_link_intf_clk */
  235. 0x25, /* mdss_0_disp_cc_mdss_dptx1_aux_clk */
  236. 0x24, /* mdss_0_disp_cc_mdss_dptx1_crypto_clk */
  237. 0x21, /* mdss_0_disp_cc_mdss_dptx1_link_clk */
  238. 0x22, /* mdss_0_disp_cc_mdss_dptx1_link_intf_clk */
  239. 0x1F, /* mdss_0_disp_cc_mdss_dptx1_pixel0_clk */
  240. 0x20, /* mdss_0_disp_cc_mdss_dptx1_pixel1_clk */
  241. 0x23, /* mdss_0_disp_cc_mdss_dptx1_usb_router_link_intf_clk */
  242. 0x16, /* mdss_0_disp_cc_mdss_esc0_clk */
  243. 0x17, /* mdss_0_disp_cc_mdss_esc1_clk */
  244. 0xD, /* mdss_0_disp_cc_mdss_mdp1_clk */
  245. 0xC, /* mdss_0_disp_cc_mdss_mdp_clk */
  246. 0xF, /* mdss_0_disp_cc_mdss_mdp_lut1_clk */
  247. 0xE, /* mdss_0_disp_cc_mdss_mdp_lut_clk */
  248. 0x2A, /* mdss_0_disp_cc_mdss_non_gdsc_ahb_clk */
  249. 0xA, /* mdss_0_disp_cc_mdss_pclk0_clk */
  250. 0xB, /* mdss_0_disp_cc_mdss_pclk1_clk */
  251. 0x2C, /* mdss_0_disp_cc_mdss_rscc_ahb_clk */
  252. 0x2B, /* mdss_0_disp_cc_mdss_rscc_vsync_clk */
  253. 0x11, /* mdss_0_disp_cc_mdss_vsync1_clk */
  254. 0x10, /* mdss_0_disp_cc_mdss_vsync_clk */
  255. 0x35, /* mdss_0_disp_cc_sleep_clk */
  256. 0x34, /* measure_only_mdss_0_disp_cc_xo_clk */
  257. };
  258. static struct clk_debug_mux disp_cc_0_debug_mux = {
  259. .priv = &debug_mux_priv,
  260. .debug_offset = 0x11000,
  261. .post_div_offset = 0xB000,
  262. .cbcr_offset = 0xB004,
  263. .src_sel_mask = 0xFF,
  264. .src_sel_shift = 0,
  265. .post_div_mask = 0xF,
  266. .post_div_shift = 0,
  267. .post_div_val = 4,
  268. .mux_sels = disp_cc_0_debug_mux_sels,
  269. .hw.init = &(const struct clk_init_data){
  270. .name = "disp_cc_0_debug_mux",
  271. .ops = &clk_debug_mux_ops,
  272. .parent_names = disp_cc_0_debug_mux_parent_names,
  273. .num_parents = ARRAY_SIZE(disp_cc_0_debug_mux_parent_names),
  274. },
  275. };
  276. static const char *const disp_cc_1_debug_mux_parent_names[] = {
  277. "mdss_1_disp_cc_mdss_ahb1_clk",
  278. "mdss_1_disp_cc_mdss_ahb_clk",
  279. "mdss_1_disp_cc_mdss_byte0_clk",
  280. "mdss_1_disp_cc_mdss_byte0_intf_clk",
  281. "mdss_1_disp_cc_mdss_byte1_clk",
  282. "mdss_1_disp_cc_mdss_byte1_intf_clk",
  283. "mdss_1_disp_cc_mdss_dptx0_aux_clk",
  284. "mdss_1_disp_cc_mdss_dptx0_crypto_clk",
  285. "mdss_1_disp_cc_mdss_dptx0_link_clk",
  286. "mdss_1_disp_cc_mdss_dptx0_link_intf_clk",
  287. "mdss_1_disp_cc_mdss_dptx0_pixel0_clk",
  288. "mdss_1_disp_cc_mdss_dptx0_pixel1_clk",
  289. "mdss_1_disp_cc_mdss_dptx0_pixel2_clk",
  290. "mdss_1_disp_cc_mdss_dptx0_pixel3_clk",
  291. "mdss_1_disp_cc_mdss_dptx0_usb_router_link_intf_clk",
  292. "mdss_1_disp_cc_mdss_dptx1_aux_clk",
  293. "mdss_1_disp_cc_mdss_dptx1_crypto_clk",
  294. "mdss_1_disp_cc_mdss_dptx1_link_clk",
  295. "mdss_1_disp_cc_mdss_dptx1_link_intf_clk",
  296. "mdss_1_disp_cc_mdss_dptx1_pixel0_clk",
  297. "mdss_1_disp_cc_mdss_dptx1_pixel1_clk",
  298. "mdss_1_disp_cc_mdss_dptx1_usb_router_link_intf_clk",
  299. "mdss_1_disp_cc_mdss_esc0_clk",
  300. "mdss_1_disp_cc_mdss_esc1_clk",
  301. "mdss_1_disp_cc_mdss_mdp1_clk",
  302. "mdss_1_disp_cc_mdss_mdp_clk",
  303. "mdss_1_disp_cc_mdss_mdp_lut1_clk",
  304. "mdss_1_disp_cc_mdss_mdp_lut_clk",
  305. "mdss_1_disp_cc_mdss_non_gdsc_ahb_clk",
  306. "mdss_1_disp_cc_mdss_pclk0_clk",
  307. "mdss_1_disp_cc_mdss_pclk1_clk",
  308. "mdss_1_disp_cc_mdss_rscc_ahb_clk",
  309. "mdss_1_disp_cc_mdss_rscc_vsync_clk",
  310. "mdss_1_disp_cc_mdss_vsync1_clk",
  311. "mdss_1_disp_cc_mdss_vsync_clk",
  312. "mdss_1_disp_cc_sleep_clk",
  313. "measure_only_mdss_1_disp_cc_xo_clk",
  314. };
  315. static int disp_cc_1_debug_mux_sels[] = {
  316. 0x27, /* mdss_1_disp_cc_mdss_ahb1_clk */
  317. 0x26, /* mdss_1_disp_cc_mdss_ahb_clk */
  318. 0x12, /* mdss_1_disp_cc_mdss_byte0_clk */
  319. 0x13, /* mdss_1_disp_cc_mdss_byte0_intf_clk */
  320. 0x14, /* mdss_1_disp_cc_mdss_byte1_clk */
  321. 0x15, /* mdss_1_disp_cc_mdss_byte1_intf_clk */
  322. 0x1C, /* mdss_1_disp_cc_mdss_dptx0_aux_clk */
  323. 0x1B, /* mdss_1_disp_cc_mdss_dptx0_crypto_clk */
  324. 0x18, /* mdss_1_disp_cc_mdss_dptx0_link_clk */
  325. 0x19, /* mdss_1_disp_cc_mdss_dptx0_link_intf_clk */
  326. 0x1D, /* mdss_1_disp_cc_mdss_dptx0_pixel0_clk */
  327. 0x1E, /* mdss_1_disp_cc_mdss_dptx0_pixel1_clk */
  328. 0x28, /* mdss_1_disp_cc_mdss_dptx0_pixel2_clk */
  329. 0x29, /* mdss_1_disp_cc_mdss_dptx0_pixel3_clk */
  330. 0x1A, /* mdss_1_disp_cc_mdss_dptx0_usb_router_link_intf_clk */
  331. 0x25, /* mdss_1_disp_cc_mdss_dptx1_aux_clk */
  332. 0x24, /* mdss_1_disp_cc_mdss_dptx1_crypto_clk */
  333. 0x21, /* mdss_1_disp_cc_mdss_dptx1_link_clk */
  334. 0x22, /* mdss_1_disp_cc_mdss_dptx1_link_intf_clk */
  335. 0x1F, /* mdss_1_disp_cc_mdss_dptx1_pixel0_clk */
  336. 0x20, /* mdss_1_disp_cc_mdss_dptx1_pixel1_clk */
  337. 0x23, /* mdss_1_disp_cc_mdss_dptx1_usb_router_link_intf_clk */
  338. 0x16, /* mdss_1_disp_cc_mdss_esc0_clk */
  339. 0x17, /* mdss_1_disp_cc_mdss_esc1_clk */
  340. 0xD, /* mdss_1_disp_cc_mdss_mdp1_clk */
  341. 0xC, /* mdss_1_disp_cc_mdss_mdp_clk */
  342. 0xF, /* mdss_1_disp_cc_mdss_mdp_lut1_clk */
  343. 0xE, /* mdss_1_disp_cc_mdss_mdp_lut_clk */
  344. 0x2A, /* mdss_1_disp_cc_mdss_non_gdsc_ahb_clk */
  345. 0xA, /* mdss_1_disp_cc_mdss_pclk0_clk */
  346. 0xB, /* mdss_1_disp_cc_mdss_pclk1_clk */
  347. 0x2C, /* mdss_1_disp_cc_mdss_rscc_ahb_clk */
  348. 0x2B, /* mdss_1_disp_cc_mdss_rscc_vsync_clk */
  349. 0x11, /* mdss_1_disp_cc_mdss_vsync1_clk */
  350. 0x10, /* mdss_1_disp_cc_mdss_vsync_clk */
  351. 0x35, /* mdss_1_disp_cc_sleep_clk */
  352. 0x34, /* measure_only_mdss_1_disp_cc_xo_clk */
  353. };
  354. static struct clk_debug_mux disp_cc_1_debug_mux = {
  355. .priv = &debug_mux_priv,
  356. .debug_offset = 0x11000,
  357. .post_div_offset = 0xB000,
  358. .cbcr_offset = 0xB004,
  359. .src_sel_mask = 0xFF,
  360. .src_sel_shift = 0,
  361. .post_div_mask = 0xF,
  362. .post_div_shift = 0,
  363. .post_div_val = 4,
  364. .mux_sels = disp_cc_1_debug_mux_sels,
  365. .hw.init = &(const struct clk_init_data){
  366. .name = "disp_cc_1_debug_mux",
  367. .ops = &clk_debug_mux_ops,
  368. .parent_names = disp_cc_1_debug_mux_parent_names,
  369. .num_parents = ARRAY_SIZE(disp_cc_1_debug_mux_parent_names),
  370. },
  371. };
  372. static const char *const gcc_debug_mux_parent_names[] = {
  373. "apss_cc_debug_mux",
  374. "cam_cc_debug_mux",
  375. "disp_cc_0_debug_mux",
  376. "disp_cc_1_debug_mux",
  377. "gcc_aggre_noc_qupv3_axi_clk",
  378. "gcc_aggre_ufs_card_axi_clk",
  379. "gcc_aggre_ufs_phy_axi_clk",
  380. "gcc_aggre_usb2_prim_axi_clk",
  381. "gcc_aggre_usb3_prim_axi_clk",
  382. "gcc_aggre_usb3_sec_axi_clk",
  383. "gcc_ahb2phy0_clk",
  384. "gcc_ahb2phy2_clk",
  385. "gcc_ahb2phy3_clk",
  386. "gcc_boot_rom_ahb_clk",
  387. "gcc_camera_hf_axi_clk",
  388. "gcc_camera_sf_axi_clk",
  389. "gcc_camera_throttle_xo_clk",
  390. "gcc_cfg_noc_usb2_prim_axi_clk",
  391. "gcc_cfg_noc_usb3_prim_axi_clk",
  392. "gcc_cfg_noc_usb3_sec_axi_clk",
  393. "gcc_ddrss_gpu_axi_clk",
  394. "gcc_disp1_hf_axi_clk",
  395. "gcc_disp_hf_axi_clk",
  396. "gcc_emac0_axi_clk",
  397. "gcc_emac0_phy_aux_clk",
  398. "gcc_emac0_ptp_clk",
  399. "gcc_emac0_rgmii_clk",
  400. "gcc_emac0_slv_ahb_clk",
  401. "gcc_emac1_axi_clk",
  402. "gcc_emac1_phy_aux_clk",
  403. "gcc_emac1_ptp_clk",
  404. "gcc_emac1_rgmii_clk",
  405. "gcc_emac1_slv_ahb_clk",
  406. "gcc_gp1_clk",
  407. "gcc_gp2_clk",
  408. "gcc_gp3_clk",
  409. "gcc_gp4_clk",
  410. "gcc_gp5_clk",
  411. "gcc_gpu_gpll0_clk_src",
  412. "gcc_gpu_gpll0_div_clk_src",
  413. "gcc_gpu_memnoc_gfx_clk",
  414. "gcc_gpu_snoc_dvm_gfx_clk",
  415. "gcc_gpu_tcu_throttle_ahb_clk",
  416. "gcc_gpu_tcu_throttle_clk",
  417. "gcc_pcie_0_aux_clk",
  418. "gcc_pcie_0_cfg_ahb_clk",
  419. "gcc_pcie_0_mstr_axi_clk",
  420. "gcc_pcie_0_phy_aux_clk",
  421. "gcc_pcie_0_phy_rchng_clk",
  422. "gcc_pcie_0_pipe_clk",
  423. "gcc_pcie_0_pipediv2_clk",
  424. "gcc_pcie_0_slv_axi_clk",
  425. "gcc_pcie_0_slv_q2a_axi_clk",
  426. "gcc_pcie_1_aux_clk",
  427. "gcc_pcie_1_cfg_ahb_clk",
  428. "gcc_pcie_1_mstr_axi_clk",
  429. "gcc_pcie_1_phy_aux_clk",
  430. "gcc_pcie_1_phy_rchng_clk",
  431. "gcc_pcie_1_pipe_clk",
  432. "gcc_pcie_1_pipediv2_clk",
  433. "gcc_pcie_1_slv_axi_clk",
  434. "gcc_pcie_1_slv_q2a_axi_clk",
  435. "gcc_pcie_throttle_cfg_clk",
  436. "gcc_pdm2_clk",
  437. "gcc_pdm_ahb_clk",
  438. "gcc_pdm_xo4_clk",
  439. "gcc_qmip_camera_nrt_ahb_clk",
  440. "gcc_qmip_camera_rt_ahb_clk",
  441. "gcc_qmip_disp1_ahb_clk",
  442. "gcc_qmip_disp1_rot_ahb_clk",
  443. "gcc_qmip_disp_ahb_clk",
  444. "gcc_qmip_disp_rot_ahb_clk",
  445. "gcc_qmip_video_cvp_ahb_clk",
  446. "gcc_qmip_video_vcodec_ahb_clk",
  447. "gcc_qmip_video_vcpu_ahb_clk",
  448. "gcc_qupv3_wrap0_core_2x_clk",
  449. "gcc_qupv3_wrap0_core_clk",
  450. "gcc_qupv3_wrap0_s0_clk",
  451. "gcc_qupv3_wrap0_s1_clk",
  452. "gcc_qupv3_wrap0_s2_clk",
  453. "gcc_qupv3_wrap0_s3_clk",
  454. "gcc_qupv3_wrap0_s4_clk",
  455. "gcc_qupv3_wrap0_s5_clk",
  456. "gcc_qupv3_wrap0_s6_clk",
  457. "gcc_qupv3_wrap1_core_2x_clk",
  458. "gcc_qupv3_wrap1_core_clk",
  459. "gcc_qupv3_wrap1_s0_clk",
  460. "gcc_qupv3_wrap1_s1_clk",
  461. "gcc_qupv3_wrap1_s2_clk",
  462. "gcc_qupv3_wrap1_s3_clk",
  463. "gcc_qupv3_wrap1_s4_clk",
  464. "gcc_qupv3_wrap1_s5_clk",
  465. "gcc_qupv3_wrap1_s6_clk",
  466. "gcc_qupv3_wrap2_core_2x_clk",
  467. "gcc_qupv3_wrap2_core_clk",
  468. "gcc_qupv3_wrap2_s0_clk",
  469. "gcc_qupv3_wrap2_s1_clk",
  470. "gcc_qupv3_wrap2_s2_clk",
  471. "gcc_qupv3_wrap2_s3_clk",
  472. "gcc_qupv3_wrap2_s4_clk",
  473. "gcc_qupv3_wrap2_s5_clk",
  474. "gcc_qupv3_wrap2_s6_clk",
  475. "gcc_qupv3_wrap3_core_2x_clk",
  476. "gcc_qupv3_wrap3_core_clk",
  477. "gcc_qupv3_wrap3_qspi_clk",
  478. "gcc_qupv3_wrap3_s0_clk",
  479. "gcc_qupv3_wrap_0_m_ahb_clk",
  480. "gcc_qupv3_wrap_0_s_ahb_clk",
  481. "gcc_qupv3_wrap_1_m_ahb_clk",
  482. "gcc_qupv3_wrap_1_s_ahb_clk",
  483. "gcc_qupv3_wrap_2_m_ahb_clk",
  484. "gcc_qupv3_wrap_2_s_ahb_clk",
  485. "gcc_qupv3_wrap_3_m_ahb_clk",
  486. "gcc_qupv3_wrap_3_s_ahb_clk",
  487. "gcc_sdcc1_ahb_clk",
  488. "gcc_sdcc1_apps_clk",
  489. "gcc_sdcc1_ice_core_clk",
  490. "gcc_tscss_ahb_clk",
  491. "gcc_tscss_etu_clk",
  492. "gcc_tscss_global_cntr_clk",
  493. "gcc_ufs_card_ahb_clk",
  494. "gcc_ufs_card_axi_clk",
  495. "gcc_ufs_card_ice_core_clk",
  496. "gcc_ufs_card_phy_aux_clk",
  497. "gcc_ufs_card_rx_symbol_0_clk",
  498. "gcc_ufs_card_rx_symbol_1_clk",
  499. "gcc_ufs_card_tx_symbol_0_clk",
  500. "gcc_ufs_card_unipro_core_clk",
  501. "gcc_ufs_phy_ahb_clk",
  502. "gcc_ufs_phy_axi_clk",
  503. "gcc_ufs_phy_ice_core_clk",
  504. "gcc_ufs_phy_phy_aux_clk",
  505. "gcc_ufs_phy_rx_symbol_0_clk",
  506. "gcc_ufs_phy_rx_symbol_1_clk",
  507. "gcc_ufs_phy_tx_symbol_0_clk",
  508. "gcc_ufs_phy_unipro_core_clk",
  509. "gcc_usb20_master_clk",
  510. "gcc_usb20_mock_utmi_clk",
  511. "gcc_usb20_sleep_clk",
  512. "gcc_usb30_prim_master_clk",
  513. "gcc_usb30_prim_mock_utmi_clk",
  514. "gcc_usb30_prim_sleep_clk",
  515. "gcc_usb30_sec_master_clk",
  516. "gcc_usb30_sec_mock_utmi_clk",
  517. "gcc_usb30_sec_sleep_clk",
  518. "gcc_usb3_prim_phy_aux_clk",
  519. "gcc_usb3_prim_phy_com_aux_clk",
  520. "gcc_usb3_prim_phy_pipe_clk",
  521. "gcc_usb3_sec_phy_aux_clk",
  522. "gcc_usb3_sec_phy_com_aux_clk",
  523. "gcc_usb3_sec_phy_pipe_clk",
  524. "gcc_video_axi0_clk",
  525. "gcc_video_axi1_clk",
  526. "gpu_cc_debug_mux",
  527. "measure_only_cnoc_clk",
  528. "measure_only_gcc_camera_ahb_clk",
  529. "measure_only_gcc_camera_xo_clk",
  530. "measure_only_gcc_disp1_ahb_clk",
  531. "measure_only_gcc_disp1_xo_clk",
  532. "measure_only_gcc_disp_ahb_clk",
  533. "measure_only_gcc_disp_xo_clk",
  534. "measure_only_gcc_gpu_cfg_ahb_clk",
  535. "measure_only_gcc_video_ahb_clk",
  536. "measure_only_gcc_video_xo_clk",
  537. "measure_only_ipa_2x_clk",
  538. "measure_only_memnoc_clk",
  539. "measure_only_snoc_clk",
  540. "mc_cc_debug_mux",
  541. "video_cc_debug_mux",
  542. };
  543. static int gcc_debug_mux_sels[] = {
  544. 0x175, /* apss_cc_debug_mux */
  545. 0x8C, /* cam_cc_debug_mux */
  546. 0x92, /* disp_cc_0_debug_mux */
  547. 0x98, /* disp_cc_1_debug_mux */
  548. 0x224, /* gcc_aggre_noc_qupv3_axi_clk */
  549. 0x1E8, /* gcc_aggre_ufs_card_axi_clk */
  550. 0x1E7, /* gcc_aggre_ufs_phy_axi_clk */
  551. 0x1E5, /* gcc_aggre_usb2_prim_axi_clk */
  552. 0x1E3, /* gcc_aggre_usb3_prim_axi_clk */
  553. 0x1E4, /* gcc_aggre_usb3_sec_axi_clk */
  554. 0xED, /* gcc_ahb2phy0_clk */
  555. 0xEE, /* gcc_ahb2phy2_clk */
  556. 0xEF, /* gcc_ahb2phy3_clk */
  557. 0x114, /* gcc_boot_rom_ahb_clk */
  558. 0x86, /* gcc_camera_hf_axi_clk */
  559. 0x88, /* gcc_camera_sf_axi_clk */
  560. 0x8B, /* gcc_camera_throttle_xo_clk */
  561. 0x39, /* gcc_cfg_noc_usb2_prim_axi_clk */
  562. 0x37, /* gcc_cfg_noc_usb3_prim_axi_clk */
  563. 0x38, /* gcc_cfg_noc_usb3_sec_axi_clk */
  564. 0x13E, /* gcc_ddrss_gpu_axi_clk */
  565. 0x96, /* gcc_disp1_hf_axi_clk */
  566. 0x90, /* gcc_disp_hf_axi_clk */
  567. 0x204, /* gcc_emac0_axi_clk */
  568. 0x206, /* gcc_emac0_phy_aux_clk */
  569. 0x207, /* gcc_emac0_ptp_clk */
  570. 0x208, /* gcc_emac0_rgmii_clk */
  571. 0x205, /* gcc_emac0_slv_ahb_clk */
  572. 0x20D, /* gcc_emac1_axi_clk */
  573. 0x20F, /* gcc_emac1_phy_aux_clk */
  574. 0x210, /* gcc_emac1_ptp_clk */
  575. 0x211, /* gcc_emac1_rgmii_clk */
  576. 0x20E, /* gcc_emac1_slv_ahb_clk */
  577. 0x183, /* gcc_gp1_clk */
  578. 0x184, /* gcc_gp2_clk */
  579. 0x185, /* gcc_gp3_clk */
  580. 0x234, /* gcc_gp4_clk */
  581. 0x235, /* gcc_gp5_clk */
  582. 0x1FB, /* gcc_gpu_gpll0_clk_src */
  583. 0x1FC, /* gcc_gpu_gpll0_div_clk_src */
  584. 0x1F7, /* gcc_gpu_memnoc_gfx_clk */
  585. 0x1FA, /* gcc_gpu_snoc_dvm_gfx_clk */
  586. 0x1F4, /* gcc_gpu_tcu_throttle_ahb_clk */
  587. 0x1F8, /* gcc_gpu_tcu_throttle_clk */
  588. 0x198, /* gcc_pcie_0_aux_clk */
  589. 0x196, /* gcc_pcie_0_cfg_ahb_clk */
  590. 0x195, /* gcc_pcie_0_mstr_axi_clk */
  591. 0x197, /* gcc_pcie_0_phy_aux_clk */
  592. 0x19B, /* gcc_pcie_0_phy_rchng_clk */
  593. 0x199, /* gcc_pcie_0_pipe_clk */
  594. 0x19A, /* gcc_pcie_0_pipediv2_clk */
  595. 0x194, /* gcc_pcie_0_slv_axi_clk */
  596. 0x193, /* gcc_pcie_0_slv_q2a_axi_clk */
  597. 0x18B, /* gcc_pcie_1_aux_clk */
  598. 0x189, /* gcc_pcie_1_cfg_ahb_clk */
  599. 0x188, /* gcc_pcie_1_mstr_axi_clk */
  600. 0x18A, /* gcc_pcie_1_phy_aux_clk */
  601. 0x18E, /* gcc_pcie_1_phy_rchng_clk */
  602. 0x18C, /* gcc_pcie_1_pipe_clk */
  603. 0x18D, /* gcc_pcie_1_pipediv2_clk */
  604. 0x187, /* gcc_pcie_1_slv_axi_clk */
  605. 0x186, /* gcc_pcie_1_slv_q2a_axi_clk */
  606. 0x5D, /* gcc_pcie_throttle_cfg_clk */
  607. 0x10C, /* gcc_pdm2_clk */
  608. 0x10A, /* gcc_pdm_ahb_clk */
  609. 0x10B, /* gcc_pdm_xo4_clk */
  610. 0x84, /* gcc_qmip_camera_nrt_ahb_clk */
  611. 0x85, /* gcc_qmip_camera_rt_ahb_clk */
  612. 0x94, /* gcc_qmip_disp1_ahb_clk */
  613. 0x95, /* gcc_qmip_disp1_rot_ahb_clk */
  614. 0x8E, /* gcc_qmip_disp_ahb_clk */
  615. 0x8F, /* gcc_qmip_disp_rot_ahb_clk */
  616. 0x9C, /* gcc_qmip_video_cvp_ahb_clk */
  617. 0x9D, /* gcc_qmip_video_vcodec_ahb_clk */
  618. 0x9E, /* gcc_qmip_video_vcpu_ahb_clk */
  619. 0xF7, /* gcc_qupv3_wrap0_core_2x_clk */
  620. 0xF6, /* gcc_qupv3_wrap0_core_clk */
  621. 0xF8, /* gcc_qupv3_wrap0_s0_clk */
  622. 0xF9, /* gcc_qupv3_wrap0_s1_clk */
  623. 0xFA, /* gcc_qupv3_wrap0_s2_clk */
  624. 0xFB, /* gcc_qupv3_wrap0_s3_clk */
  625. 0xFC, /* gcc_qupv3_wrap0_s4_clk */
  626. 0xFD, /* gcc_qupv3_wrap0_s5_clk */
  627. 0xFE, /* gcc_qupv3_wrap0_s6_clk */
  628. 0x102, /* gcc_qupv3_wrap1_core_2x_clk */
  629. 0x101, /* gcc_qupv3_wrap1_core_clk */
  630. 0x103, /* gcc_qupv3_wrap1_s0_clk */
  631. 0x104, /* gcc_qupv3_wrap1_s1_clk */
  632. 0x105, /* gcc_qupv3_wrap1_s2_clk */
  633. 0x106, /* gcc_qupv3_wrap1_s3_clk */
  634. 0x107, /* gcc_qupv3_wrap1_s4_clk */
  635. 0x108, /* gcc_qupv3_wrap1_s5_clk */
  636. 0x109, /* gcc_qupv3_wrap1_s6_clk */
  637. 0x219, /* gcc_qupv3_wrap2_core_2x_clk */
  638. 0x218, /* gcc_qupv3_wrap2_core_clk */
  639. 0x21A, /* gcc_qupv3_wrap2_s0_clk */
  640. 0x21B, /* gcc_qupv3_wrap2_s1_clk */
  641. 0x21C, /* gcc_qupv3_wrap2_s2_clk */
  642. 0x21D, /* gcc_qupv3_wrap2_s3_clk */
  643. 0x21E, /* gcc_qupv3_wrap2_s4_clk */
  644. 0x21F, /* gcc_qupv3_wrap2_s5_clk */
  645. 0x220, /* gcc_qupv3_wrap2_s6_clk */
  646. 0x225, /* gcc_qupv3_wrap3_core_2x_clk */
  647. 0x223, /* gcc_qupv3_wrap3_core_clk */
  648. 0x227, /* gcc_qupv3_wrap3_qspi_clk */
  649. 0x226, /* gcc_qupv3_wrap3_s0_clk */
  650. 0xF4, /* gcc_qupv3_wrap_0_m_ahb_clk */
  651. 0xF5, /* gcc_qupv3_wrap_0_s_ahb_clk */
  652. 0xFF, /* gcc_qupv3_wrap_1_m_ahb_clk */
  653. 0x100, /* gcc_qupv3_wrap_1_s_ahb_clk */
  654. 0x216, /* gcc_qupv3_wrap_2_m_ahb_clk */
  655. 0x217, /* gcc_qupv3_wrap_2_s_ahb_clk */
  656. 0x221, /* gcc_qupv3_wrap_3_m_ahb_clk */
  657. 0x222, /* gcc_qupv3_wrap_3_s_ahb_clk */
  658. 0xF1, /* gcc_sdcc1_ahb_clk */
  659. 0xF0, /* gcc_sdcc1_apps_clk */
  660. 0xF3, /* gcc_sdcc1_ice_core_clk */
  661. 0x1F1, /* gcc_tscss_ahb_clk */
  662. 0x1F0, /* gcc_tscss_etu_clk */
  663. 0x1EF, /* gcc_tscss_global_cntr_clk */
  664. 0x19F, /* gcc_ufs_card_ahb_clk */
  665. 0x19E, /* gcc_ufs_card_axi_clk */
  666. 0x1A5, /* gcc_ufs_card_ice_core_clk */
  667. 0x1A6, /* gcc_ufs_card_phy_aux_clk */
  668. 0x1A1, /* gcc_ufs_card_rx_symbol_0_clk */
  669. 0x1A7, /* gcc_ufs_card_rx_symbol_1_clk */
  670. 0x1A0, /* gcc_ufs_card_tx_symbol_0_clk */
  671. 0x1A4, /* gcc_ufs_card_unipro_core_clk */
  672. 0x1AB, /* gcc_ufs_phy_ahb_clk */
  673. 0x1AA, /* gcc_ufs_phy_axi_clk */
  674. 0x1B1, /* gcc_ufs_phy_ice_core_clk */
  675. 0x1B2, /* gcc_ufs_phy_phy_aux_clk */
  676. 0x1AD, /* gcc_ufs_phy_rx_symbol_0_clk */
  677. 0x1B3, /* gcc_ufs_phy_rx_symbol_1_clk */
  678. 0x1AC, /* gcc_ufs_phy_tx_symbol_0_clk */
  679. 0x1B0, /* gcc_ufs_phy_unipro_core_clk */
  680. 0xE3, /* gcc_usb20_master_clk */
  681. 0xE5, /* gcc_usb20_mock_utmi_clk */
  682. 0xE4, /* gcc_usb20_sleep_clk */
  683. 0xD4, /* gcc_usb30_prim_master_clk */
  684. 0xD6, /* gcc_usb30_prim_mock_utmi_clk */
  685. 0xD5, /* gcc_usb30_prim_sleep_clk */
  686. 0xDD, /* gcc_usb30_sec_master_clk */
  687. 0xDF, /* gcc_usb30_sec_mock_utmi_clk */
  688. 0xDE, /* gcc_usb30_sec_sleep_clk */
  689. 0xD7, /* gcc_usb3_prim_phy_aux_clk */
  690. 0xD8, /* gcc_usb3_prim_phy_com_aux_clk */
  691. 0xD9, /* gcc_usb3_prim_phy_pipe_clk */
  692. 0xE0, /* gcc_usb3_sec_phy_aux_clk */
  693. 0xE1, /* gcc_usb3_sec_phy_com_aux_clk */
  694. 0xE2, /* gcc_usb3_sec_phy_pipe_clk */
  695. 0x9F, /* gcc_video_axi0_clk */
  696. 0xA0, /* gcc_video_axi1_clk */
  697. 0x1F6, /* gpu_cc_debug_mux */
  698. 0x2E, /* measure_only_cnoc_clk */
  699. 0x83, /* measure_only_gcc_camera_ahb_clk */
  700. 0x8A, /* measure_only_gcc_camera_xo_clk */
  701. 0x93, /* measure_only_gcc_disp1_ahb_clk */
  702. 0x97, /* measure_only_gcc_disp1_xo_clk */
  703. 0x8D, /* measure_only_gcc_disp_ahb_clk */
  704. 0x91, /* measure_only_gcc_disp_xo_clk */
  705. 0x1F3, /* measure_only_gcc_gpu_cfg_ahb_clk */
  706. 0x9B, /* measure_only_gcc_video_ahb_clk */
  707. 0xA1, /* measure_only_gcc_video_xo_clk */
  708. 0x1EB, /* measure_only_ipa_2x_clk */
  709. 0x145, /* measure_only_memnoc_clk */
  710. 0x19, /* measure_only_snoc_clk */
  711. 0x149, /* mc_cc_debug_mux or ddrss_gcc_debug_clk */
  712. 0xA2, /* video_cc_debug_mux */
  713. };
  714. static struct clk_debug_mux gcc_debug_mux = {
  715. .priv = &debug_mux_priv,
  716. .debug_offset = 0x72024,
  717. .post_div_offset = 0x6E000,
  718. .cbcr_offset = 0x6E004,
  719. .src_sel_mask = 0x1FFF,
  720. .src_sel_shift = 0,
  721. .post_div_mask = 0xF,
  722. .post_div_shift = 0,
  723. .post_div_val = 2,
  724. .mux_sels = gcc_debug_mux_sels,
  725. .hw.init = &(const struct clk_init_data){
  726. .name = "gcc_debug_mux",
  727. .ops = &clk_debug_mux_ops,
  728. .parent_names = gcc_debug_mux_parent_names,
  729. .num_parents = ARRAY_SIZE(gcc_debug_mux_parent_names),
  730. },
  731. };
  732. static const char *const gpu_cc_debug_mux_parent_names[] = {
  733. "gpu_cc_ahb_clk",
  734. "gpu_cc_crc_ahb_clk",
  735. "gpu_cc_cx_ff_clk",
  736. "gpu_cc_cx_gmu_clk",
  737. "gpu_cc_cx_snoc_dvm_clk",
  738. "gpu_cc_cxo_aon_clk",
  739. "gpu_cc_cxo_clk",
  740. "gpu_cc_demet_clk",
  741. "gpu_cc_hub_aon_clk",
  742. "gpu_cc_hub_cx_int_clk",
  743. "gpu_cc_memnoc_gfx_clk",
  744. "gpu_cc_sleep_clk",
  745. "measure_only_gcc_gpu_cfg_ahb_clk",
  746. "measure_only_gpu_cc_cb_clk",
  747. };
  748. static int gpu_cc_debug_mux_sels[] = {
  749. 0x16, /* gpu_cc_ahb_clk */
  750. 0x17, /* gpu_cc_crc_ahb_clk */
  751. 0x21, /* gpu_cc_cx_ff_clk */
  752. 0x1E, /* gpu_cc_cx_gmu_clk */
  753. 0x1B, /* gpu_cc_cx_snoc_dvm_clk */
  754. 0xB, /* gpu_cc_cxo_aon_clk */
  755. 0x1F, /* gpu_cc_cxo_clk */
  756. 0xD, /* gpu_cc_demet_clk */
  757. 0x2F, /* gpu_cc_hub_aon_clk */
  758. 0x20, /* gpu_cc_hub_cx_int_clk */
  759. 0x22, /* gpu_cc_memnoc_gfx_clk */
  760. 0x1C, /* gpu_cc_sleep_clk */
  761. 0x1, /* measure_only_gcc_gpu_cfg_ahb_clk */
  762. 0x2E, /* measure_only_gpu_cc_cb_clk */
  763. };
  764. static struct clk_debug_mux gpu_cc_debug_mux = {
  765. .priv = &debug_mux_priv,
  766. .debug_offset = 0x9564,
  767. .post_div_offset = 0x9270,
  768. .cbcr_offset = 0x9274,
  769. .src_sel_mask = 0xFF,
  770. .src_sel_shift = 0,
  771. .post_div_mask = 0xF,
  772. .post_div_shift = 0,
  773. .post_div_val = 2,
  774. .mux_sels = gpu_cc_debug_mux_sels,
  775. .hw.init = &(const struct clk_init_data){
  776. .name = "gpu_cc_debug_mux",
  777. .ops = &clk_debug_mux_ops,
  778. .parent_names = gpu_cc_debug_mux_parent_names,
  779. .num_parents = ARRAY_SIZE(gpu_cc_debug_mux_parent_names),
  780. },
  781. };
  782. static const char *const video_cc_debug_mux_parent_names[] = {
  783. "measure_only_video_cc_ahb_clk",
  784. "measure_only_video_cc_xo_clk",
  785. "video_cc_mvs0_clk",
  786. "video_cc_mvs0c_clk",
  787. "video_cc_mvs1_clk",
  788. "video_cc_mvs1c_clk",
  789. "video_cc_sleep_clk",
  790. };
  791. static int video_cc_debug_mux_sels[] = {
  792. 0x7, /* measure_only_video_cc_ahb_clk */
  793. 0xB, /* measure_only_video_cc_xo_clk */
  794. 0x3, /* video_cc_mvs0_clk */
  795. 0x1, /* video_cc_mvs0c_clk */
  796. 0x5, /* video_cc_mvs1_clk */
  797. 0x9, /* video_cc_mvs1c_clk */
  798. 0xC, /* video_cc_sleep_clk */
  799. };
  800. static struct clk_debug_mux video_cc_debug_mux = {
  801. .priv = &debug_mux_priv,
  802. .debug_offset = 0x9A4C,
  803. .post_div_offset = 0x80F0,
  804. .cbcr_offset = 0x80F4,
  805. .src_sel_mask = 0x3F,
  806. .src_sel_shift = 0,
  807. .post_div_mask = 0xF,
  808. .post_div_shift = 0,
  809. .post_div_val = 3,
  810. .mux_sels = video_cc_debug_mux_sels,
  811. .num_mux_sels = ARRAY_SIZE(video_cc_debug_mux_sels),
  812. .hw.init = &(const struct clk_init_data){
  813. .name = "video_cc_debug_mux",
  814. .ops = &clk_debug_mux_ops,
  815. .parent_names = video_cc_debug_mux_parent_names,
  816. .num_parents = ARRAY_SIZE(video_cc_debug_mux_parent_names),
  817. },
  818. };
  819. static const char *const mc_cc_debug_mux_parent_names[] = {
  820. "measure_only_mccc_clk",
  821. };
  822. static struct clk_debug_mux mc_cc_debug_mux = {
  823. .period_offset = 0x50,
  824. .hw.init = &(struct clk_init_data){
  825. .name = "mc_cc_debug_mux",
  826. .ops = &clk_debug_mux_ops,
  827. .parent_names = mc_cc_debug_mux_parent_names,
  828. .num_parents = ARRAY_SIZE(mc_cc_debug_mux_parent_names),
  829. },
  830. };
  831. static struct mux_regmap_names mux_list[] = {
  832. { .mux = &mc_cc_debug_mux, .regmap_name = "qcom,mccc" },
  833. { .mux = &video_cc_debug_mux, .regmap_name = "qcom,videocc" },
  834. { .mux = &gpu_cc_debug_mux, .regmap_name = "qcom,gpucc" },
  835. { .mux = &disp_cc_0_debug_mux, .regmap_name = "qcom,dispcc0" },
  836. { .mux = &disp_cc_1_debug_mux, .regmap_name = "qcom,dispcc1" },
  837. { .mux = &cam_cc_debug_mux, .regmap_name = "qcom,camcc" },
  838. { .mux = &apss_cc_debug_mux, .regmap_name = "qcom,apsscc" },
  839. { .mux = &gcc_debug_mux, .regmap_name = "qcom,gcc" },
  840. };
  841. static struct clk_dummy measure_only_apcs_cl1_l3_post_acd_clk = {
  842. .rrate = 1000,
  843. .hw.init = &(const struct clk_init_data){
  844. .name = "measure_only_apcs_cl1_l3_post_acd_clk",
  845. .ops = &clk_dummy_ops,
  846. },
  847. };
  848. static struct clk_dummy measure_only_apcs_cl0_gold_post_acd_clk = {
  849. .rrate = 1000,
  850. .hw.init = &(const struct clk_init_data){
  851. .name = "measure_only_apcs_cl0_gold_post_acd_clk",
  852. .ops = &clk_dummy_ops,
  853. },
  854. };
  855. static struct clk_dummy measure_only_apcs_cl1_goldplus_post_acd_clk = {
  856. .rrate = 1000,
  857. .hw.init = &(const struct clk_init_data){
  858. .name = "measure_only_apcs_cl1_goldplus_post_acd_clk",
  859. .ops = &clk_dummy_ops,
  860. },
  861. };
  862. static struct clk_dummy measure_only_apcs_cl0_l3_post_acd_clk = {
  863. .rrate = 1000,
  864. .hw.init = &(const struct clk_init_data){
  865. .name = "measure_only_apcs_cl0_l3_post_acd_clk",
  866. .ops = &clk_dummy_ops,
  867. },
  868. };
  869. static struct clk_dummy measure_only_cam_cc_gdsc_clk = {
  870. .rrate = 1000,
  871. .hw.init = &(const struct clk_init_data){
  872. .name = "measure_only_cam_cc_gdsc_clk",
  873. .ops = &clk_dummy_ops,
  874. },
  875. };
  876. static struct clk_dummy measure_only_cnoc_clk = {
  877. .rrate = 1000,
  878. .hw.init = &(const struct clk_init_data){
  879. .name = "measure_only_cnoc_clk",
  880. .ops = &clk_dummy_ops,
  881. },
  882. };
  883. static struct clk_dummy measure_only_gcc_camera_ahb_clk = {
  884. .rrate = 1000,
  885. .hw.init = &(const struct clk_init_data){
  886. .name = "measure_only_gcc_camera_ahb_clk",
  887. .ops = &clk_dummy_ops,
  888. },
  889. };
  890. static struct clk_dummy measure_only_gcc_camera_xo_clk = {
  891. .rrate = 1000,
  892. .hw.init = &(const struct clk_init_data){
  893. .name = "measure_only_gcc_camera_xo_clk",
  894. .ops = &clk_dummy_ops,
  895. },
  896. };
  897. static struct clk_dummy measure_only_gcc_disp1_ahb_clk = {
  898. .rrate = 1000,
  899. .hw.init = &(const struct clk_init_data){
  900. .name = "measure_only_gcc_disp1_ahb_clk",
  901. .ops = &clk_dummy_ops,
  902. },
  903. };
  904. static struct clk_dummy measure_only_gcc_disp1_xo_clk = {
  905. .rrate = 1000,
  906. .hw.init = &(const struct clk_init_data){
  907. .name = "measure_only_gcc_disp1_xo_clk",
  908. .ops = &clk_dummy_ops,
  909. },
  910. };
  911. static struct clk_dummy measure_only_gcc_disp_ahb_clk = {
  912. .rrate = 1000,
  913. .hw.init = &(const struct clk_init_data){
  914. .name = "measure_only_gcc_disp_ahb_clk",
  915. .ops = &clk_dummy_ops,
  916. },
  917. };
  918. static struct clk_dummy measure_only_gcc_disp_xo_clk = {
  919. .rrate = 1000,
  920. .hw.init = &(const struct clk_init_data){
  921. .name = "measure_only_gcc_disp_xo_clk",
  922. .ops = &clk_dummy_ops,
  923. },
  924. };
  925. static struct clk_dummy measure_only_gcc_gpu_cfg_ahb_clk = {
  926. .rrate = 1000,
  927. .hw.init = &(const struct clk_init_data){
  928. .name = "measure_only_gcc_gpu_cfg_ahb_clk",
  929. .ops = &clk_dummy_ops,
  930. },
  931. };
  932. static struct clk_dummy measure_only_gcc_video_ahb_clk = {
  933. .rrate = 1000,
  934. .hw.init = &(const struct clk_init_data){
  935. .name = "measure_only_gcc_video_ahb_clk",
  936. .ops = &clk_dummy_ops,
  937. },
  938. };
  939. static struct clk_dummy measure_only_gcc_video_xo_clk = {
  940. .rrate = 1000,
  941. .hw.init = &(const struct clk_init_data){
  942. .name = "measure_only_gcc_video_xo_clk",
  943. .ops = &clk_dummy_ops,
  944. },
  945. };
  946. static struct clk_dummy measure_only_gpu_cc_cb_clk = {
  947. .rrate = 1000,
  948. .hw.init = &(const struct clk_init_data){
  949. .name = "measure_only_gpu_cc_cb_clk",
  950. .ops = &clk_dummy_ops,
  951. },
  952. };
  953. static struct clk_dummy measure_only_ipa_2x_clk = {
  954. .rrate = 1000,
  955. .hw.init = &(const struct clk_init_data){
  956. .name = "measure_only_ipa_2x_clk",
  957. .ops = &clk_dummy_ops,
  958. },
  959. };
  960. static struct clk_dummy measure_only_mdss_0_disp_cc_xo_clk = {
  961. .rrate = 1000,
  962. .hw.init = &(const struct clk_init_data){
  963. .name = "measure_only_mdss_0_disp_cc_xo_clk",
  964. .ops = &clk_dummy_ops,
  965. },
  966. };
  967. static struct clk_dummy measure_only_mdss_1_disp_cc_xo_clk = {
  968. .rrate = 1000,
  969. .hw.init = &(const struct clk_init_data){
  970. .name = "measure_only_mdss_1_disp_cc_xo_clk",
  971. .ops = &clk_dummy_ops,
  972. },
  973. };
  974. static struct clk_dummy measure_only_memnoc_clk = {
  975. .rrate = 1000,
  976. .hw.init = &(const struct clk_init_data){
  977. .name = "measure_only_memnoc_clk",
  978. .ops = &clk_dummy_ops,
  979. },
  980. };
  981. static struct clk_dummy measure_only_mccc_clk = {
  982. .rrate = 1000,
  983. .hw.init = &(const struct clk_init_data){
  984. .name = "measure_only_mccc_clk",
  985. .ops = &clk_dummy_ops,
  986. },
  987. };
  988. static struct clk_dummy measure_only_snoc_clk = {
  989. .rrate = 1000,
  990. .hw.init = &(const struct clk_init_data){
  991. .name = "measure_only_snoc_clk",
  992. .ops = &clk_dummy_ops,
  993. },
  994. };
  995. static struct clk_dummy measure_only_video_cc_ahb_clk = {
  996. .rrate = 1000,
  997. .hw.init = &(const struct clk_init_data){
  998. .name = "measure_only_video_cc_ahb_clk",
  999. .ops = &clk_dummy_ops,
  1000. },
  1001. };
  1002. static struct clk_dummy measure_only_video_cc_xo_clk = {
  1003. .rrate = 1000,
  1004. .hw.init = &(const struct clk_init_data){
  1005. .name = "measure_only_video_cc_xo_clk",
  1006. .ops = &clk_dummy_ops,
  1007. },
  1008. };
  1009. static struct clk_hw *debugcc_lemans_hws[] = {
  1010. &measure_only_apcs_cl1_l3_post_acd_clk.hw,
  1011. &measure_only_apcs_cl0_gold_post_acd_clk.hw,
  1012. &measure_only_apcs_cl1_goldplus_post_acd_clk.hw,
  1013. &measure_only_apcs_cl0_l3_post_acd_clk.hw,
  1014. &measure_only_cam_cc_gdsc_clk.hw,
  1015. &measure_only_cnoc_clk.hw,
  1016. &measure_only_gcc_camera_ahb_clk.hw,
  1017. &measure_only_gcc_camera_xo_clk.hw,
  1018. &measure_only_gcc_disp1_ahb_clk.hw,
  1019. &measure_only_gcc_disp1_xo_clk.hw,
  1020. &measure_only_gcc_disp_ahb_clk.hw,
  1021. &measure_only_gcc_disp_xo_clk.hw,
  1022. &measure_only_gcc_gpu_cfg_ahb_clk.hw,
  1023. &measure_only_gcc_video_ahb_clk.hw,
  1024. &measure_only_gcc_video_xo_clk.hw,
  1025. &measure_only_gpu_cc_cb_clk.hw,
  1026. &measure_only_ipa_2x_clk.hw,
  1027. &measure_only_mdss_0_disp_cc_xo_clk.hw,
  1028. &measure_only_mdss_1_disp_cc_xo_clk.hw,
  1029. &measure_only_memnoc_clk.hw,
  1030. &measure_only_mccc_clk.hw,
  1031. &measure_only_snoc_clk.hw,
  1032. &measure_only_video_cc_ahb_clk.hw,
  1033. &measure_only_video_cc_xo_clk.hw,
  1034. };
  1035. static const struct of_device_id clk_debug_match_table[] = {
  1036. { .compatible = "qcom,lemans-debugcc" },
  1037. { }
  1038. };
  1039. static int clk_debug_lemans_probe(struct platform_device *pdev)
  1040. {
  1041. struct clk *clk;
  1042. int ret, i;
  1043. BUILD_BUG_ON(ARRAY_SIZE(apss_cc_debug_mux_parent_names) !=
  1044. ARRAY_SIZE(apss_cc_debug_mux_sels));
  1045. BUILD_BUG_ON(ARRAY_SIZE(cam_cc_debug_mux_parent_names) !=
  1046. ARRAY_SIZE(cam_cc_debug_mux_sels));
  1047. BUILD_BUG_ON(ARRAY_SIZE(disp_cc_0_debug_mux_parent_names) !=
  1048. ARRAY_SIZE(disp_cc_0_debug_mux_sels));
  1049. BUILD_BUG_ON(ARRAY_SIZE(disp_cc_1_debug_mux_parent_names) !=
  1050. ARRAY_SIZE(disp_cc_1_debug_mux_sels));
  1051. BUILD_BUG_ON(ARRAY_SIZE(gcc_debug_mux_parent_names) != ARRAY_SIZE(gcc_debug_mux_sels));
  1052. BUILD_BUG_ON(ARRAY_SIZE(gpu_cc_debug_mux_parent_names) !=
  1053. ARRAY_SIZE(gpu_cc_debug_mux_sels));
  1054. BUILD_BUG_ON(ARRAY_SIZE(video_cc_debug_mux_parent_names) !=
  1055. ARRAY_SIZE(video_cc_debug_mux_sels));
  1056. clk = devm_clk_get(&pdev->dev, "xo_clk_src");
  1057. if (IS_ERR(clk)) {
  1058. if (PTR_ERR(clk) != -EPROBE_DEFER)
  1059. dev_err(&pdev->dev, "Unable to get xo clock\n");
  1060. return PTR_ERR(clk);
  1061. }
  1062. debug_mux_priv.cxo = clk;
  1063. for (i = 0; i < ARRAY_SIZE(mux_list); i++) {
  1064. if (IS_ERR_OR_NULL(mux_list[i].mux->regmap)) {
  1065. ret = map_debug_bases(pdev, mux_list[i].regmap_name,
  1066. mux_list[i].mux);
  1067. if (ret == -EBADR)
  1068. continue;
  1069. else if (ret)
  1070. return ret;
  1071. }
  1072. }
  1073. for (i = 0; i < ARRAY_SIZE(debugcc_lemans_hws); i++) {
  1074. clk = devm_clk_register(&pdev->dev, debugcc_lemans_hws[i]);
  1075. if (IS_ERR(clk)) {
  1076. dev_err(&pdev->dev, "Unable to register %s, err:(%d)\n",
  1077. clk_hw_get_name(debugcc_lemans_hws[i]),
  1078. PTR_ERR(clk));
  1079. return PTR_ERR(clk);
  1080. }
  1081. }
  1082. for (i = 0; i < ARRAY_SIZE(mux_list); i++) {
  1083. if (!mux_list[i].mux->regmap)
  1084. continue;
  1085. ret = devm_clk_register_debug_mux(&pdev->dev, mux_list[i].mux);
  1086. if (ret) {
  1087. dev_err(&pdev->dev, "Unable to register mux clk %s, err:(%d)\n",
  1088. qcom_clk_hw_get_name(&mux_list[i].mux->hw),
  1089. ret);
  1090. return ret;
  1091. }
  1092. }
  1093. ret = clk_debug_measure_register(&gcc_debug_mux.hw);
  1094. if (ret) {
  1095. dev_err(&pdev->dev, "Could not register Measure clocks\n");
  1096. return ret;
  1097. }
  1098. dev_info(&pdev->dev, "Registered debug measure clocks\n");
  1099. return ret;
  1100. }
  1101. static struct platform_driver clk_debug_driver = {
  1102. .probe = clk_debug_lemans_probe,
  1103. .driver = {
  1104. .name = "lemans-debugcc",
  1105. .of_match_table = clk_debug_match_table,
  1106. },
  1107. };
  1108. static int __init clk_debug_lemans_init(void)
  1109. {
  1110. return platform_driver_register(&clk_debug_driver);
  1111. }
  1112. fs_initcall(clk_debug_lemans_init);
  1113. MODULE_DESCRIPTION("QTI DEBUG CC LEMANS Driver");
  1114. MODULE_LICENSE("GPL");