debugcc-pineapple.c 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #define pr_fmt(fmt) "clk: %s: " fmt, __func__
  6. #include <linux/clk.h>
  7. #include <linux/clk-provider.h>
  8. #include <linux/err.h>
  9. #include <linux/kernel.h>
  10. #include <linux/mfd/syscon.h>
  11. #include <linux/module.h>
  12. #include <linux/of.h>
  13. #include <linux/of_device.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/regmap.h>
  16. #include "clk-debug.h"
  17. #include "common.h"
  18. static struct measure_clk_data debug_mux_priv = {
  19. .ctl_reg = 0x62048,
  20. .status_reg = 0x6204C,
  21. .xo_div4_cbcr = 0x62008,
  22. };
  23. static const char *const apss_cc_debug_mux_parent_names[] = {
  24. "measure_only_apcs_gold_post_acd_clk",
  25. "measure_only_apcs_goldapc2_post_acd_clk",
  26. "measure_only_apcs_goldplus_post_acd_clk",
  27. "measure_only_apcs_l3_post_acd_clk",
  28. "measure_only_apcs_silver_post_acd_clk",
  29. };
  30. static int apss_cc_debug_mux_sels[] = {
  31. 0x4, /* measure_only_apcs_gold_post_acd_clk */
  32. 0x22, /* measure_only_apcs_goldapc2_post_acd_clk */
  33. 0x8, /* measure_only_apcs_goldplus_post_acd_clk */
  34. 0x6, /* measure_only_apcs_l3_post_acd_clk */
  35. 0x2, /* measure_only_apcs_silver_post_acd_clk */
  36. };
  37. static int apss_cc_debug_mux_pre_divs[] = {
  38. 0x8, /* measure_only_apcs_gold_post_acd_clk */
  39. 0x8, /* measure_only_apcs_goldapc2_post_acd_clk */
  40. 0x8, /* measure_only_apcs_goldplus_post_acd_clk */
  41. 0x4, /* measure_only_apcs_l3_post_acd_clk */
  42. 0x4, /* measure_only_apcs_silver_post_acd_clk */
  43. };
  44. static struct clk_debug_mux apss_cc_debug_mux = {
  45. .priv = &debug_mux_priv,
  46. .debug_offset = 0x20100,
  47. .post_div_offset = 0x20104,
  48. .cbcr_offset = 0x20108,
  49. .src_sel_mask = 0xFF,
  50. .src_sel_shift = 0,
  51. .post_div_mask = 0xF,
  52. .post_div_shift = 0,
  53. .post_div_val = 4,
  54. .mux_sels = apss_cc_debug_mux_sels,
  55. .num_mux_sels = ARRAY_SIZE(apss_cc_debug_mux_sels),
  56. .pre_div_vals = apss_cc_debug_mux_pre_divs,
  57. .hw.init = &(const struct clk_init_data){
  58. .name = "apss_cc_debug_mux",
  59. .ops = &clk_debug_mux_ops,
  60. .parent_names = apss_cc_debug_mux_parent_names,
  61. .num_parents = ARRAY_SIZE(apss_cc_debug_mux_parent_names),
  62. },
  63. };
  64. static const char *const cam_cc_debug_mux_parent_names[] = {
  65. "cam_cc_bps_ahb_clk",
  66. "cam_cc_bps_clk",
  67. "cam_cc_bps_fast_ahb_clk",
  68. "cam_cc_bps_shift_clk",
  69. "cam_cc_camnoc_axi_nrt_clk",
  70. "cam_cc_camnoc_axi_rt_clk",
  71. "cam_cc_camnoc_dcd_xo_clk",
  72. "cam_cc_camnoc_xo_clk",
  73. "cam_cc_cci_0_clk",
  74. "cam_cc_cci_1_clk",
  75. "cam_cc_cci_2_clk",
  76. "cam_cc_core_ahb_clk",
  77. "cam_cc_cpas_ahb_clk",
  78. "cam_cc_cpas_bps_clk",
  79. "cam_cc_cpas_cre_clk",
  80. "cam_cc_cpas_fast_ahb_clk",
  81. "cam_cc_cpas_ife_0_clk",
  82. "cam_cc_cpas_ife_1_clk",
  83. "cam_cc_cpas_ife_2_clk",
  84. "cam_cc_cpas_ife_lite_clk",
  85. "cam_cc_cpas_ipe_nps_clk",
  86. "cam_cc_cpas_sbi_clk",
  87. "cam_cc_cpas_sfe_0_clk",
  88. "cam_cc_cpas_sfe_1_clk",
  89. "cam_cc_cpas_sfe_2_clk",
  90. "cam_cc_cre_ahb_clk",
  91. "cam_cc_cre_clk",
  92. "cam_cc_csi0phytimer_clk",
  93. "cam_cc_csi1phytimer_clk",
  94. "cam_cc_csi2phytimer_clk",
  95. "cam_cc_csi3phytimer_clk",
  96. "cam_cc_csi4phytimer_clk",
  97. "cam_cc_csi5phytimer_clk",
  98. "cam_cc_csi6phytimer_clk",
  99. "cam_cc_csi7phytimer_clk",
  100. "cam_cc_csid_clk",
  101. "cam_cc_csid_csiphy_rx_clk",
  102. "cam_cc_csiphy0_clk",
  103. "cam_cc_csiphy1_clk",
  104. "cam_cc_csiphy2_clk",
  105. "cam_cc_csiphy3_clk",
  106. "cam_cc_csiphy4_clk",
  107. "cam_cc_csiphy5_clk",
  108. "cam_cc_csiphy6_clk",
  109. "cam_cc_csiphy7_clk",
  110. "cam_cc_drv_ahb_clk",
  111. "cam_cc_drv_xo_clk",
  112. "cam_cc_gdsc_clk",
  113. "cam_cc_icp_ahb_clk",
  114. "cam_cc_icp_clk",
  115. "cam_cc_ife_0_clk",
  116. "cam_cc_ife_0_fast_ahb_clk",
  117. "cam_cc_ife_0_shift_clk",
  118. "cam_cc_ife_1_clk",
  119. "cam_cc_ife_1_fast_ahb_clk",
  120. "cam_cc_ife_1_shift_clk",
  121. "cam_cc_ife_2_clk",
  122. "cam_cc_ife_2_fast_ahb_clk",
  123. "cam_cc_ife_2_shift_clk",
  124. "cam_cc_ife_lite_ahb_clk",
  125. "cam_cc_ife_lite_clk",
  126. "cam_cc_ife_lite_cphy_rx_clk",
  127. "cam_cc_ife_lite_csid_clk",
  128. "cam_cc_ipe_nps_ahb_clk",
  129. "cam_cc_ipe_nps_clk",
  130. "cam_cc_ipe_nps_fast_ahb_clk",
  131. "cam_cc_ipe_pps_clk",
  132. "cam_cc_ipe_pps_fast_ahb_clk",
  133. "cam_cc_ipe_shift_clk",
  134. "cam_cc_jpeg_1_clk",
  135. "cam_cc_jpeg_clk",
  136. "cam_cc_mclk0_clk",
  137. "cam_cc_mclk1_clk",
  138. "cam_cc_mclk2_clk",
  139. "cam_cc_mclk3_clk",
  140. "cam_cc_mclk4_clk",
  141. "cam_cc_mclk5_clk",
  142. "cam_cc_mclk6_clk",
  143. "cam_cc_mclk7_clk",
  144. "cam_cc_qdss_debug_clk",
  145. "cam_cc_qdss_debug_xo_clk",
  146. "cam_cc_sbi_clk",
  147. "cam_cc_sbi_fast_ahb_clk",
  148. "cam_cc_sbi_shift_clk",
  149. "cam_cc_sfe_0_clk",
  150. "cam_cc_sfe_0_fast_ahb_clk",
  151. "cam_cc_sfe_0_shift_clk",
  152. "cam_cc_sfe_1_clk",
  153. "cam_cc_sfe_1_fast_ahb_clk",
  154. "cam_cc_sfe_1_shift_clk",
  155. "cam_cc_sfe_2_clk",
  156. "cam_cc_sfe_2_fast_ahb_clk",
  157. "cam_cc_sfe_2_shift_clk",
  158. "cam_cc_sleep_clk",
  159. "cam_cc_titan_top_shift_clk",
  160. };
  161. static int cam_cc_debug_mux_sels[] = {
  162. 0x17, /* cam_cc_bps_ahb_clk */
  163. 0x18, /* cam_cc_bps_clk */
  164. 0x16, /* cam_cc_bps_fast_ahb_clk */
  165. 0x7B, /* cam_cc_bps_shift_clk */
  166. 0x86, /* cam_cc_camnoc_axi_nrt_clk */
  167. 0x49, /* cam_cc_camnoc_axi_rt_clk */
  168. 0x4A, /* cam_cc_camnoc_dcd_xo_clk */
  169. 0x60, /* cam_cc_camnoc_xo_clk */
  170. 0x44, /* cam_cc_cci_0_clk */
  171. 0x45, /* cam_cc_cci_1_clk */
  172. 0x61, /* cam_cc_cci_2_clk */
  173. 0x4D, /* cam_cc_core_ahb_clk */
  174. 0x46, /* cam_cc_cpas_ahb_clk */
  175. 0x19, /* cam_cc_cpas_bps_clk */
  176. 0x5D, /* cam_cc_cpas_cre_clk */
  177. 0x47, /* cam_cc_cpas_fast_ahb_clk */
  178. 0x25, /* cam_cc_cpas_ife_0_clk */
  179. 0x2A, /* cam_cc_cpas_ife_1_clk */
  180. 0x2F, /* cam_cc_cpas_ife_2_clk */
  181. 0x34, /* cam_cc_cpas_ife_lite_clk */
  182. 0x1B, /* cam_cc_cpas_ipe_nps_clk */
  183. 0x22, /* cam_cc_cpas_sbi_clk */
  184. 0x39, /* cam_cc_cpas_sfe_0_clk */
  185. 0x3D, /* cam_cc_cpas_sfe_1_clk */
  186. 0x78, /* cam_cc_cpas_sfe_2_clk */
  187. 0x5E, /* cam_cc_cre_ahb_clk */
  188. 0x5C, /* cam_cc_cre_clk */
  189. 0x9, /* cam_cc_csi0phytimer_clk */
  190. 0xC, /* cam_cc_csi1phytimer_clk */
  191. 0xE, /* cam_cc_csi2phytimer_clk */
  192. 0x10, /* cam_cc_csi3phytimer_clk */
  193. 0x12, /* cam_cc_csi4phytimer_clk */
  194. 0x14, /* cam_cc_csi5phytimer_clk */
  195. 0x58, /* cam_cc_csi6phytimer_clk */
  196. 0x5A, /* cam_cc_csi7phytimer_clk */
  197. 0x48, /* cam_cc_csid_clk */
  198. 0xB, /* cam_cc_csid_csiphy_rx_clk */
  199. 0xA, /* cam_cc_csiphy0_clk */
  200. 0xD, /* cam_cc_csiphy1_clk */
  201. 0xF, /* cam_cc_csiphy2_clk */
  202. 0x11, /* cam_cc_csiphy3_clk */
  203. 0x13, /* cam_cc_csiphy4_clk */
  204. 0x15, /* cam_cc_csiphy5_clk */
  205. 0x59, /* cam_cc_csiphy6_clk */
  206. 0x5B, /* cam_cc_csiphy7_clk */
  207. 0x75, /* cam_cc_drv_ahb_clk */
  208. 0x74, /* cam_cc_drv_xo_clk */
  209. 0x4E, /* cam_cc_gdsc_clk */
  210. 0x43, /* cam_cc_icp_ahb_clk */
  211. 0x42, /* cam_cc_icp_clk */
  212. 0x24, /* cam_cc_ife_0_clk */
  213. 0x28, /* cam_cc_ife_0_fast_ahb_clk */
  214. 0x7F, /* cam_cc_ife_0_shift_clk */
  215. 0x29, /* cam_cc_ife_1_clk */
  216. 0x2D, /* cam_cc_ife_1_fast_ahb_clk */
  217. 0x80, /* cam_cc_ife_1_shift_clk */
  218. 0x2E, /* cam_cc_ife_2_clk */
  219. 0x32, /* cam_cc_ife_2_fast_ahb_clk */
  220. 0x81, /* cam_cc_ife_2_shift_clk */
  221. 0x37, /* cam_cc_ife_lite_ahb_clk */
  222. 0x33, /* cam_cc_ife_lite_clk */
  223. 0x36, /* cam_cc_ife_lite_cphy_rx_clk */
  224. 0x35, /* cam_cc_ife_lite_csid_clk */
  225. 0x1E, /* cam_cc_ipe_nps_ahb_clk */
  226. 0x1A, /* cam_cc_ipe_nps_clk */
  227. 0x1F, /* cam_cc_ipe_nps_fast_ahb_clk */
  228. 0x1C, /* cam_cc_ipe_pps_clk */
  229. 0x20, /* cam_cc_ipe_pps_fast_ahb_clk */
  230. 0x7C, /* cam_cc_ipe_shift_clk */
  231. 0x5F, /* cam_cc_jpeg_1_clk */
  232. 0x40, /* cam_cc_jpeg_clk */
  233. 0x1, /* cam_cc_mclk0_clk */
  234. 0x2, /* cam_cc_mclk1_clk */
  235. 0x3, /* cam_cc_mclk2_clk */
  236. 0x4, /* cam_cc_mclk3_clk */
  237. 0x5, /* cam_cc_mclk4_clk */
  238. 0x6, /* cam_cc_mclk5_clk */
  239. 0x7, /* cam_cc_mclk6_clk */
  240. 0x8, /* cam_cc_mclk7_clk */
  241. 0x4B, /* cam_cc_qdss_debug_clk */
  242. 0x4C, /* cam_cc_qdss_debug_xo_clk */
  243. 0x21, /* cam_cc_sbi_clk */
  244. 0x23, /* cam_cc_sbi_fast_ahb_clk */
  245. 0x7E, /* cam_cc_sbi_shift_clk */
  246. 0x38, /* cam_cc_sfe_0_clk */
  247. 0x3B, /* cam_cc_sfe_0_fast_ahb_clk */
  248. 0x82, /* cam_cc_sfe_0_shift_clk */
  249. 0x3C, /* cam_cc_sfe_1_clk */
  250. 0x3F, /* cam_cc_sfe_1_fast_ahb_clk */
  251. 0x83, /* cam_cc_sfe_1_shift_clk */
  252. 0x76, /* cam_cc_sfe_2_clk */
  253. 0x7A, /* cam_cc_sfe_2_fast_ahb_clk */
  254. 0x84, /* cam_cc_sfe_2_shift_clk */
  255. 0x4F, /* cam_cc_sleep_clk */
  256. 0x85, /* cam_cc_titan_top_shift_clk */
  257. };
  258. static struct clk_debug_mux cam_cc_debug_mux = {
  259. .priv = &debug_mux_priv,
  260. .debug_offset = 0x16000,
  261. .post_div_offset = 0x14004,
  262. .cbcr_offset = 0x14008,
  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 = cam_cc_debug_mux_sels,
  269. .num_mux_sels = ARRAY_SIZE(cam_cc_debug_mux_sels),
  270. .hw.init = &(const struct clk_init_data){
  271. .name = "cam_cc_debug_mux",
  272. .ops = &clk_debug_mux_ops,
  273. .parent_names = cam_cc_debug_mux_parent_names,
  274. .num_parents = ARRAY_SIZE(cam_cc_debug_mux_parent_names),
  275. },
  276. };
  277. static const char *const disp_cc_debug_mux_parent_names[] = {
  278. "disp_cc_mdss_accu_clk",
  279. "disp_cc_mdss_ahb1_clk",
  280. "disp_cc_mdss_ahb_clk",
  281. "disp_cc_mdss_byte0_clk",
  282. "disp_cc_mdss_byte0_intf_clk",
  283. "disp_cc_mdss_byte1_clk",
  284. "disp_cc_mdss_byte1_intf_clk",
  285. "disp_cc_mdss_dptx0_aux_clk",
  286. "disp_cc_mdss_dptx0_crypto_clk",
  287. "disp_cc_mdss_dptx0_link_clk",
  288. "disp_cc_mdss_dptx0_link_intf_clk",
  289. "disp_cc_mdss_dptx0_pixel0_clk",
  290. "disp_cc_mdss_dptx0_pixel1_clk",
  291. "disp_cc_mdss_dptx0_usb_router_link_intf_clk",
  292. "disp_cc_mdss_dptx1_aux_clk",
  293. "disp_cc_mdss_dptx1_crypto_clk",
  294. "disp_cc_mdss_dptx1_link_clk",
  295. "disp_cc_mdss_dptx1_link_intf_clk",
  296. "disp_cc_mdss_dptx1_pixel0_clk",
  297. "disp_cc_mdss_dptx1_pixel1_clk",
  298. "disp_cc_mdss_dptx1_usb_router_link_intf_clk",
  299. "disp_cc_mdss_dptx2_aux_clk",
  300. "disp_cc_mdss_dptx2_crypto_clk",
  301. "disp_cc_mdss_dptx2_link_clk",
  302. "disp_cc_mdss_dptx2_link_intf_clk",
  303. "disp_cc_mdss_dptx2_pixel0_clk",
  304. "disp_cc_mdss_dptx2_pixel1_clk",
  305. "disp_cc_mdss_dptx3_aux_clk",
  306. "disp_cc_mdss_dptx3_crypto_clk",
  307. "disp_cc_mdss_dptx3_link_clk",
  308. "disp_cc_mdss_dptx3_link_intf_clk",
  309. "disp_cc_mdss_dptx3_pixel0_clk",
  310. "disp_cc_mdss_esc0_clk",
  311. "disp_cc_mdss_esc1_clk",
  312. "disp_cc_mdss_mdp1_clk",
  313. "disp_cc_mdss_mdp_clk",
  314. "disp_cc_mdss_mdp_lut1_clk",
  315. "disp_cc_mdss_mdp_lut_clk",
  316. "disp_cc_mdss_non_gdsc_ahb_clk",
  317. "disp_cc_mdss_pclk0_clk",
  318. "disp_cc_mdss_pclk1_clk",
  319. "disp_cc_mdss_rscc_ahb_clk",
  320. "disp_cc_mdss_rscc_vsync_clk",
  321. "disp_cc_mdss_vsync1_clk",
  322. "disp_cc_mdss_vsync_clk",
  323. "disp_cc_sleep_clk",
  324. "disp_cc_xo_clk",
  325. };
  326. static int disp_cc_debug_mux_sels[] = {
  327. 0x46, /* disp_cc_mdss_accu_clk */
  328. 0x37, /* disp_cc_mdss_ahb1_clk */
  329. 0x33, /* disp_cc_mdss_ahb_clk */
  330. 0x14, /* disp_cc_mdss_byte0_clk */
  331. 0x15, /* disp_cc_mdss_byte0_intf_clk */
  332. 0x16, /* disp_cc_mdss_byte1_clk */
  333. 0x17, /* disp_cc_mdss_byte1_intf_clk */
  334. 0x20, /* disp_cc_mdss_dptx0_aux_clk */
  335. 0x1D, /* disp_cc_mdss_dptx0_crypto_clk */
  336. 0x1A, /* disp_cc_mdss_dptx0_link_clk */
  337. 0x1C, /* disp_cc_mdss_dptx0_link_intf_clk */
  338. 0x1E, /* disp_cc_mdss_dptx0_pixel0_clk */
  339. 0x1F, /* disp_cc_mdss_dptx0_pixel1_clk */
  340. 0x1B, /* disp_cc_mdss_dptx0_usb_router_link_intf_clk */
  341. 0x27, /* disp_cc_mdss_dptx1_aux_clk */
  342. 0x26, /* disp_cc_mdss_dptx1_crypto_clk */
  343. 0x23, /* disp_cc_mdss_dptx1_link_clk */
  344. 0x25, /* disp_cc_mdss_dptx1_link_intf_clk */
  345. 0x21, /* disp_cc_mdss_dptx1_pixel0_clk */
  346. 0x22, /* disp_cc_mdss_dptx1_pixel1_clk */
  347. 0x24, /* disp_cc_mdss_dptx1_usb_router_link_intf_clk */
  348. 0x2D, /* disp_cc_mdss_dptx2_aux_clk */
  349. 0x2C, /* disp_cc_mdss_dptx2_crypto_clk */
  350. 0x2A, /* disp_cc_mdss_dptx2_link_clk */
  351. 0x2B, /* disp_cc_mdss_dptx2_link_intf_clk */
  352. 0x28, /* disp_cc_mdss_dptx2_pixel0_clk */
  353. 0x29, /* disp_cc_mdss_dptx2_pixel1_clk */
  354. 0x31, /* disp_cc_mdss_dptx3_aux_clk */
  355. 0x32, /* disp_cc_mdss_dptx3_crypto_clk */
  356. 0x2F, /* disp_cc_mdss_dptx3_link_clk */
  357. 0x30, /* disp_cc_mdss_dptx3_link_intf_clk */
  358. 0x2E, /* disp_cc_mdss_dptx3_pixel0_clk */
  359. 0x18, /* disp_cc_mdss_esc0_clk */
  360. 0x19, /* disp_cc_mdss_esc1_clk */
  361. 0x34, /* disp_cc_mdss_mdp1_clk */
  362. 0x11, /* disp_cc_mdss_mdp_clk */
  363. 0x35, /* disp_cc_mdss_mdp_lut1_clk */
  364. 0x12, /* disp_cc_mdss_mdp_lut_clk */
  365. 0x38, /* disp_cc_mdss_non_gdsc_ahb_clk */
  366. 0xF, /* disp_cc_mdss_pclk0_clk */
  367. 0x10, /* disp_cc_mdss_pclk1_clk */
  368. 0x3A, /* disp_cc_mdss_rscc_ahb_clk */
  369. 0x39, /* disp_cc_mdss_rscc_vsync_clk */
  370. 0x36, /* disp_cc_mdss_vsync1_clk */
  371. 0x13, /* disp_cc_mdss_vsync_clk */
  372. 0x47, /* disp_cc_sleep_clk */
  373. 0x45, /* disp_cc_xo_clk */
  374. };
  375. static struct clk_debug_mux disp_cc_debug_mux = {
  376. .priv = &debug_mux_priv,
  377. .debug_offset = 0x11000,
  378. .post_div_offset = 0xD000,
  379. .cbcr_offset = 0xD004,
  380. .src_sel_mask = 0x1FF,
  381. .src_sel_shift = 0,
  382. .post_div_mask = 0xF,
  383. .post_div_shift = 0,
  384. .post_div_val = 4,
  385. .mux_sels = disp_cc_debug_mux_sels,
  386. .num_mux_sels = ARRAY_SIZE(disp_cc_debug_mux_sels),
  387. .hw.init = &(const struct clk_init_data){
  388. .name = "disp_cc_debug_mux",
  389. .ops = &clk_debug_mux_ops,
  390. .parent_names = disp_cc_debug_mux_parent_names,
  391. .num_parents = ARRAY_SIZE(disp_cc_debug_mux_parent_names),
  392. },
  393. };
  394. static const char *const gcc_debug_mux_parent_names[] = {
  395. "apss_cc_debug_mux",
  396. "cam_cc_debug_mux",
  397. "disp_cc_debug_mux",
  398. "gcc_aggre_noc_pcie_axi_clk",
  399. "gcc_aggre_ufs_phy_axi_clk",
  400. "gcc_aggre_usb3_prim_axi_clk",
  401. "gcc_boot_rom_ahb_clk",
  402. "gcc_camera_ahb_clk",
  403. "gcc_camera_hf_axi_clk",
  404. "gcc_camera_sf_axi_clk",
  405. "gcc_camera_xo_clk",
  406. "gcc_cfg_noc_pcie_anoc_ahb_clk",
  407. "gcc_cfg_noc_usb3_prim_axi_clk",
  408. "gcc_cnoc_pcie_sf_axi_clk",
  409. "gcc_cpuss_ubwcp_clk",
  410. "gcc_ddrss_gpu_axi_clk",
  411. "gcc_ddrss_pcie_sf_qtb_clk",
  412. "gcc_ddrss_ubwcp_clk",
  413. "gcc_disp_ahb_clk",
  414. "gcc_disp_hf_axi_clk",
  415. "gcc_disp_xo_clk",
  416. "gcc_gp1_clk",
  417. "gcc_gp2_clk",
  418. "gcc_gp3_clk",
  419. "gcc_gpu_cfg_ahb_clk",
  420. "gcc_gpu_gpll0_clk_src",
  421. "gcc_gpu_gpll0_div_clk_src",
  422. "gcc_gpu_memnoc_gfx_clk",
  423. "gcc_gpu_snoc_dvm_gfx_clk",
  424. "gcc_pcie_0_aux_clk",
  425. "gcc_pcie_0_cfg_ahb_clk",
  426. "gcc_pcie_0_mstr_axi_clk",
  427. "gcc_pcie_0_phy_rchng_clk",
  428. "gcc_pcie_0_pipe_clk",
  429. "gcc_pcie_0_slv_axi_clk",
  430. "gcc_pcie_0_slv_q2a_axi_clk",
  431. "gcc_pcie_1_aux_clk",
  432. "gcc_pcie_1_cfg_ahb_clk",
  433. "gcc_pcie_1_mstr_axi_clk",
  434. "gcc_pcie_1_phy_aux_clk",
  435. "gcc_pcie_1_phy_rchng_clk",
  436. "gcc_pcie_1_pipe_clk",
  437. "gcc_pcie_1_slv_axi_clk",
  438. "gcc_pcie_1_slv_q2a_axi_clk",
  439. "gcc_pdm2_clk",
  440. "gcc_pdm_ahb_clk",
  441. "gcc_pdm_xo4_clk",
  442. "gcc_qmip_camera_nrt_ahb_clk",
  443. "gcc_qmip_camera_rt_ahb_clk",
  444. "gcc_qmip_disp_ahb_clk",
  445. "gcc_qmip_gpu_ahb_clk",
  446. "gcc_qmip_pcie_ahb_clk",
  447. "gcc_qmip_video_cv_cpu_ahb_clk",
  448. "gcc_qmip_video_cvp_ahb_clk",
  449. "gcc_qmip_video_v_cpu_ahb_clk",
  450. "gcc_qmip_video_vcodec_ahb_clk",
  451. "gcc_qupv3_i2c_core_clk",
  452. "gcc_qupv3_i2c_s0_clk",
  453. "gcc_qupv3_i2c_s1_clk",
  454. "gcc_qupv3_i2c_s2_clk",
  455. "gcc_qupv3_i2c_s3_clk",
  456. "gcc_qupv3_i2c_s4_clk",
  457. "gcc_qupv3_i2c_s5_clk",
  458. "gcc_qupv3_i2c_s6_clk",
  459. "gcc_qupv3_i2c_s7_clk",
  460. "gcc_qupv3_i2c_s8_clk",
  461. "gcc_qupv3_i2c_s9_clk",
  462. "gcc_qupv3_i2c_s_ahb_clk",
  463. "gcc_qupv3_wrap1_core_2x_clk",
  464. "gcc_qupv3_wrap1_core_clk",
  465. "gcc_qupv3_wrap1_qspi_ref_clk",
  466. "gcc_qupv3_wrap1_s0_clk",
  467. "gcc_qupv3_wrap1_s1_clk",
  468. "gcc_qupv3_wrap1_s2_clk",
  469. "gcc_qupv3_wrap1_s3_clk",
  470. "gcc_qupv3_wrap1_s4_clk",
  471. "gcc_qupv3_wrap1_s5_clk",
  472. "gcc_qupv3_wrap1_s6_clk",
  473. "gcc_qupv3_wrap1_s7_clk",
  474. "gcc_qupv3_wrap2_core_2x_clk",
  475. "gcc_qupv3_wrap2_core_clk",
  476. "gcc_qupv3_wrap2_ibi_ctrl_2_clk",
  477. "gcc_qupv3_wrap2_ibi_ctrl_3_clk",
  478. "gcc_qupv3_wrap2_s0_clk",
  479. "gcc_qupv3_wrap2_s1_clk",
  480. "gcc_qupv3_wrap2_s2_clk",
  481. "gcc_qupv3_wrap2_s3_clk",
  482. "gcc_qupv3_wrap2_s4_clk",
  483. "gcc_qupv3_wrap2_s5_clk",
  484. "gcc_qupv3_wrap2_s6_clk",
  485. "gcc_qupv3_wrap2_s7_clk",
  486. "gcc_qupv3_wrap3_core_2x_clk",
  487. "gcc_qupv3_wrap3_core_clk",
  488. "gcc_qupv3_wrap3_qspi_ref_clk",
  489. "gcc_qupv3_wrap3_s0_clk",
  490. "gcc_qupv3_wrap_1_m_ahb_clk",
  491. "gcc_qupv3_wrap_1_s_ahb_clk",
  492. "gcc_qupv3_wrap_2_ibi_2_ahb_clk",
  493. "gcc_qupv3_wrap_2_ibi_3_ahb_clk",
  494. "gcc_qupv3_wrap_2_m_ahb_clk",
  495. "gcc_qupv3_wrap_2_s_ahb_clk",
  496. "gcc_qupv3_wrap_3_m_ahb_clk",
  497. "gcc_qupv3_wrap_3_s_ahb_clk",
  498. "gcc_sdcc2_ahb_clk",
  499. "gcc_sdcc2_apps_clk",
  500. "gcc_sdcc4_ahb_clk",
  501. "gcc_sdcc4_apps_clk",
  502. "gcc_ufs_phy_ahb_clk",
  503. "gcc_ufs_phy_axi_clk",
  504. "gcc_ufs_phy_ice_core_clk",
  505. "gcc_ufs_phy_phy_aux_clk",
  506. "gcc_ufs_phy_rx_symbol_0_clk",
  507. "gcc_ufs_phy_rx_symbol_1_clk",
  508. "gcc_ufs_phy_tx_symbol_0_clk",
  509. "gcc_ufs_phy_unipro_core_clk",
  510. "gcc_usb30_prim_master_clk",
  511. "gcc_usb30_prim_mock_utmi_clk",
  512. "gcc_usb30_prim_sleep_clk",
  513. "gcc_usb3_prim_phy_aux_clk",
  514. "gcc_usb3_prim_phy_com_aux_clk",
  515. "gcc_usb3_prim_phy_pipe_clk",
  516. "gcc_video_ahb_clk",
  517. "gcc_video_axi0_clk",
  518. "gcc_video_axi1_clk",
  519. "gcc_video_xo_clk",
  520. "gpu_cc_debug_mux",
  521. "mc_cc_debug_mux",
  522. "measure_only_cnoc_clk",
  523. "measure_only_ipa_2x_clk",
  524. "measure_only_memnoc_clk",
  525. "measure_only_snoc_clk",
  526. "pcie_0_pipe_clk",
  527. "pcie_1_phy_aux_clk",
  528. "pcie_1_pipe_clk",
  529. "ufs_phy_rx_symbol_0_clk",
  530. "ufs_phy_rx_symbol_1_clk",
  531. "ufs_phy_tx_symbol_0_clk",
  532. "usb3_phy_wrapper_gcc_usb30_pipe_clk",
  533. "video_cc_debug_mux",
  534. };
  535. static int gcc_debug_mux_sels[] = {
  536. 0x135, /* apss_cc_debug_mux */
  537. 0x6A, /* cam_cc_debug_mux */
  538. 0x6F, /* disp_cc_debug_mux */
  539. 0x3F, /* gcc_aggre_noc_pcie_axi_clk */
  540. 0x41, /* gcc_aggre_ufs_phy_axi_clk */
  541. 0x40, /* gcc_aggre_usb3_prim_axi_clk */
  542. 0xE2, /* gcc_boot_rom_ahb_clk */
  543. 0x62, /* gcc_camera_ahb_clk */
  544. 0x65, /* gcc_camera_hf_axi_clk */
  545. 0x67, /* gcc_camera_sf_axi_clk */
  546. 0x69, /* gcc_camera_xo_clk */
  547. 0x2C, /* gcc_cfg_noc_pcie_anoc_ahb_clk */
  548. 0x1E, /* gcc_cfg_noc_usb3_prim_axi_clk */
  549. 0x18, /* gcc_cnoc_pcie_sf_axi_clk */
  550. 0x132, /* gcc_cpuss_ubwcp_clk */
  551. 0xFE, /* gcc_ddrss_gpu_axi_clk */
  552. 0xFF, /* gcc_ddrss_pcie_sf_qtb_clk */
  553. 0x107, /* gcc_ddrss_ubwcp_clk */
  554. 0x6B, /* gcc_disp_ahb_clk */
  555. 0x6D, /* gcc_disp_hf_axi_clk */
  556. 0x6E, /* gcc_disp_xo_clk */
  557. 0x144, /* gcc_gp1_clk */
  558. 0x145, /* gcc_gp2_clk */
  559. 0x146, /* gcc_gp3_clk */
  560. 0x18A, /* gcc_gpu_cfg_ahb_clk */
  561. 0x191, /* gcc_gpu_gpll0_clk_src */
  562. 0x192, /* gcc_gpu_gpll0_div_clk_src */
  563. 0x18E, /* gcc_gpu_memnoc_gfx_clk */
  564. 0x190, /* gcc_gpu_snoc_dvm_gfx_clk */
  565. 0x14C, /* gcc_pcie_0_aux_clk */
  566. 0x14B, /* gcc_pcie_0_cfg_ahb_clk */
  567. 0x14A, /* gcc_pcie_0_mstr_axi_clk */
  568. 0x14E, /* gcc_pcie_0_phy_rchng_clk */
  569. 0x14D, /* gcc_pcie_0_pipe_clk */
  570. 0x149, /* gcc_pcie_0_slv_axi_clk */
  571. 0x148, /* gcc_pcie_0_slv_q2a_axi_clk */
  572. 0x155, /* gcc_pcie_1_aux_clk */
  573. 0x154, /* gcc_pcie_1_cfg_ahb_clk */
  574. 0x153, /* gcc_pcie_1_mstr_axi_clk */
  575. 0x156, /* gcc_pcie_1_phy_aux_clk */
  576. 0x158, /* gcc_pcie_1_phy_rchng_clk */
  577. 0x157, /* gcc_pcie_1_pipe_clk */
  578. 0x152, /* gcc_pcie_1_slv_axi_clk */
  579. 0x151, /* gcc_pcie_1_slv_q2a_axi_clk */
  580. 0xD3, /* gcc_pdm2_clk */
  581. 0xD1, /* gcc_pdm_ahb_clk */
  582. 0xD2, /* gcc_pdm_xo4_clk */
  583. 0x63, /* gcc_qmip_camera_nrt_ahb_clk */
  584. 0x64, /* gcc_qmip_camera_rt_ahb_clk */
  585. 0x6C, /* gcc_qmip_disp_ahb_clk */
  586. 0x18B, /* gcc_qmip_gpu_ahb_clk */
  587. 0x147, /* gcc_qmip_pcie_ahb_clk */
  588. 0x74, /* gcc_qmip_video_cv_cpu_ahb_clk */
  589. 0x71, /* gcc_qmip_video_cvp_ahb_clk */
  590. 0x73, /* gcc_qmip_video_v_cpu_ahb_clk */
  591. 0x72, /* gcc_qmip_video_vcodec_ahb_clk */
  592. 0xA3, /* gcc_qupv3_i2c_core_clk */
  593. 0xA4, /* gcc_qupv3_i2c_s0_clk */
  594. 0xA5, /* gcc_qupv3_i2c_s1_clk */
  595. 0xA6, /* gcc_qupv3_i2c_s2_clk */
  596. 0xA7, /* gcc_qupv3_i2c_s3_clk */
  597. 0xA8, /* gcc_qupv3_i2c_s4_clk */
  598. 0xA9, /* gcc_qupv3_i2c_s5_clk */
  599. 0xAA, /* gcc_qupv3_i2c_s6_clk */
  600. 0xAB, /* gcc_qupv3_i2c_s7_clk */
  601. 0xAC, /* gcc_qupv3_i2c_s8_clk */
  602. 0xAD, /* gcc_qupv3_i2c_s9_clk */
  603. 0xA2, /* gcc_qupv3_i2c_s_ahb_clk */
  604. 0xB1, /* gcc_qupv3_wrap1_core_2x_clk */
  605. 0xB0, /* gcc_qupv3_wrap1_core_clk */
  606. 0xBA, /* gcc_qupv3_wrap1_qspi_ref_clk */
  607. 0xB2, /* gcc_qupv3_wrap1_s0_clk */
  608. 0xB3, /* gcc_qupv3_wrap1_s1_clk */
  609. 0xB4, /* gcc_qupv3_wrap1_s2_clk */
  610. 0xB5, /* gcc_qupv3_wrap1_s3_clk */
  611. 0xB6, /* gcc_qupv3_wrap1_s4_clk */
  612. 0xB7, /* gcc_qupv3_wrap1_s5_clk */
  613. 0xB8, /* gcc_qupv3_wrap1_s6_clk */
  614. 0xB9, /* gcc_qupv3_wrap1_s7_clk */
  615. 0xBE, /* gcc_qupv3_wrap2_core_2x_clk */
  616. 0xBD, /* gcc_qupv3_wrap2_core_clk */
  617. 0xC9, /* gcc_qupv3_wrap2_ibi_ctrl_2_clk */
  618. 0xCA, /* gcc_qupv3_wrap2_ibi_ctrl_3_clk */
  619. 0xBF, /* gcc_qupv3_wrap2_s0_clk */
  620. 0xC0, /* gcc_qupv3_wrap2_s1_clk */
  621. 0xC1, /* gcc_qupv3_wrap2_s2_clk */
  622. 0xC2, /* gcc_qupv3_wrap2_s3_clk */
  623. 0xC3, /* gcc_qupv3_wrap2_s4_clk */
  624. 0xC4, /* gcc_qupv3_wrap2_s5_clk */
  625. 0xC5, /* gcc_qupv3_wrap2_s6_clk */
  626. 0xC6, /* gcc_qupv3_wrap2_s7_clk */
  627. 0xCE, /* gcc_qupv3_wrap3_core_2x_clk */
  628. 0xCD, /* gcc_qupv3_wrap3_core_clk */
  629. 0xD0, /* gcc_qupv3_wrap3_qspi_ref_clk */
  630. 0xCF, /* gcc_qupv3_wrap3_s0_clk */
  631. 0xAE, /* gcc_qupv3_wrap_1_m_ahb_clk */
  632. 0xAF, /* gcc_qupv3_wrap_1_s_ahb_clk */
  633. 0xC7, /* gcc_qupv3_wrap_2_ibi_2_ahb_clk */
  634. 0xC8, /* gcc_qupv3_wrap_2_ibi_3_ahb_clk */
  635. 0xBB, /* gcc_qupv3_wrap_2_m_ahb_clk */
  636. 0xBC, /* gcc_qupv3_wrap_2_s_ahb_clk */
  637. 0xCB, /* gcc_qupv3_wrap_3_m_ahb_clk */
  638. 0xCC, /* gcc_qupv3_wrap_3_s_ahb_clk */
  639. 0x9D, /* gcc_sdcc2_ahb_clk */
  640. 0x9C, /* gcc_sdcc2_apps_clk */
  641. 0xA0, /* gcc_sdcc4_ahb_clk */
  642. 0x9F, /* gcc_sdcc4_apps_clk */
  643. 0x15D, /* gcc_ufs_phy_ahb_clk */
  644. 0x15C, /* gcc_ufs_phy_axi_clk */
  645. 0x163, /* gcc_ufs_phy_ice_core_clk */
  646. 0x164, /* gcc_ufs_phy_phy_aux_clk */
  647. 0x15F, /* gcc_ufs_phy_rx_symbol_0_clk */
  648. 0x165, /* gcc_ufs_phy_rx_symbol_1_clk */
  649. 0x15E, /* gcc_ufs_phy_tx_symbol_0_clk */
  650. 0x162, /* gcc_ufs_phy_unipro_core_clk */
  651. 0x8F, /* gcc_usb30_prim_master_clk */
  652. 0x91, /* gcc_usb30_prim_mock_utmi_clk */
  653. 0x90, /* gcc_usb30_prim_sleep_clk */
  654. 0x92, /* gcc_usb3_prim_phy_aux_clk */
  655. 0x93, /* gcc_usb3_prim_phy_com_aux_clk */
  656. 0x94, /* gcc_usb3_prim_phy_pipe_clk */
  657. 0x70, /* gcc_video_ahb_clk */
  658. 0x75, /* gcc_video_axi0_clk */
  659. 0x76, /* gcc_video_axi1_clk */
  660. 0x77, /* gcc_video_xo_clk */
  661. 0x18D, /* gpu_cc_debug_mux */
  662. 0x10B, /* mc_cc_debug_mux */
  663. 0x16, /* measure_only_cnoc_clk */
  664. 0x176, /* measure_only_ipa_2x_clk */
  665. 0x103, /* measure_only_memnoc_clk */
  666. 0xB, /* measure_only_snoc_clk */
  667. 0x14F, /* pcie_0_pipe_clk */
  668. 0x15A, /* pcie_1_phy_aux_clk */
  669. 0x159, /* pcie_1_pipe_clk */
  670. 0x161, /* ufs_phy_rx_symbol_0_clk */
  671. 0x167, /* ufs_phy_rx_symbol_1_clk */
  672. 0x160, /* ufs_phy_tx_symbol_0_clk */
  673. 0x98, /* usb3_phy_wrapper_gcc_usb30_pipe_clk */
  674. 0x78, /* video_cc_debug_mux */
  675. };
  676. static struct clk_debug_mux gcc_debug_mux = {
  677. .priv = &debug_mux_priv,
  678. .debug_offset = 0x62024,
  679. .post_div_offset = 0x62000,
  680. .cbcr_offset = 0x62004,
  681. .src_sel_mask = 0x3FF,
  682. .src_sel_shift = 0,
  683. .post_div_mask = 0xF,
  684. .post_div_shift = 0,
  685. .post_div_val = 2,
  686. .mux_sels = gcc_debug_mux_sels,
  687. .num_mux_sels = ARRAY_SIZE(gcc_debug_mux_sels),
  688. .hw.init = &(const struct clk_init_data){
  689. .name = "gcc_debug_mux",
  690. .ops = &clk_debug_mux_ops,
  691. .parent_names = gcc_debug_mux_parent_names,
  692. .num_parents = ARRAY_SIZE(gcc_debug_mux_parent_names),
  693. },
  694. };
  695. static const char *const gpu_cc_debug_mux_parent_names[] = {
  696. "gpu_cc_ahb_clk",
  697. "gpu_cc_crc_ahb_clk",
  698. "gpu_cc_cx_accu_shift_clk",
  699. "gpu_cc_cx_ff_clk",
  700. "gpu_cc_cx_gmu_clk",
  701. "gpu_cc_cxo_aon_clk",
  702. "gpu_cc_cxo_clk",
  703. "gpu_cc_demet_clk",
  704. "gpu_cc_dpm_clk",
  705. "gpu_cc_freq_measure_clk",
  706. "gpu_cc_gx_accu_shift_clk",
  707. "gpu_cc_gx_ff_clk",
  708. "gpu_cc_gx_gfx3d_rdvm_clk",
  709. "gpu_cc_gx_gmu_clk",
  710. "gpu_cc_gx_vsense_clk",
  711. "gpu_cc_hub_aon_clk",
  712. "gpu_cc_hub_cx_int_clk",
  713. "gpu_cc_memnoc_gfx_clk",
  714. "gpu_cc_sleep_clk",
  715. "measure_only_gpu_cc_cx_gfx3d_clk",
  716. "measure_only_gpu_cc_cx_gfx3d_slv_clk",
  717. "measure_only_gpu_cc_gx_gfx3d_clk",
  718. };
  719. static int gpu_cc_debug_mux_sels[] = {
  720. 0x18, /* gpu_cc_ahb_clk */
  721. 0x19, /* gpu_cc_crc_ahb_clk */
  722. 0x26, /* gpu_cc_cx_accu_shift_clk */
  723. 0x22, /* gpu_cc_cx_ff_clk */
  724. 0x1F, /* gpu_cc_cx_gmu_clk */
  725. 0xC, /* gpu_cc_cxo_aon_clk */
  726. 0x20, /* gpu_cc_cxo_clk */
  727. 0xE, /* gpu_cc_demet_clk */
  728. 0x27, /* gpu_cc_dpm_clk */
  729. 0xD, /* gpu_cc_freq_measure_clk */
  730. 0x17, /* gpu_cc_gx_accu_shift_clk */
  731. 0x14, /* gpu_cc_gx_ff_clk */
  732. 0x16, /* gpu_cc_gx_gfx3d_rdvm_clk */
  733. 0x13, /* gpu_cc_gx_gmu_clk */
  734. 0x10, /* gpu_cc_gx_vsense_clk */
  735. 0x31, /* gpu_cc_hub_aon_clk */
  736. 0x21, /* gpu_cc_hub_cx_int_clk */
  737. 0x23, /* gpu_cc_memnoc_gfx_clk */
  738. 0x1D, /* gpu_cc_sleep_clk */
  739. 0x28, /* measure_only_gpu_cc_cx_gfx3d_clk */
  740. 0x29, /* measure_only_gpu_cc_cx_gfx3d_slv_clk */
  741. 0xF, /* measure_only_gpu_cc_gx_gfx3d_clk */
  742. };
  743. static struct clk_debug_mux gpu_cc_debug_mux = {
  744. .priv = &debug_mux_priv,
  745. .debug_offset = 0x9564,
  746. .post_div_offset = 0x9270,
  747. .cbcr_offset = 0x9274,
  748. .src_sel_mask = 0xFF,
  749. .src_sel_shift = 0,
  750. .post_div_mask = 0xF,
  751. .post_div_shift = 0,
  752. .post_div_val = 2,
  753. .mux_sels = gpu_cc_debug_mux_sels,
  754. .num_mux_sels = ARRAY_SIZE(gpu_cc_debug_mux_sels),
  755. .hw.init = &(const struct clk_init_data){
  756. .name = "gpu_cc_debug_mux",
  757. .ops = &clk_debug_mux_ops,
  758. .parent_names = gpu_cc_debug_mux_parent_names,
  759. .num_parents = ARRAY_SIZE(gpu_cc_debug_mux_parent_names),
  760. },
  761. };
  762. static const char *const video_cc_debug_mux_parent_names[] = {
  763. "video_cc_ahb_clk",
  764. "video_cc_mvs0_clk",
  765. "video_cc_mvs0_shift_clk",
  766. "video_cc_mvs0c_clk",
  767. "video_cc_mvs0c_shift_clk",
  768. "video_cc_mvs1_clk",
  769. "video_cc_mvs1_shift_clk",
  770. "video_cc_mvs1c_clk",
  771. "video_cc_mvs1c_shift_clk",
  772. "video_cc_sleep_clk",
  773. "video_cc_xo_clk",
  774. };
  775. static int video_cc_debug_mux_sels[] = {
  776. 0x7, /* video_cc_ahb_clk */
  777. 0x3, /* video_cc_mvs0_clk */
  778. 0xD, /* video_cc_mvs0_shift_clk */
  779. 0x1, /* video_cc_mvs0c_clk */
  780. 0xE, /* video_cc_mvs0c_shift_clk */
  781. 0x5, /* video_cc_mvs1_clk */
  782. 0xF, /* video_cc_mvs1_shift_clk */
  783. 0x9, /* video_cc_mvs1c_clk */
  784. 0x10, /* video_cc_mvs1c_shift_clk */
  785. 0xC, /* video_cc_sleep_clk */
  786. 0xB, /* video_cc_xo_clk */
  787. };
  788. static struct clk_debug_mux video_cc_debug_mux = {
  789. .priv = &debug_mux_priv,
  790. .debug_offset = 0x9A4C,
  791. .post_div_offset = 0x80F8,
  792. .cbcr_offset = 0x80FC,
  793. .src_sel_mask = 0x3F,
  794. .src_sel_shift = 0,
  795. .post_div_mask = 0xF,
  796. .post_div_shift = 0,
  797. .post_div_val = 3,
  798. .mux_sels = video_cc_debug_mux_sels,
  799. .num_mux_sels = ARRAY_SIZE(video_cc_debug_mux_sels),
  800. .hw.init = &(const struct clk_init_data){
  801. .name = "video_cc_debug_mux",
  802. .ops = &clk_debug_mux_ops,
  803. .parent_names = video_cc_debug_mux_parent_names,
  804. .num_parents = ARRAY_SIZE(video_cc_debug_mux_parent_names),
  805. },
  806. };
  807. static const char *const mc_cc_debug_mux_parent_names[] = {
  808. "measure_only_mccc_clk",
  809. };
  810. static struct clk_debug_mux mc_cc_debug_mux = {
  811. .period_offset = 0x50,
  812. .hw.init = &(struct clk_init_data){
  813. .name = "mc_cc_debug_mux",
  814. .ops = &clk_debug_mux_ops,
  815. .parent_names = mc_cc_debug_mux_parent_names,
  816. .num_parents = ARRAY_SIZE(mc_cc_debug_mux_parent_names),
  817. },
  818. };
  819. static struct mux_regmap_names mux_list[] = {
  820. { .mux = &mc_cc_debug_mux, .regmap_name = "qcom,mccc" },
  821. { .mux = &video_cc_debug_mux, .regmap_name = "qcom,videocc" },
  822. { .mux = &gpu_cc_debug_mux, .regmap_name = "qcom,gpucc" },
  823. { .mux = &disp_cc_debug_mux, .regmap_name = "qcom,dispcc" },
  824. { .mux = &cam_cc_debug_mux, .regmap_name = "qcom,camcc" },
  825. { .mux = &apss_cc_debug_mux, .regmap_name = "qcom,apsscc" },
  826. { .mux = &gcc_debug_mux, .regmap_name = "qcom,gcc" },
  827. };
  828. static struct clk_dummy measure_only_apcs_gold_post_acd_clk = {
  829. .rrate = 1000,
  830. .hw.init = &(const struct clk_init_data){
  831. .name = "measure_only_apcs_gold_post_acd_clk",
  832. .ops = &clk_dummy_ops,
  833. },
  834. };
  835. static struct clk_dummy measure_only_apcs_goldapc2_post_acd_clk = {
  836. .rrate = 1000,
  837. .hw.init = &(const struct clk_init_data){
  838. .name = "measure_only_apcs_goldapc2_post_acd_clk",
  839. .ops = &clk_dummy_ops,
  840. },
  841. };
  842. static struct clk_dummy measure_only_apcs_goldplus_post_acd_clk = {
  843. .rrate = 1000,
  844. .hw.init = &(const struct clk_init_data){
  845. .name = "measure_only_apcs_goldplus_post_acd_clk",
  846. .ops = &clk_dummy_ops,
  847. },
  848. };
  849. static struct clk_dummy measure_only_apcs_l3_post_acd_clk = {
  850. .rrate = 1000,
  851. .hw.init = &(const struct clk_init_data){
  852. .name = "measure_only_apcs_l3_post_acd_clk",
  853. .ops = &clk_dummy_ops,
  854. },
  855. };
  856. static struct clk_dummy measure_only_apcs_silver_post_acd_clk = {
  857. .rrate = 1000,
  858. .hw.init = &(const struct clk_init_data){
  859. .name = "measure_only_apcs_silver_post_acd_clk",
  860. .ops = &clk_dummy_ops,
  861. },
  862. };
  863. static struct clk_dummy measure_only_cnoc_clk = {
  864. .rrate = 1000,
  865. .hw.init = &(const struct clk_init_data){
  866. .name = "measure_only_cnoc_clk",
  867. .ops = &clk_dummy_ops,
  868. },
  869. };
  870. static struct clk_dummy measure_only_gpu_cc_cx_gfx3d_clk = {
  871. .rrate = 1000,
  872. .hw.init = &(const struct clk_init_data){
  873. .name = "measure_only_gpu_cc_cx_gfx3d_clk",
  874. .ops = &clk_dummy_ops,
  875. },
  876. };
  877. static struct clk_dummy measure_only_gpu_cc_cx_gfx3d_slv_clk = {
  878. .rrate = 1000,
  879. .hw.init = &(const struct clk_init_data){
  880. .name = "measure_only_gpu_cc_cx_gfx3d_slv_clk",
  881. .ops = &clk_dummy_ops,
  882. },
  883. };
  884. static struct clk_dummy measure_only_gpu_cc_gx_gfx3d_clk = {
  885. .rrate = 1000,
  886. .hw.init = &(const struct clk_init_data){
  887. .name = "measure_only_gpu_cc_gx_gfx3d_clk",
  888. .ops = &clk_dummy_ops,
  889. },
  890. };
  891. static struct clk_dummy measure_only_ipa_2x_clk = {
  892. .rrate = 1000,
  893. .hw.init = &(const struct clk_init_data){
  894. .name = "measure_only_ipa_2x_clk",
  895. .ops = &clk_dummy_ops,
  896. },
  897. };
  898. static struct clk_dummy measure_only_mccc_clk = {
  899. .rrate = 1000,
  900. .hw.init = &(const struct clk_init_data){
  901. .name = "measure_only_mccc_clk",
  902. .ops = &clk_dummy_ops,
  903. },
  904. };
  905. static struct clk_dummy measure_only_memnoc_clk = {
  906. .rrate = 1000,
  907. .hw.init = &(const struct clk_init_data){
  908. .name = "measure_only_memnoc_clk",
  909. .ops = &clk_dummy_ops,
  910. },
  911. };
  912. static struct clk_dummy measure_only_snoc_clk = {
  913. .rrate = 1000,
  914. .hw.init = &(const struct clk_init_data){
  915. .name = "measure_only_snoc_clk",
  916. .ops = &clk_dummy_ops,
  917. },
  918. };
  919. static struct clk_hw *debugcc_pineapple_hws[] = {
  920. &measure_only_apcs_gold_post_acd_clk.hw,
  921. &measure_only_apcs_goldapc2_post_acd_clk.hw,
  922. &measure_only_apcs_goldplus_post_acd_clk.hw,
  923. &measure_only_apcs_l3_post_acd_clk.hw,
  924. &measure_only_apcs_silver_post_acd_clk.hw,
  925. &measure_only_cnoc_clk.hw,
  926. &measure_only_gpu_cc_cx_gfx3d_clk.hw,
  927. &measure_only_gpu_cc_cx_gfx3d_slv_clk.hw,
  928. &measure_only_gpu_cc_gx_gfx3d_clk.hw,
  929. &measure_only_ipa_2x_clk.hw,
  930. &measure_only_mccc_clk.hw,
  931. &measure_only_memnoc_clk.hw,
  932. &measure_only_snoc_clk.hw,
  933. };
  934. static const struct of_device_id clk_debug_match_table[] = {
  935. { .compatible = "qcom,pineapple-debugcc" },
  936. { }
  937. };
  938. static int clk_debug_pineapple_probe(struct platform_device *pdev)
  939. {
  940. struct clk *clk;
  941. int ret = 0, i;
  942. BUILD_BUG_ON(ARRAY_SIZE(apss_cc_debug_mux_parent_names) !=
  943. ARRAY_SIZE(apss_cc_debug_mux_sels));
  944. BUILD_BUG_ON(ARRAY_SIZE(cam_cc_debug_mux_parent_names) !=
  945. ARRAY_SIZE(cam_cc_debug_mux_sels));
  946. BUILD_BUG_ON(ARRAY_SIZE(disp_cc_debug_mux_parent_names) !=
  947. ARRAY_SIZE(disp_cc_debug_mux_sels));
  948. BUILD_BUG_ON(ARRAY_SIZE(gcc_debug_mux_parent_names) != ARRAY_SIZE(gcc_debug_mux_sels));
  949. BUILD_BUG_ON(ARRAY_SIZE(gpu_cc_debug_mux_parent_names) !=
  950. ARRAY_SIZE(gpu_cc_debug_mux_sels));
  951. BUILD_BUG_ON(ARRAY_SIZE(video_cc_debug_mux_parent_names) !=
  952. ARRAY_SIZE(video_cc_debug_mux_sels));
  953. clk = devm_clk_get(&pdev->dev, "xo_clk_src");
  954. if (IS_ERR(clk)) {
  955. if (PTR_ERR(clk) != -EPROBE_DEFER)
  956. dev_err(&pdev->dev, "Unable to get xo clock\n");
  957. return PTR_ERR(clk);
  958. }
  959. debug_mux_priv.cxo = clk;
  960. for (i = 0; i < ARRAY_SIZE(mux_list); i++) {
  961. if (IS_ERR_OR_NULL(mux_list[i].mux->regmap)) {
  962. ret = map_debug_bases(pdev, mux_list[i].regmap_name,
  963. mux_list[i].mux);
  964. if (ret == -EBADR)
  965. continue;
  966. else if (ret)
  967. return ret;
  968. }
  969. }
  970. for (i = 0; i < ARRAY_SIZE(debugcc_pineapple_hws); i++) {
  971. clk = devm_clk_register(&pdev->dev, debugcc_pineapple_hws[i]);
  972. if (IS_ERR(clk)) {
  973. dev_err(&pdev->dev, "Unable to register %s, err:(%d)\n",
  974. clk_hw_get_name(debugcc_pineapple_hws[i]),
  975. PTR_ERR(clk));
  976. return PTR_ERR(clk);
  977. }
  978. }
  979. for (i = 0; i < ARRAY_SIZE(mux_list); i++) {
  980. ret = devm_clk_register_debug_mux(&pdev->dev, mux_list[i].mux);
  981. if (ret) {
  982. dev_err(&pdev->dev, "Unable to register mux clk %s, err:(%d)\n",
  983. qcom_clk_hw_get_name(&mux_list[i].mux->hw),
  984. ret);
  985. return ret;
  986. }
  987. }
  988. ret = clk_debug_measure_register(&gcc_debug_mux.hw);
  989. if (ret) {
  990. dev_err(&pdev->dev, "Could not register Measure clocks\n");
  991. return ret;
  992. }
  993. dev_info(&pdev->dev, "Registered debug measure clocks\n");
  994. return ret;
  995. }
  996. static struct platform_driver clk_debug_driver = {
  997. .probe = clk_debug_pineapple_probe,
  998. .driver = {
  999. .name = "pineapple-debugcc",
  1000. .of_match_table = clk_debug_match_table,
  1001. },
  1002. };
  1003. static int __init clk_debug_pineapple_init(void)
  1004. {
  1005. return platform_driver_register(&clk_debug_driver);
  1006. }
  1007. fs_initcall(clk_debug_pineapple_init);
  1008. MODULE_DESCRIPTION("QTI DEBUG CC PINEAPPLE Driver");
  1009. MODULE_LICENSE("GPL");