debugcc-sc8180x.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #define pr_fmt(fmt) "clk: %s: " fmt, __func__
  6. #include <linux/clk.h>
  7. #include <linux/clk-provider.h>
  8. #include <linux/err.h>
  9. #include <linux/kernel.h>
  10. #include <linux/mfd/syscon.h>
  11. #include <linux/module.h>
  12. #include <linux/of.h>
  13. #include <linux/of_device.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/regmap.h>
  16. #include "clk-debug.h"
  17. #include "common.h"
  18. static struct measure_clk_data debug_mux_priv = {
  19. .ctl_reg = 0x62038,
  20. .status_reg = 0x6203C,
  21. .xo_div4_cbcr = 0x43008,
  22. };
  23. static const char *const apss_cc_debug_mux_parent_names[] = {
  24. "measure_only_apcs_gold_post_acd_clk",
  25. "measure_only_apcs_l3_post_acd_clk",
  26. "measure_only_apcs_silver_post_acd_clk",
  27. };
  28. static int apss_cc_debug_mux_sels[] = {
  29. 0x25, /* measure_only_apcs_gold_post_acd_clk */
  30. 0x41, /* measure_only_apcs_l3_post_acd_clk */
  31. 0x21, /* measure_only_apcs_silver_post_acd_clk */
  32. };
  33. static int apss_cc_debug_mux_pre_divs[] = {
  34. 0x8, /* measure_only_apcs_gold_post_acd_clk */
  35. 0x4, /* measure_only_apcs_l3_post_acd_clk */
  36. 0x4, /* measure_only_apcs_silver_post_acd_clk */
  37. };
  38. static struct clk_debug_mux apss_cc_debug_mux = {
  39. .priv = &debug_mux_priv,
  40. .debug_offset = 0x18,
  41. .post_div_offset = 0x18,
  42. .cbcr_offset = 0x0,
  43. .src_sel_mask = 0x7F0,
  44. .src_sel_shift = 4,
  45. .post_div_mask = 0x7800,
  46. .post_div_shift = 11,
  47. .post_div_val = 1,
  48. .mux_sels = apss_cc_debug_mux_sels,
  49. .num_mux_sels = ARRAY_SIZE(apss_cc_debug_mux_sels),
  50. .pre_div_vals = apss_cc_debug_mux_pre_divs,
  51. .hw.init = &(struct clk_init_data){
  52. .name = "apss_cc_debug_mux",
  53. .ops = &clk_debug_mux_ops,
  54. .parent_names = apss_cc_debug_mux_parent_names,
  55. .num_parents = ARRAY_SIZE(apss_cc_debug_mux_parent_names),
  56. },
  57. };
  58. static const char *const cam_cc_debug_mux_parent_names[] = {
  59. "cam_cc_bps_ahb_clk",
  60. "cam_cc_bps_areg_clk",
  61. "cam_cc_bps_axi_clk",
  62. "cam_cc_bps_clk",
  63. "cam_cc_camnoc_axi_clk",
  64. "cam_cc_camnoc_dcd_xo_clk",
  65. "cam_cc_cci_0_clk",
  66. "cam_cc_cci_1_clk",
  67. "cam_cc_cci_2_clk",
  68. "cam_cc_cci_3_clk",
  69. "cam_cc_core_ahb_clk",
  70. "cam_cc_cpas_ahb_clk",
  71. "cam_cc_csi0phytimer_clk",
  72. "cam_cc_csi1phytimer_clk",
  73. "cam_cc_csi2phytimer_clk",
  74. "cam_cc_csi3phytimer_clk",
  75. "cam_cc_csiphy0_clk",
  76. "cam_cc_csiphy1_clk",
  77. "cam_cc_csiphy2_clk",
  78. "cam_cc_csiphy3_clk",
  79. "cam_cc_fd_core_clk",
  80. "cam_cc_fd_core_uar_clk",
  81. "cam_cc_icp_ahb_clk",
  82. "cam_cc_icp_clk",
  83. "cam_cc_ife_0_axi_clk",
  84. "cam_cc_ife_0_clk",
  85. "cam_cc_ife_0_cphy_rx_clk",
  86. "cam_cc_ife_0_csid_clk",
  87. "cam_cc_ife_0_dsp_clk",
  88. "cam_cc_ife_1_axi_clk",
  89. "cam_cc_ife_1_clk",
  90. "cam_cc_ife_1_cphy_rx_clk",
  91. "cam_cc_ife_1_csid_clk",
  92. "cam_cc_ife_1_dsp_clk",
  93. "cam_cc_ife_2_axi_clk",
  94. "cam_cc_ife_2_clk",
  95. "cam_cc_ife_2_cphy_rx_clk",
  96. "cam_cc_ife_2_csid_clk",
  97. "cam_cc_ife_2_dsp_clk",
  98. "cam_cc_ife_3_axi_clk",
  99. "cam_cc_ife_3_clk",
  100. "cam_cc_ife_3_cphy_rx_clk",
  101. "cam_cc_ife_3_csid_clk",
  102. "cam_cc_ife_3_dsp_clk",
  103. "cam_cc_ife_lite_0_clk",
  104. "cam_cc_ife_lite_0_cphy_rx_clk",
  105. "cam_cc_ife_lite_0_csid_clk",
  106. "cam_cc_ife_lite_1_clk",
  107. "cam_cc_ife_lite_1_cphy_rx_clk",
  108. "cam_cc_ife_lite_1_csid_clk",
  109. "cam_cc_ife_lite_2_clk",
  110. "cam_cc_ife_lite_2_cphy_rx_clk",
  111. "cam_cc_ife_lite_2_csid_clk",
  112. "cam_cc_ife_lite_3_clk",
  113. "cam_cc_ife_lite_3_cphy_rx_clk",
  114. "cam_cc_ife_lite_3_csid_clk",
  115. "cam_cc_ipe_0_ahb_clk",
  116. "cam_cc_ipe_0_areg_clk",
  117. "cam_cc_ipe_0_axi_clk",
  118. "cam_cc_ipe_0_clk",
  119. "cam_cc_ipe_1_ahb_clk",
  120. "cam_cc_ipe_1_areg_clk",
  121. "cam_cc_ipe_1_axi_clk",
  122. "cam_cc_ipe_1_clk",
  123. "cam_cc_jpeg_clk",
  124. "cam_cc_lrme_clk",
  125. "cam_cc_mclk0_clk",
  126. "cam_cc_mclk1_clk",
  127. "cam_cc_mclk2_clk",
  128. "cam_cc_mclk3_clk",
  129. "cam_cc_mclk4_clk",
  130. "cam_cc_mclk5_clk",
  131. "cam_cc_mclk6_clk",
  132. "cam_cc_mclk7_clk",
  133. "cam_cc_sleep_clk",
  134. };
  135. static int cam_cc_debug_mux_sels[] = {
  136. 0xE, /* cam_cc_bps_ahb_clk */
  137. 0xD, /* cam_cc_bps_areg_clk */
  138. 0xC, /* cam_cc_bps_axi_clk */
  139. 0xB, /* cam_cc_bps_clk */
  140. 0x27, /* cam_cc_camnoc_axi_clk */
  141. 0x33, /* cam_cc_camnoc_dcd_xo_clk */
  142. 0x2A, /* cam_cc_cci_0_clk */
  143. 0x3B, /* cam_cc_cci_1_clk */
  144. 0x5B, /* cam_cc_cci_2_clk */
  145. 0x5C, /* cam_cc_cci_3_clk */
  146. 0x2E, /* cam_cc_core_ahb_clk */
  147. 0x2C, /* cam_cc_cpas_ahb_clk */
  148. 0x5, /* cam_cc_csi0phytimer_clk */
  149. 0x7, /* cam_cc_csi1phytimer_clk */
  150. 0x9, /* cam_cc_csi2phytimer_clk */
  151. 0x35, /* cam_cc_csi3phytimer_clk */
  152. 0x6, /* cam_cc_csiphy0_clk */
  153. 0x8, /* cam_cc_csiphy1_clk */
  154. 0xA, /* cam_cc_csiphy2_clk */
  155. 0x36, /* cam_cc_csiphy3_clk */
  156. 0x28, /* cam_cc_fd_core_clk */
  157. 0x29, /* cam_cc_fd_core_uar_clk */
  158. 0x37, /* cam_cc_icp_ahb_clk */
  159. 0x26, /* cam_cc_icp_clk */
  160. 0x1B, /* cam_cc_ife_0_axi_clk */
  161. 0x17, /* cam_cc_ife_0_clk */
  162. 0x1A, /* cam_cc_ife_0_cphy_rx_clk */
  163. 0x19, /* cam_cc_ife_0_csid_clk */
  164. 0x18, /* cam_cc_ife_0_dsp_clk */
  165. 0x21, /* cam_cc_ife_1_axi_clk */
  166. 0x1D, /* cam_cc_ife_1_clk */
  167. 0x20, /* cam_cc_ife_1_cphy_rx_clk */
  168. 0x1F, /* cam_cc_ife_1_csid_clk */
  169. 0x1E, /* cam_cc_ife_1_dsp_clk */
  170. 0x4A, /* cam_cc_ife_2_axi_clk */
  171. 0x44, /* cam_cc_ife_2_clk */
  172. 0x49, /* cam_cc_ife_2_cphy_rx_clk */
  173. 0x47, /* cam_cc_ife_2_csid_clk */
  174. 0x46, /* cam_cc_ife_2_dsp_clk */
  175. 0x51, /* cam_cc_ife_3_axi_clk */
  176. 0x4B, /* cam_cc_ife_3_clk */
  177. 0x50, /* cam_cc_ife_3_cphy_rx_clk */
  178. 0x4E, /* cam_cc_ife_3_csid_clk */
  179. 0x4D, /* cam_cc_ife_3_dsp_clk */
  180. 0x22, /* cam_cc_ife_lite_0_clk */
  181. 0x24, /* cam_cc_ife_lite_0_cphy_rx_clk */
  182. 0x23, /* cam_cc_ife_lite_0_csid_clk */
  183. 0x38, /* cam_cc_ife_lite_1_clk */
  184. 0x3A, /* cam_cc_ife_lite_1_cphy_rx_clk */
  185. 0x39, /* cam_cc_ife_lite_1_csid_clk */
  186. 0x55, /* cam_cc_ife_lite_2_clk */
  187. 0x57, /* cam_cc_ife_lite_2_cphy_rx_clk */
  188. 0x56, /* cam_cc_ife_lite_2_csid_clk */
  189. 0x58, /* cam_cc_ife_lite_3_clk */
  190. 0x5A, /* cam_cc_ife_lite_3_cphy_rx_clk */
  191. 0x59, /* cam_cc_ife_lite_3_csid_clk */
  192. 0x12, /* cam_cc_ipe_0_ahb_clk */
  193. 0x11, /* cam_cc_ipe_0_areg_clk */
  194. 0x10, /* cam_cc_ipe_0_axi_clk */
  195. 0xF, /* cam_cc_ipe_0_clk */
  196. 0x16, /* cam_cc_ipe_1_ahb_clk */
  197. 0x15, /* cam_cc_ipe_1_areg_clk */
  198. 0x14, /* cam_cc_ipe_1_axi_clk */
  199. 0x13, /* cam_cc_ipe_1_clk */
  200. 0x25, /* cam_cc_jpeg_clk */
  201. 0x2B, /* cam_cc_lrme_clk */
  202. 0x1, /* cam_cc_mclk0_clk */
  203. 0x2, /* cam_cc_mclk1_clk */
  204. 0x3, /* cam_cc_mclk2_clk */
  205. 0x4, /* cam_cc_mclk3_clk */
  206. 0x5D, /* cam_cc_mclk4_clk */
  207. 0x5E, /* cam_cc_mclk5_clk */
  208. 0x5F, /* cam_cc_mclk6_clk */
  209. 0x60, /* cam_cc_mclk7_clk */
  210. 0x3F, /* cam_cc_sleep_clk */
  211. };
  212. static struct clk_debug_mux cam_cc_debug_mux = {
  213. .priv = &debug_mux_priv,
  214. .debug_offset = 0xD000,
  215. .post_div_offset = 0xD004,
  216. .cbcr_offset = 0xD008,
  217. .src_sel_mask = 0xFF,
  218. .src_sel_shift = 0,
  219. .post_div_mask = 0xF,
  220. .post_div_shift = 0,
  221. .post_div_val = 4,
  222. .mux_sels = cam_cc_debug_mux_sels,
  223. .num_mux_sels = ARRAY_SIZE(cam_cc_debug_mux_sels),
  224. .hw.init = &(struct clk_init_data){
  225. .name = "cam_cc_debug_mux",
  226. .ops = &clk_debug_mux_ops,
  227. .parent_names = cam_cc_debug_mux_parent_names,
  228. .num_parents = ARRAY_SIZE(cam_cc_debug_mux_parent_names),
  229. },
  230. };
  231. static const char *const disp_cc_debug_mux_parent_names[] = {
  232. "disp_cc_mdss_ahb_clk",
  233. "disp_cc_mdss_byte0_clk",
  234. "disp_cc_mdss_byte0_intf_clk",
  235. "disp_cc_mdss_byte1_clk",
  236. "disp_cc_mdss_byte1_intf_clk",
  237. "disp_cc_mdss_dp_aux1_clk",
  238. "disp_cc_mdss_dp_aux_clk",
  239. "disp_cc_mdss_dp_link1_clk",
  240. "disp_cc_mdss_dp_link1_intf_clk",
  241. "disp_cc_mdss_dp_link_clk",
  242. "disp_cc_mdss_dp_link_intf_clk",
  243. "disp_cc_mdss_dp_pixel1_clk",
  244. "disp_cc_mdss_dp_pixel2_clk",
  245. "disp_cc_mdss_dp_pixel_clk",
  246. "disp_cc_mdss_edp_aux_clk",
  247. "disp_cc_mdss_edp_gtc_clk",
  248. "disp_cc_mdss_edp_link_clk",
  249. "disp_cc_mdss_edp_link_intf_clk",
  250. "disp_cc_mdss_edp_pixel_clk",
  251. "disp_cc_mdss_esc0_clk",
  252. "disp_cc_mdss_esc1_clk",
  253. "disp_cc_mdss_mdp_clk",
  254. "disp_cc_mdss_mdp_lut_clk",
  255. "disp_cc_mdss_non_gdsc_ahb_clk",
  256. "disp_cc_mdss_pclk0_clk",
  257. "disp_cc_mdss_pclk1_clk",
  258. "disp_cc_mdss_rot_clk",
  259. "disp_cc_mdss_rscc_ahb_clk",
  260. "disp_cc_mdss_rscc_vsync_clk",
  261. "disp_cc_mdss_vsync_clk",
  262. };
  263. static int disp_cc_debug_mux_sels[] = {
  264. 0x2B, /* disp_cc_mdss_ahb_clk */
  265. 0x15, /* disp_cc_mdss_byte0_clk */
  266. 0x16, /* disp_cc_mdss_byte0_intf_clk */
  267. 0x17, /* disp_cc_mdss_byte1_clk */
  268. 0x18, /* disp_cc_mdss_byte1_intf_clk */
  269. 0x25, /* disp_cc_mdss_dp_aux1_clk */
  270. 0x20, /* disp_cc_mdss_dp_aux_clk */
  271. 0x22, /* disp_cc_mdss_dp_link1_clk */
  272. 0x23, /* disp_cc_mdss_dp_link1_intf_clk */
  273. 0x1B, /* disp_cc_mdss_dp_link_clk */
  274. 0x1C, /* disp_cc_mdss_dp_link_intf_clk */
  275. 0x1F, /* disp_cc_mdss_dp_pixel1_clk */
  276. 0x21, /* disp_cc_mdss_dp_pixel2_clk */
  277. 0x1E, /* disp_cc_mdss_dp_pixel_clk */
  278. 0x29, /* disp_cc_mdss_edp_aux_clk */
  279. 0x2A, /* disp_cc_mdss_edp_gtc_clk */
  280. 0x27, /* disp_cc_mdss_edp_link_clk */
  281. 0x28, /* disp_cc_mdss_edp_link_intf_clk */
  282. 0x26, /* disp_cc_mdss_edp_pixel_clk */
  283. 0x19, /* disp_cc_mdss_esc0_clk */
  284. 0x1A, /* disp_cc_mdss_esc1_clk */
  285. 0x11, /* disp_cc_mdss_mdp_clk */
  286. 0x13, /* disp_cc_mdss_mdp_lut_clk */
  287. 0x2C, /* disp_cc_mdss_non_gdsc_ahb_clk */
  288. 0xF, /* disp_cc_mdss_pclk0_clk */
  289. 0x10, /* disp_cc_mdss_pclk1_clk */
  290. 0x12, /* disp_cc_mdss_rot_clk */
  291. 0x2E, /* disp_cc_mdss_rscc_ahb_clk */
  292. 0x2D, /* disp_cc_mdss_rscc_vsync_clk */
  293. 0x14, /* disp_cc_mdss_vsync_clk */
  294. };
  295. static struct clk_debug_mux disp_cc_debug_mux = {
  296. .priv = &debug_mux_priv,
  297. .debug_offset = 0x7000,
  298. .post_div_offset = 0x5008,
  299. .cbcr_offset = 0x500C,
  300. .src_sel_mask = 0xFF,
  301. .src_sel_shift = 0,
  302. .post_div_mask = 0x3,
  303. .post_div_shift = 0,
  304. .post_div_val = 4,
  305. .mux_sels = disp_cc_debug_mux_sels,
  306. .num_mux_sels = ARRAY_SIZE(disp_cc_debug_mux_sels),
  307. .hw.init = &(struct clk_init_data){
  308. .name = "disp_cc_debug_mux",
  309. .ops = &clk_debug_mux_ops,
  310. .parent_names = disp_cc_debug_mux_parent_names,
  311. .num_parents = ARRAY_SIZE(disp_cc_debug_mux_parent_names),
  312. },
  313. };
  314. static const char *const gcc_debug_mux_parent_names[] = {
  315. "apss_cc_debug_mux",
  316. "cam_cc_debug_mux",
  317. "disp_cc_debug_mux",
  318. "gcc_aggre_noc_pcie_tbu_clk",
  319. "gcc_aggre_ufs_card_2_axi_clk",
  320. "gcc_aggre_ufs_card_axi_clk",
  321. "gcc_aggre_ufs_phy_axi_clk",
  322. "gcc_aggre_usb3_mp_axi_clk",
  323. "gcc_aggre_usb3_prim_axi_clk",
  324. "gcc_aggre_usb3_sec_axi_clk",
  325. "gcc_boot_rom_ahb_clk",
  326. "gcc_camera_hf_axi_clk",
  327. "gcc_camera_sf_axi_clk",
  328. "gcc_cfg_noc_usb3_mp_axi_clk",
  329. "gcc_cfg_noc_usb3_prim_axi_clk",
  330. "gcc_cfg_noc_usb3_sec_axi_clk",
  331. "gcc_cpuss_ahb_clk",
  332. "gcc_cpuss_rbcpr_clk",
  333. "gcc_ddrss_gpu_axi_clk",
  334. "gcc_disp_hf_axi_clk",
  335. "gcc_disp_sf_axi_clk",
  336. "gcc_emac_axi_clk",
  337. "gcc_emac_ptp_clk",
  338. "gcc_emac_rgmii_clk",
  339. "gcc_emac_slv_ahb_clk",
  340. "gcc_gp1_clk",
  341. "gcc_gp2_clk",
  342. "gcc_gp3_clk",
  343. "gcc_gp4_clk",
  344. "gcc_gp5_clk",
  345. "gcc_gpu_gpll0_clk_src",
  346. "gcc_gpu_gpll0_div_clk_src",
  347. "gcc_gpu_memnoc_gfx_clk",
  348. "gcc_gpu_snoc_dvm_gfx_clk",
  349. "gcc_npu_axi_clk",
  350. "gcc_npu_gpll0_clk_src",
  351. "gcc_npu_gpll0_div_clk_src",
  352. "gcc_pcie0_phy_refgen_clk",
  353. "gcc_pcie1_phy_refgen_clk",
  354. "gcc_pcie2_phy_refgen_clk",
  355. "gcc_pcie3_phy_refgen_clk",
  356. "gcc_pcie_0_aux_clk",
  357. "gcc_pcie_0_cfg_ahb_clk",
  358. "gcc_pcie_0_mstr_axi_clk",
  359. "gcc_pcie_0_pipe_clk",
  360. "gcc_pcie_0_slv_axi_clk",
  361. "gcc_pcie_0_slv_q2a_axi_clk",
  362. "gcc_pcie_1_aux_clk",
  363. "gcc_pcie_1_cfg_ahb_clk",
  364. "gcc_pcie_1_mstr_axi_clk",
  365. "gcc_pcie_1_pipe_clk",
  366. "gcc_pcie_1_slv_axi_clk",
  367. "gcc_pcie_1_slv_q2a_axi_clk",
  368. "gcc_pcie_2_aux_clk",
  369. "gcc_pcie_2_cfg_ahb_clk",
  370. "gcc_pcie_2_mstr_axi_clk",
  371. "gcc_pcie_2_pipe_clk",
  372. "gcc_pcie_2_slv_axi_clk",
  373. "gcc_pcie_2_slv_q2a_axi_clk",
  374. "gcc_pcie_3_aux_clk",
  375. "gcc_pcie_3_cfg_ahb_clk",
  376. "gcc_pcie_3_mstr_axi_clk",
  377. "gcc_pcie_3_pipe_clk",
  378. "gcc_pcie_3_slv_axi_clk",
  379. "gcc_pcie_3_slv_q2a_axi_clk",
  380. "gcc_pcie_phy_aux_clk",
  381. "gcc_pdm2_clk",
  382. "gcc_pdm_ahb_clk",
  383. "gcc_pdm_xo4_clk",
  384. "gcc_prng_ahb_clk",
  385. "gcc_qmip_camera_nrt_ahb_clk",
  386. "gcc_qmip_camera_rt_ahb_clk",
  387. "gcc_qmip_disp_ahb_clk",
  388. "gcc_qmip_video_cvp_ahb_clk",
  389. "gcc_qmip_video_vcodec_ahb_clk",
  390. "gcc_qspi_1_cnoc_periph_ahb_clk",
  391. "gcc_qspi_1_core_clk",
  392. "gcc_qspi_cnoc_periph_ahb_clk",
  393. "gcc_qspi_core_clk",
  394. "gcc_qupv3_wrap0_s0_clk",
  395. "gcc_qupv3_wrap0_s1_clk",
  396. "gcc_qupv3_wrap0_s2_clk",
  397. "gcc_qupv3_wrap0_s3_clk",
  398. "gcc_qupv3_wrap0_s4_clk",
  399. "gcc_qupv3_wrap0_s5_clk",
  400. "gcc_qupv3_wrap0_s6_clk",
  401. "gcc_qupv3_wrap0_s7_clk",
  402. "gcc_qupv3_wrap1_s0_clk",
  403. "gcc_qupv3_wrap1_s1_clk",
  404. "gcc_qupv3_wrap1_s2_clk",
  405. "gcc_qupv3_wrap1_s3_clk",
  406. "gcc_qupv3_wrap1_s4_clk",
  407. "gcc_qupv3_wrap1_s5_clk",
  408. "gcc_qupv3_wrap2_s0_clk",
  409. "gcc_qupv3_wrap2_s1_clk",
  410. "gcc_qupv3_wrap2_s2_clk",
  411. "gcc_qupv3_wrap2_s3_clk",
  412. "gcc_qupv3_wrap2_s4_clk",
  413. "gcc_qupv3_wrap2_s5_clk",
  414. "gcc_qupv3_wrap_0_m_ahb_clk",
  415. "gcc_qupv3_wrap_0_s_ahb_clk",
  416. "gcc_qupv3_wrap_1_m_ahb_clk",
  417. "gcc_qupv3_wrap_1_s_ahb_clk",
  418. "gcc_qupv3_wrap_2_m_ahb_clk",
  419. "gcc_qupv3_wrap_2_s_ahb_clk",
  420. "gcc_sdcc2_ahb_clk",
  421. "gcc_sdcc2_apps_clk",
  422. "gcc_sdcc4_ahb_clk",
  423. "gcc_sdcc4_apps_clk",
  424. "gcc_sys_noc_cpuss_ahb_clk",
  425. "gcc_tsif_ahb_clk",
  426. "gcc_tsif_inactivity_timers_clk",
  427. "gcc_tsif_ref_clk",
  428. "gcc_ufs_card_2_ahb_clk",
  429. "gcc_ufs_card_2_axi_clk",
  430. "gcc_ufs_card_2_ice_core_clk",
  431. "gcc_ufs_card_2_phy_aux_clk",
  432. "gcc_ufs_card_2_rx_symbol_0_clk",
  433. "gcc_ufs_card_2_rx_symbol_1_clk",
  434. "gcc_ufs_card_2_tx_symbol_0_clk",
  435. "gcc_ufs_card_2_unipro_core_clk",
  436. "gcc_ufs_card_ahb_clk",
  437. "gcc_ufs_card_axi_clk",
  438. "gcc_ufs_card_ice_core_clk",
  439. "gcc_ufs_card_phy_aux_clk",
  440. "gcc_ufs_card_rx_symbol_0_clk",
  441. "gcc_ufs_card_rx_symbol_1_clk",
  442. "gcc_ufs_card_tx_symbol_0_clk",
  443. "gcc_ufs_card_unipro_core_clk",
  444. "gcc_ufs_phy_ahb_clk",
  445. "gcc_ufs_phy_axi_clk",
  446. "gcc_ufs_phy_ice_core_clk",
  447. "gcc_ufs_phy_phy_aux_clk",
  448. "gcc_ufs_phy_rx_symbol_0_clk",
  449. "gcc_ufs_phy_rx_symbol_1_clk",
  450. "gcc_ufs_phy_tx_symbol_0_clk",
  451. "gcc_ufs_phy_unipro_core_clk",
  452. "gcc_usb30_mp_master_clk",
  453. "gcc_usb30_mp_mock_utmi_clk",
  454. "gcc_usb30_mp_sleep_clk",
  455. "gcc_usb30_prim_master_clk",
  456. "gcc_usb30_prim_mock_utmi_clk",
  457. "gcc_usb30_prim_sleep_clk",
  458. "gcc_usb30_sec_master_clk",
  459. "gcc_usb30_sec_mock_utmi_clk",
  460. "gcc_usb30_sec_sleep_clk",
  461. "gcc_usb3_mp_phy_aux_clk",
  462. "gcc_usb3_mp_phy_com_aux_clk",
  463. "gcc_usb3_mp_phy_pipe_0_clk",
  464. "gcc_usb3_mp_phy_pipe_1_clk",
  465. "gcc_usb3_prim_phy_aux_clk",
  466. "gcc_usb3_prim_phy_com_aux_clk",
  467. "gcc_usb3_prim_phy_pipe_clk",
  468. "gcc_usb3_sec_phy_aux_clk",
  469. "gcc_usb3_sec_phy_com_aux_clk",
  470. "gcc_usb3_sec_phy_pipe_clk",
  471. "gcc_video_axi0_clk",
  472. "gcc_video_axi1_clk",
  473. "gcc_video_axic_clk",
  474. "gpu_cc_debug_mux",
  475. "measure_only_cnoc_clk",
  476. "measure_only_ipa_2x_clk",
  477. "measure_only_snoc_clk",
  478. "npu_cc_debug_mux",
  479. "video_cc_debug_mux",
  480. "mc_cc_debug_mux",
  481. };
  482. static int gcc_debug_mux_sels[] = {
  483. 0xD6, /* apss_cc_debug_mux */
  484. 0x46, /* cam_cc_debug_mux */
  485. 0x47, /* disp_cc_debug_mux */
  486. 0x2D, /* gcc_aggre_noc_pcie_tbu_clk */
  487. 0x1CD, /* gcc_aggre_ufs_card_2_axi_clk */
  488. 0x11E, /* gcc_aggre_ufs_card_axi_clk */
  489. 0x11D, /* gcc_aggre_ufs_phy_axi_clk */
  490. 0x1C8, /* gcc_aggre_usb3_mp_axi_clk */
  491. 0x11B, /* gcc_aggre_usb3_prim_axi_clk */
  492. 0x11C, /* gcc_aggre_usb3_sec_axi_clk */
  493. 0x94, /* gcc_boot_rom_ahb_clk */
  494. 0x40, /* gcc_camera_hf_axi_clk */
  495. 0x1A9, /* gcc_camera_sf_axi_clk */
  496. 0x1C7, /* gcc_cfg_noc_usb3_mp_axi_clk */
  497. 0x1D, /* gcc_cfg_noc_usb3_prim_axi_clk */
  498. 0x1E, /* gcc_cfg_noc_usb3_sec_axi_clk */
  499. 0xCE, /* gcc_cpuss_ahb_clk */
  500. 0xD0, /* gcc_cpuss_rbcpr_clk */
  501. 0xBB, /* gcc_ddrss_gpu_axi_clk */
  502. 0x41, /* gcc_disp_hf_axi_clk */
  503. 0x161, /* gcc_disp_sf_axi_clk */
  504. 0x16D, /* gcc_emac_axi_clk */
  505. 0x1D3, /* gcc_emac_ptp_clk */
  506. 0x16A, /* gcc_emac_rgmii_clk */
  507. 0x16C, /* gcc_emac_slv_ahb_clk */
  508. 0xDE, /* gcc_gp1_clk */
  509. 0xDF, /* gcc_gp2_clk */
  510. 0xE0, /* gcc_gp3_clk */
  511. 0x17F, /* gcc_gp4_clk */
  512. 0x180, /* gcc_gp5_clk */
  513. 0x148, /* gcc_gpu_gpll0_clk_src */
  514. 0x149, /* gcc_gpu_gpll0_div_clk_src */
  515. 0x145, /* gcc_gpu_memnoc_gfx_clk */
  516. 0x147, /* gcc_gpu_snoc_dvm_gfx_clk */
  517. 0x1E9, /* gcc_npu_axi_clk */
  518. 0x1A1, /* gcc_npu_gpll0_clk_src */
  519. 0x1A2, /* gcc_npu_gpll0_div_clk_src */
  520. 0x1F3, /* gcc_pcie0_phy_refgen_clk */
  521. 0x164, /* gcc_pcie1_phy_refgen_clk */
  522. 0x163, /* gcc_pcie2_phy_refgen_clk */
  523. 0x162, /* gcc_pcie3_phy_refgen_clk */
  524. 0xE5, /* gcc_pcie_0_aux_clk */
  525. 0xE4, /* gcc_pcie_0_cfg_ahb_clk */
  526. 0xE3, /* gcc_pcie_0_mstr_axi_clk */
  527. 0xE6, /* gcc_pcie_0_pipe_clk */
  528. 0xE2, /* gcc_pcie_0_slv_axi_clk */
  529. 0xE1, /* gcc_pcie_0_slv_q2a_axi_clk */
  530. 0xEC, /* gcc_pcie_1_aux_clk */
  531. 0xEB, /* gcc_pcie_1_cfg_ahb_clk */
  532. 0xEA, /* gcc_pcie_1_mstr_axi_clk */
  533. 0xED, /* gcc_pcie_1_pipe_clk */
  534. 0xE9, /* gcc_pcie_1_slv_axi_clk */
  535. 0xE8, /* gcc_pcie_1_slv_q2a_axi_clk */
  536. 0x175, /* gcc_pcie_2_aux_clk */
  537. 0x174, /* gcc_pcie_2_cfg_ahb_clk */
  538. 0x173, /* gcc_pcie_2_mstr_axi_clk */
  539. 0x176, /* gcc_pcie_2_pipe_clk */
  540. 0x172, /* gcc_pcie_2_slv_axi_clk */
  541. 0x171, /* gcc_pcie_2_slv_q2a_axi_clk */
  542. 0x17C, /* gcc_pcie_3_aux_clk */
  543. 0x17B, /* gcc_pcie_3_cfg_ahb_clk */
  544. 0x17A, /* gcc_pcie_3_mstr_axi_clk */
  545. 0x17D, /* gcc_pcie_3_pipe_clk */
  546. 0x179, /* gcc_pcie_3_slv_axi_clk */
  547. 0x178, /* gcc_pcie_3_slv_q2a_axi_clk */
  548. 0xEF, /* gcc_pcie_phy_aux_clk */
  549. 0x8E, /* gcc_pdm2_clk */
  550. 0x8C, /* gcc_pdm_ahb_clk */
  551. 0x8D, /* gcc_pdm_xo4_clk */
  552. 0x8F, /* gcc_prng_ahb_clk */
  553. 0x3D, /* gcc_qmip_camera_nrt_ahb_clk */
  554. 0x160, /* gcc_qmip_camera_rt_ahb_clk */
  555. 0x3E, /* gcc_qmip_disp_ahb_clk */
  556. 0x3C, /* gcc_qmip_video_cvp_ahb_clk */
  557. 0x15C, /* gcc_qmip_video_vcodec_ahb_clk */
  558. 0x16F, /* gcc_qspi_1_cnoc_periph_ahb_clk */
  559. 0x170, /* gcc_qspi_1_core_clk */
  560. 0x168, /* gcc_qspi_cnoc_periph_ahb_clk */
  561. 0x169, /* gcc_qspi_core_clk */
  562. 0x78, /* gcc_qupv3_wrap0_s0_clk */
  563. 0x79, /* gcc_qupv3_wrap0_s1_clk */
  564. 0x7A, /* gcc_qupv3_wrap0_s2_clk */
  565. 0x7B, /* gcc_qupv3_wrap0_s3_clk */
  566. 0x7C, /* gcc_qupv3_wrap0_s4_clk */
  567. 0x7D, /* gcc_qupv3_wrap0_s5_clk */
  568. 0x7E, /* gcc_qupv3_wrap0_s6_clk */
  569. 0x1DA, /* gcc_qupv3_wrap0_s7_clk */
  570. 0x84, /* gcc_qupv3_wrap1_s0_clk */
  571. 0x85, /* gcc_qupv3_wrap1_s1_clk */
  572. 0x86, /* gcc_qupv3_wrap1_s2_clk */
  573. 0x87, /* gcc_qupv3_wrap1_s3_clk */
  574. 0x88, /* gcc_qupv3_wrap1_s4_clk */
  575. 0x89, /* gcc_qupv3_wrap1_s5_clk */
  576. 0x199, /* gcc_qupv3_wrap2_s0_clk */
  577. 0x19A, /* gcc_qupv3_wrap2_s1_clk */
  578. 0x19B, /* gcc_qupv3_wrap2_s2_clk */
  579. 0x19C, /* gcc_qupv3_wrap2_s3_clk */
  580. 0x19D, /* gcc_qupv3_wrap2_s4_clk */
  581. 0x19E, /* gcc_qupv3_wrap2_s5_clk */
  582. 0x74, /* gcc_qupv3_wrap_0_m_ahb_clk */
  583. 0x75, /* gcc_qupv3_wrap_0_s_ahb_clk */
  584. 0x80, /* gcc_qupv3_wrap_1_m_ahb_clk */
  585. 0x81, /* gcc_qupv3_wrap_1_s_ahb_clk */
  586. 0x195, /* gcc_qupv3_wrap_2_m_ahb_clk */
  587. 0x196, /* gcc_qupv3_wrap_2_s_ahb_clk */
  588. 0x71, /* gcc_sdcc2_ahb_clk */
  589. 0x70, /* gcc_sdcc2_apps_clk */
  590. 0x73, /* gcc_sdcc4_ahb_clk */
  591. 0x72, /* gcc_sdcc4_apps_clk */
  592. 0xC, /* gcc_sys_noc_cpuss_ahb_clk */
  593. 0x90, /* gcc_tsif_ahb_clk */
  594. 0x92, /* gcc_tsif_inactivity_timers_clk */
  595. 0x91, /* gcc_tsif_ref_clk */
  596. 0x18B, /* gcc_ufs_card_2_ahb_clk */
  597. 0x18A, /* gcc_ufs_card_2_axi_clk */
  598. 0x191, /* gcc_ufs_card_2_ice_core_clk */
  599. 0x192, /* gcc_ufs_card_2_phy_aux_clk */
  600. 0x18D, /* gcc_ufs_card_2_rx_symbol_0_clk */
  601. 0x193, /* gcc_ufs_card_2_rx_symbol_1_clk */
  602. 0x18C, /* gcc_ufs_card_2_tx_symbol_0_clk */
  603. 0x190, /* gcc_ufs_card_2_unipro_core_clk */
  604. 0xF1, /* gcc_ufs_card_ahb_clk */
  605. 0xF0, /* gcc_ufs_card_axi_clk */
  606. 0xF7, /* gcc_ufs_card_ice_core_clk */
  607. 0xF8, /* gcc_ufs_card_phy_aux_clk */
  608. 0xF3, /* gcc_ufs_card_rx_symbol_0_clk */
  609. 0xF9, /* gcc_ufs_card_rx_symbol_1_clk */
  610. 0xF2, /* gcc_ufs_card_tx_symbol_0_clk */
  611. 0xF6, /* gcc_ufs_card_unipro_core_clk */
  612. 0xFC, /* gcc_ufs_phy_ahb_clk */
  613. 0xFB, /* gcc_ufs_phy_axi_clk */
  614. 0x102, /* gcc_ufs_phy_ice_core_clk */
  615. 0x103, /* gcc_ufs_phy_phy_aux_clk */
  616. 0xFE, /* gcc_ufs_phy_rx_symbol_0_clk */
  617. 0x104, /* gcc_ufs_phy_rx_symbol_1_clk */
  618. 0xFD, /* gcc_ufs_phy_tx_symbol_0_clk */
  619. 0x101, /* gcc_ufs_phy_unipro_core_clk */
  620. 0x1AF, /* gcc_usb30_mp_master_clk */
  621. 0x1B1, /* gcc_usb30_mp_mock_utmi_clk */
  622. 0x1B0, /* gcc_usb30_mp_sleep_clk */
  623. 0x5F, /* gcc_usb30_prim_master_clk */
  624. 0x61, /* gcc_usb30_prim_mock_utmi_clk */
  625. 0x60, /* gcc_usb30_prim_sleep_clk */
  626. 0x65, /* gcc_usb30_sec_master_clk */
  627. 0x67, /* gcc_usb30_sec_mock_utmi_clk */
  628. 0x66, /* gcc_usb30_sec_sleep_clk */
  629. 0x1BD, /* gcc_usb3_mp_phy_aux_clk */
  630. 0x1BE, /* gcc_usb3_mp_phy_com_aux_clk */
  631. 0x1BF, /* gcc_usb3_mp_phy_pipe_0_clk */
  632. 0x1C0, /* gcc_usb3_mp_phy_pipe_1_clk */
  633. 0x62, /* gcc_usb3_prim_phy_aux_clk */
  634. 0x63, /* gcc_usb3_prim_phy_com_aux_clk */
  635. 0x64, /* gcc_usb3_prim_phy_pipe_clk */
  636. 0x68, /* gcc_usb3_sec_phy_aux_clk */
  637. 0x69, /* gcc_usb3_sec_phy_com_aux_clk */
  638. 0x6A, /* gcc_usb3_sec_phy_pipe_clk */
  639. 0x3F, /* gcc_video_axi0_clk */
  640. 0x1A7, /* gcc_video_axi1_clk */
  641. 0x1A8, /* gcc_video_axic_clk */
  642. 0x144, /* gpu_cc_debug_mux */
  643. 0x15, /* measure_only_cnoc_clk */
  644. 0x128, /* measure_only_ipa_2x_clk */
  645. 0x7, /* measure_only_snoc_clk */
  646. 0x1C6, /* npu_cc_debug_mux */
  647. 0x48, /* video_cc_debug_mux */
  648. 0xC2, /* mc_cc_debug_mux */
  649. };
  650. static struct clk_debug_mux gcc_debug_mux = {
  651. .priv = &debug_mux_priv,
  652. .debug_offset = 0x62000,
  653. .post_div_offset = 0x62004,
  654. .cbcr_offset = 0x62008,
  655. .src_sel_mask = 0x3FF,
  656. .src_sel_shift = 0,
  657. .post_div_mask = 0xF,
  658. .post_div_shift = 0,
  659. .post_div_val = 2,
  660. .mux_sels = gcc_debug_mux_sels,
  661. .num_mux_sels = ARRAY_SIZE(gcc_debug_mux_sels),
  662. .hw.init = &(struct clk_init_data){
  663. .name = "gcc_debug_mux",
  664. .ops = &clk_debug_mux_ops,
  665. .parent_names = gcc_debug_mux_parent_names,
  666. .num_parents = ARRAY_SIZE(gcc_debug_mux_parent_names),
  667. },
  668. };
  669. static const char *const gpu_cc_debug_mux_parent_names[] = {
  670. "gpu_cc_crc_ahb_clk",
  671. "gpu_cc_cx_gmu_clk",
  672. "gpu_cc_cx_snoc_dvm_clk",
  673. "gpu_cc_cxo_aon_clk",
  674. "gpu_cc_cxo_clk",
  675. "gpu_cc_gx_gmu_clk",
  676. "gpu_cc_sleep_clk",
  677. };
  678. static int gpu_cc_debug_mux_sels[] = {
  679. 0x11, /* gpu_cc_crc_ahb_clk */
  680. 0x18, /* gpu_cc_cx_gmu_clk */
  681. 0x15, /* gpu_cc_cx_snoc_dvm_clk */
  682. 0xA, /* gpu_cc_cxo_aon_clk */
  683. 0x19, /* gpu_cc_cxo_clk */
  684. 0xF, /* gpu_cc_gx_gmu_clk */
  685. 0x16, /* gpu_cc_sleep_clk */
  686. };
  687. static struct clk_debug_mux gpu_cc_debug_mux = {
  688. .priv = &debug_mux_priv,
  689. .debug_offset = 0x1568,
  690. .post_div_offset = 0x10FC,
  691. .cbcr_offset = 0x1100,
  692. .src_sel_mask = 0xFF,
  693. .src_sel_shift = 0,
  694. .post_div_mask = 0x3,
  695. .post_div_shift = 0,
  696. .post_div_val = 2,
  697. .mux_sels = gpu_cc_debug_mux_sels,
  698. .num_mux_sels = ARRAY_SIZE(gpu_cc_debug_mux_sels),
  699. .hw.init = &(struct clk_init_data){
  700. .name = "gpu_cc_debug_mux",
  701. .ops = &clk_debug_mux_ops,
  702. .parent_names = gpu_cc_debug_mux_parent_names,
  703. .num_parents = ARRAY_SIZE(gpu_cc_debug_mux_parent_names),
  704. },
  705. };
  706. static const char *const npu_cc_debug_mux_parent_names[] = {
  707. "npu_cc_armwic_core_clk",
  708. "npu_cc_bto_core_clk",
  709. "npu_cc_bwmon_clk",
  710. "npu_cc_cal_dp_cdc_clk",
  711. "npu_cc_cal_dp_clk",
  712. "npu_cc_comp_noc_axi_clk",
  713. "npu_cc_conf_noc_ahb_clk",
  714. "npu_cc_npu_core_clk",
  715. "npu_cc_npu_core_cti_clk",
  716. "npu_cc_npu_cpc_clk",
  717. "npu_cc_npu_cpc_timer_clk",
  718. "npu_cc_perf_cnt_clk",
  719. "npu_cc_qtimer_core_clk",
  720. "npu_cc_sleep_clk",
  721. };
  722. static int npu_cc_debug_mux_sels[] = {
  723. 0x4, /* npu_cc_armwic_core_clk */
  724. 0x12, /* npu_cc_bto_core_clk */
  725. 0xF, /* npu_cc_bwmon_clk */
  726. 0x8, /* npu_cc_cal_dp_cdc_clk */
  727. 0x1, /* npu_cc_cal_dp_clk */
  728. 0x9, /* npu_cc_comp_noc_axi_clk */
  729. 0xA, /* npu_cc_conf_noc_ahb_clk */
  730. 0x2, /* npu_cc_npu_core_clk */
  731. 0xC, /* npu_cc_npu_core_cti_clk */
  732. 0x3, /* npu_cc_npu_cpc_clk */
  733. 0x5, /* npu_cc_npu_cpc_timer_clk */
  734. 0x10, /* npu_cc_perf_cnt_clk */
  735. 0x6, /* npu_cc_qtimer_core_clk */
  736. 0x7, /* npu_cc_sleep_clk */
  737. };
  738. static struct clk_debug_mux npu_cc_debug_mux = {
  739. .priv = &debug_mux_priv,
  740. .debug_offset = 0x4000,
  741. .post_div_offset = 0x3004,
  742. .cbcr_offset = 0x3008,
  743. .src_sel_mask = 0xFF,
  744. .src_sel_shift = 0,
  745. .post_div_mask = 0x3,
  746. .post_div_shift = 0,
  747. .post_div_val = 2,
  748. .mux_sels = npu_cc_debug_mux_sels,
  749. .num_mux_sels = ARRAY_SIZE(npu_cc_debug_mux_sels),
  750. .hw.init = &(struct clk_init_data){
  751. .name = "npu_cc_debug_mux",
  752. .ops = &clk_debug_mux_ops,
  753. .parent_names = npu_cc_debug_mux_parent_names,
  754. .num_parents = ARRAY_SIZE(npu_cc_debug_mux_parent_names),
  755. },
  756. };
  757. static const char *const video_cc_debug_mux_parent_names[] = {
  758. "video_cc_iris_ahb_clk",
  759. "video_cc_mvs0_core_clk",
  760. "video_cc_mvs1_core_clk",
  761. "video_cc_mvsc_core_clk",
  762. };
  763. static int video_cc_debug_mux_sels[] = {
  764. 0x7, /* video_cc_iris_ahb_clk */
  765. 0x3, /* video_cc_mvs0_core_clk */
  766. 0x5, /* video_cc_mvs1_core_clk */
  767. 0x1, /* video_cc_mvsc_core_clk */
  768. };
  769. static struct clk_debug_mux video_cc_debug_mux = {
  770. .priv = &debug_mux_priv,
  771. .debug_offset = 0xA4C,
  772. .post_div_offset = 0x938,
  773. .cbcr_offset = 0x940,
  774. .src_sel_mask = 0x3F,
  775. .src_sel_shift = 0,
  776. .post_div_mask = 0x7,
  777. .post_div_shift = 0,
  778. .post_div_val = 5,
  779. .mux_sels = video_cc_debug_mux_sels,
  780. .num_mux_sels = ARRAY_SIZE(video_cc_debug_mux_sels),
  781. .hw.init = &(struct clk_init_data){
  782. .name = "video_cc_debug_mux",
  783. .ops = &clk_debug_mux_ops,
  784. .parent_names = video_cc_debug_mux_parent_names,
  785. .num_parents = ARRAY_SIZE(video_cc_debug_mux_parent_names),
  786. },
  787. };
  788. static const char *const mc_cc_debug_mux_parent_names[] = {
  789. "measure_only_mccc_clk",
  790. };
  791. static struct clk_debug_mux mc_cc_debug_mux = {
  792. .period_offset = 0x50,
  793. .hw.init = &(struct clk_init_data){
  794. .name = "mc_cc_debug_mux",
  795. .ops = &clk_debug_mux_ops,
  796. .parent_names = mc_cc_debug_mux_parent_names,
  797. .num_parents = ARRAY_SIZE(mc_cc_debug_mux_parent_names),
  798. },
  799. };
  800. static struct mux_regmap_names mux_list[] = {
  801. { .mux = &apss_cc_debug_mux, .regmap_name = "qcom,apsscc" },
  802. { .mux = &cam_cc_debug_mux, .regmap_name = "qcom,camcc" },
  803. { .mux = &disp_cc_debug_mux, .regmap_name = "qcom,dispcc" },
  804. { .mux = &gpu_cc_debug_mux, .regmap_name = "qcom,gpucc" },
  805. { .mux = &mc_cc_debug_mux, .regmap_name = "qcom,mccc" },
  806. { .mux = &npu_cc_debug_mux, .regmap_name = "qcom,npucc" },
  807. { .mux = &video_cc_debug_mux, .regmap_name = "qcom,videocc" },
  808. { .mux = &gcc_debug_mux, .regmap_name = "qcom,gcc" },
  809. };
  810. static struct clk_dummy measure_only_apcs_gold_post_acd_clk = {
  811. .rrate = 1000,
  812. .hw.init = &(struct clk_init_data){
  813. .name = "measure_only_apcs_gold_post_acd_clk",
  814. .ops = &clk_dummy_ops,
  815. },
  816. };
  817. static struct clk_dummy measure_only_apcs_l3_post_acd_clk = {
  818. .rrate = 1000,
  819. .hw.init = &(struct clk_init_data){
  820. .name = "measure_only_apcs_l3_post_acd_clk",
  821. .ops = &clk_dummy_ops,
  822. },
  823. };
  824. static struct clk_dummy measure_only_apcs_silver_post_acd_clk = {
  825. .rrate = 1000,
  826. .hw.init = &(struct clk_init_data){
  827. .name = "measure_only_apcs_silver_post_acd_clk",
  828. .ops = &clk_dummy_ops,
  829. },
  830. };
  831. static struct clk_dummy measure_only_cnoc_clk = {
  832. .rrate = 1000,
  833. .hw.init = &(struct clk_init_data){
  834. .name = "measure_only_cnoc_clk",
  835. .ops = &clk_dummy_ops,
  836. },
  837. };
  838. static struct clk_dummy measure_only_ipa_2x_clk = {
  839. .rrate = 1000,
  840. .hw.init = &(struct clk_init_data){
  841. .name = "measure_only_ipa_2x_clk",
  842. .ops = &clk_dummy_ops,
  843. },
  844. };
  845. static struct clk_dummy measure_only_mccc_clk = {
  846. .rrate = 1000,
  847. .hw.init = &(struct clk_init_data){
  848. .name = "measure_only_mccc_clk",
  849. .ops = &clk_dummy_ops,
  850. },
  851. };
  852. static struct clk_dummy measure_only_snoc_clk = {
  853. .rrate = 1000,
  854. .hw.init = &(struct clk_init_data){
  855. .name = "measure_only_snoc_clk",
  856. .ops = &clk_dummy_ops,
  857. },
  858. };
  859. static struct clk_hw *debugcc_sc8180x_hws[] = {
  860. &measure_only_apcs_gold_post_acd_clk.hw,
  861. &measure_only_apcs_l3_post_acd_clk.hw,
  862. &measure_only_apcs_silver_post_acd_clk.hw,
  863. &measure_only_cnoc_clk.hw,
  864. &measure_only_ipa_2x_clk.hw,
  865. &measure_only_mccc_clk.hw,
  866. &measure_only_snoc_clk.hw,
  867. };
  868. static const struct of_device_id clk_debug_match_table[] = {
  869. { .compatible = "qcom,sc8180x-debugcc" },
  870. { }
  871. };
  872. static int clk_debug_sc8180x_probe(struct platform_device *pdev)
  873. {
  874. struct clk *clk;
  875. int ret, i;
  876. BUILD_BUG_ON(ARRAY_SIZE(apss_cc_debug_mux_parent_names) !=
  877. ARRAY_SIZE(apss_cc_debug_mux_sels));
  878. BUILD_BUG_ON(ARRAY_SIZE(cam_cc_debug_mux_parent_names) !=
  879. ARRAY_SIZE(cam_cc_debug_mux_sels));
  880. BUILD_BUG_ON(ARRAY_SIZE(disp_cc_debug_mux_parent_names) !=
  881. ARRAY_SIZE(disp_cc_debug_mux_sels));
  882. BUILD_BUG_ON(ARRAY_SIZE(gcc_debug_mux_parent_names) !=
  883. ARRAY_SIZE(gcc_debug_mux_sels));
  884. BUILD_BUG_ON(ARRAY_SIZE(gpu_cc_debug_mux_parent_names) !=
  885. ARRAY_SIZE(gpu_cc_debug_mux_sels));
  886. BUILD_BUG_ON(ARRAY_SIZE(npu_cc_debug_mux_parent_names) !=
  887. ARRAY_SIZE(npu_cc_debug_mux_sels));
  888. BUILD_BUG_ON(ARRAY_SIZE(video_cc_debug_mux_parent_names) !=
  889. ARRAY_SIZE(video_cc_debug_mux_sels));
  890. clk = devm_clk_get(&pdev->dev, "xo_clk_src");
  891. if (IS_ERR(clk)) {
  892. if (PTR_ERR(clk) != -EPROBE_DEFER)
  893. dev_err(&pdev->dev, "Unable to get xo clock\n");
  894. return PTR_ERR(clk);
  895. }
  896. debug_mux_priv.cxo = clk;
  897. for (i = 0; i < ARRAY_SIZE(mux_list); i++) {
  898. ret = map_debug_bases(pdev, mux_list[i].regmap_name,
  899. mux_list[i].mux);
  900. if (ret == -EBADR)
  901. continue;
  902. else if (ret)
  903. return ret;
  904. }
  905. for (i = 0; i < ARRAY_SIZE(debugcc_sc8180x_hws); i++) {
  906. clk = devm_clk_register(&pdev->dev, debugcc_sc8180x_hws[i]);
  907. if (IS_ERR(clk)) {
  908. dev_err(&pdev->dev, "Unable to register %s, err:(%d)\n",
  909. clk_hw_get_name(debugcc_sc8180x_hws[i]),
  910. PTR_ERR(clk));
  911. return PTR_ERR(clk);
  912. }
  913. }
  914. for (i = 0; i < ARRAY_SIZE(mux_list); i++) {
  915. if (!mux_list[i].mux->regmap)
  916. continue;
  917. ret = devm_clk_register_debug_mux(&pdev->dev, mux_list[i].mux);
  918. if (ret) {
  919. dev_err(&pdev->dev, "Unable to register mux clk %s, err:(%d)\n",
  920. clk_hw_get_name(&mux_list[i].mux->hw),
  921. ret);
  922. return ret;
  923. }
  924. }
  925. ret = clk_debug_measure_register(&gcc_debug_mux.hw);
  926. if (ret) {
  927. dev_err(&pdev->dev, "Could not register Measure clocks\n");
  928. return ret;
  929. }
  930. dev_info(&pdev->dev, "Registered debug measure clocks\n");
  931. return ret;
  932. }
  933. static struct platform_driver clk_debug_driver = {
  934. .probe = clk_debug_sc8180x_probe,
  935. .driver = {
  936. .name = "sc8180x-debugcc",
  937. .of_match_table = clk_debug_match_table,
  938. },
  939. };
  940. static int __init clk_debug_sc8180x_init(void)
  941. {
  942. return platform_driver_register(&clk_debug_driver);
  943. }
  944. fs_initcall(clk_debug_sc8180x_init);
  945. MODULE_DESCRIPTION("QTI DEBUG CC SC8180X Driver");
  946. MODULE_LICENSE("GPL");