blob: 480ff9c228c48f61b228ac64087e2ad034c341c0 [file] [log] [blame]
xjb04a4022021-11-25 15:01:52 +08001// SPDX-License-Identifier: GPL-2.0
2
3/*
4
5 * Copyright (c) 2019 MediaTek Inc.
6
7 */
8
9#include <linux/clk-provider.h>
10#include <linux/syscore_ops.h>
11#include <linux/version.h>
12#include <linux/module.h>
13
14#include "clkchk.h"
15//#include <mt-plat/aee.h>
16#include "clkdbg-mt6880.h"
17
18#define TAG "[clkchk] "
19#define BUG_ON_CHK_ENABLE 0
20
21static const char * const clks[] = {
22 /* topckgen */
23 "axi_sel",
24 "spm_sel",
25 "bus_aximem_sel",
26 "mm_sel",
27 "mfg_ref_sel",
28 "mfg_sel",
29 "uart_sel",
30 "msdc50_0_h_sel",
31 "msdc50_0_sel",
32 "msdc30_1_sel",
33 "audio_sel",
34 "aud_intbus_sel",
35 "aud_engen1_sel",
36 "aud_engen2_sel",
37 "aud_1_sel",
38 "aud_2_sel",
39 "pwrap_ulposc_sel",
40 "atb_sel",
41 "pwrmcu_sel",
42 "dbi_sel",
43 "disp_pwm_sel",
44 "usb_sel",
45 "ssusb_xhci_sel",
46 "i2c_sel",
47 "tl_sel",
48 "dpmaif_main_sel",
49 "pwm_sel",
50 "spmi_m_mst_sel",
51 "spmi_p_mst_sel",
52 "dvfsrc_sel",
53 "mcupm_sel",
54 "sflash_sel",
55 "gcpu_sel",
56 "spi_sel",
57 "spis_sel",
58 "ecc_sel",
59 "nfi1x_sel",
60 "spinfi_bclk_sel",
61 "netsys_sel",
62 "medsys_sel",
63 "hsm_crypto_sel",
64 "hsm_arc_sel",
65 "eip97_sel",
66 "snps_eth_312p5m_sel",
67 "snps_eth_250m_sel",
68 "snps_ptp_sel",
69 "snps_rmii_sel",
70 "netsys_500m_sel",
71 "netsys_med_mcu_sel",
72 "netsys_wed_mcu_sel",
73 "netsys_2x_sel",
74 "sgmii_sel",
75 "sgmii_sbus_sel",
76 "apll_i2s0_mck_sel",
77 "apll_i2s1_mck_sel",
78 "apll_i2s2_mck_sel",
79 "apll_i2s4_mck_sel",
80 "apll_tdmout_mck_sel",
81 "apll_i2s5_mck_sel",
82 "apll_i2s6_mck_sel",
83
84 /* topckgen */
85 "apll12_div0",
86 "apll12_div1",
87 "apll12_div2",
88 "apll12_div4",
89 "apll12_div_tdmout_m",
90 "apll12_div_tdmout_b",
91 "apll12_div5",
92 "apll12_div6",
93
94 /* dbgsys_dem */
95 "dbgsys_dem_atb_en",
96 "dbgsys_dem_busclk_en",
97 "dbgsys_dem_sysclk_en",
98
99 /* infracfg_ao */
100 "ifrao_pmic_tmr_set",
101 "ifrao_pmic_ap_set",
102 "ifrao_pmic_md_set",
103 "ifrao_pmic_conn_set",
104 "ifrao_sej",
105 "ifrao_apxgpt",
106 "ifrao_mcupm",
107 "ifrao_gce",
108 "ifrao_gce2",
109 "ifrao_therm",
110 "ifrao_i2c0",
111 "ifrao_i2c1",
112 "ifrao_i2c2",
113 "ifrao_i2c3",
114 "ifrao_pwm_hclk",
115 "ifrao_pwm1",
116 "ifrao_pwm2",
117 "ifrao_pwm3",
118 "ifrao_pwm4",
119 "ifrao_pwm5",
120 "ifrao_pwm",
121 "ifrao_uart0",
122 "ifrao_uart1",
123 "ifrao_uart2",
124 "ifrao_uart3",
125 "ifrao_gce_26m_set",
126 "ifrao_spi0",
127 "ifrao_msdc0",
128 "ifrao_msdc1",
129 "ifrao_msdc0_clk",
130 "ifrao_gcpu",
131 "ifrao_trng",
132 "ifrao_auxadc",
133 "ifrao_cpum",
134 "ifrao_ccif1_ap",
135 "ifrao_ccif1_md",
136 "ifrao_auxadc_md",
137 "ifrao_pcie_tl_26m",
138 "ifrao_msdc1_clk",
139 "ifrao_pcie_tl_96m",
140 "ifrao_dapc",
141 "ifrao_ccif_ap",
142 "ifrao_debugsys",
143 "ifrao_audio",
144 "ifrao_ccif_md",
145 "ifrao_devmpu_bclk",
146 "ifrao_dramc26",
147 "ifrao_ssusb",
148 "ifrao_disp_pwm",
149 "ifrao_cldmabclk",
150 "ifrao_audio26m",
151 "ifrao_mdtemp",
152 "ifrao_spi1",
153 "ifrao_i2c4",
154 "ifrao_spi2",
155 "ifrao_spi3",
156 "ifrao_unipro_tick",
157 "ifrao_ufs_bclk",
158 "ifrao_md32_bclk",
159 "ifrao_unipro_mbist",
160 "ifrao_pwm6",
161 "ifrao_pwm7",
162 "ifrao_i2c_slave",
163 "ifrao_i2c1a",
164 "ifrao_i2c1_imm",
165 "ifrao_i2c2a",
166 "ifrao_i2c2_imm",
167 "ifrao_ssusb_xhci",
168 "ifrao_msdc0sf",
169 "ifrao_msdc1sf",
170 "ifrao_msdc2sf",
171 "ifrao_sspm_26m",
172 "ifrao_sspm_32k",
173 "ifrao_i2c6",
174 "ifrao_ap_msdc0",
175 "ifrao_md_msdc0",
176 "ifrao_ccif5_ap",
177 "ifrao_ccif5_md",
178 "ifrao_pcie_h_133m",
179 "ifrao_spis_h_66m",
180 "ifrao_pcie_peri_26m",
181 "ifrao_ccif2_ap",
182 "ifrao_ccif2_md",
183 "ifrao_sej_f13m",
184 "ifrao_aes",
185 "ifrao_i2c7",
186 "ifrao_i2c8",
187 "ifrao_fbist2fpc",
188 "ifrao_dpmaif_main",
189 "ifrao_pcie_tl_32k",
190 "ifrao_ccif4_ap",
191 "ifrao_ccif4_md",
192 "ifrao_133m_mclk_ck",
193 "ifrao_66m_mclk_ck",
194 "ifrao_infra_133m",
195 "ifrao_infra_66m",
196 "ifrao_peru_bus_133m",
197 "ifrao_peru_bus_66m",
198 "ifrao_133m_cldma_top",
199 "ifrao_ecc_top",
200 "ifrao_66m_gcpu",
201 "ifrao_133m_dwc_ether",
202 "ifrao_133m_flashif",
203 "ifrao_133m_pcie_p0",
204 "ifrao_133m_pcie_p1",
205 "ifrao_133m_pcie_p2",
206 "ifrao_133m_pcie_p3",
207 "ifrao_mmw_dpmaif_ck",
208 "ifrao_nfi",
209 "ifrao_fpinfi_bclk_ck",
210 "ifrao_66m_nfi_h_ck",
211 "ifrao_fspis_ck",
212 "ifrao_26m_p1",
213 "ifrao_26m_p2",
214 "ifrao_26m_p3",
215 "ifrao_flash_26m",
216 "ifrao_sflash_ck",
217
218 /* apmixedsys */
219 "armpll_ll",
220 "ccipll",
221 "mpll",
222 "mainpll",
223 "univpll",
224 "msdcpll",
225 "mmpll",
226 "mfgpll",
227 "apll1",
228 "apll2",
229 "net1pll",
230 "net2pll",
231 "wedmcupll",
232 "medmcupll",
233 "sgmiipll",
234
235 /* gce */
236 "gce_0",
237
238 /* audiosys */
239 "aud_afe",
240 "aud_22m",
241 "aud_24m",
242 "aud_apll2_tuner",
243 "aud_apll_tuner",
244 "aud_tdm_ck",
245 "aud_adc",
246 "aud_dac",
247 "aud_dac_predis",
248 "aud_tml",
249 "aud_i2s0_bclk",
250 "aud_i2s1_bclk",
251 "aud_i2s2_bclk",
252 "aud_i2s4_bclk",
253 "aud_i2s5_bclk",
254 "aud_i2s6_bclk",
255 "aud_general1_asrc",
256 "aud_general2_asrc",
257 "aud_adda6_adc",
258 "aud_connsys_i2s_asrc",
259 "aud_afe_src_pcm_tx",
260 "aud_afe_src_pcm_tx2",
261 "aud_afe_src_pcm_tx3",
262 "aud_afe_src_pcm_rx",
263 "aud_afe_src_i2sin",
264 "aud_afe_src_i2sout",
265
266 /* imp_iic_wrap_e */
267 "impe_i2c0_ro",
268 "impe_i2c1_ro",
269 "impe_i2c2_ro",
270 "impe_i2c3_ro",
271 "impe_i2c4_ro",
272 "impe_i2c5_ro",
273
274 /* mfgsys */
275 "mfgcfg_bg3d",
276
277 /* mmsys */
278 "mmsys_mutex0",
279 "mmsys_apb_bus",
280 "mm_mdp_rsz0",
281 "mm_disp_gamma0",
282 "mm_mdp_wrot0",
283 "mm_disp_color0",
284 "mm_disp_ccorr0",
285 "mm_disp_aal0",
286 "mm_disp_rdma0",
287 "mm_mdp_rdma0",
288 "mmsys_fake_eng0",
289 "mm_disp_dither0",
290 "mm_disp_wdma0",
291 "mm_mdp_tdshp0",
292 "mm_disp_ovl0",
293 "mm_dbpi0",
294 "mm_disp_dsi0",
295 "mmsys_smi_common",
296 "disp_axi",
297 "dsi",
298 "dbi",
299 NULL
300};
301
302const char * const *get_mt6880_all_clk_names(void)
303{
304 return clks;
305}
306
307static const char * const off_pll_names[] = {
308 "armpll_ll",
309 "ccipll",
310 "mpll",
311 "mainpll",
312 "univpll",
313 "msdcpll",
314 "mmpll",
315 "mfgpll",
316 "apll1",
317 "apll2",
318 "net1pll",
319 "net2pll",
320 "wedmcupll",
321 "medmcupll",
322 "sgmiipll",
323 NULL
324};
325
326static const char * const notice_pll_names[] = {
327 NULL
328};
329
330/*6890 dtsi defined as 6880 too*/
331static const char * const compatible[] = {"mediatek,mt6880", NULL};
332
333static struct clkchk_cfg_t cfg = {
334 .aee_excp_on_fail = false,
335 .warn_on_fail = false,
336 .compatible = compatible,
337 .off_pll_names = off_pll_names,
338 .all_clk_names = clks,
339};
340
341static int __init clkchk_mt6880_init(void)
342{
343 return clkchk_init(&cfg);
344}
345subsys_initcall(clkchk_mt6880_init);