debugcc-kalama.c 29 KB

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