blob: daf9a2b351a2b4ff74c7d9b8306c5c8080012590 [file] [log] [blame]
Tom Warrenb7ea6d12014-01-24 12:46:13 -07001/*
2 * (C) Copyright 2013
3 * NVIDIA Corporation <www.nvidia.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8/* Tegra124 clock PLL tables */
9
10#ifndef _TEGRA124_CLOCK_TABLES_H_
11#define _TEGRA124_CLOCK_TABLES_H_
12
13/* The PLLs supported by the hardware */
14enum clock_id {
15 CLOCK_ID_FIRST,
16 CLOCK_ID_CGENERAL = CLOCK_ID_FIRST,
17 CLOCK_ID_MEMORY,
18 CLOCK_ID_PERIPH,
19 CLOCK_ID_AUDIO,
20 CLOCK_ID_USB,
21 CLOCK_ID_DISPLAY,
22
23 /* now the simple ones */
24 CLOCK_ID_FIRST_SIMPLE,
25 CLOCK_ID_XCPU = CLOCK_ID_FIRST_SIMPLE,
26 CLOCK_ID_EPCI,
27 CLOCK_ID_SFROM32KHZ,
28
29 /* These are the base clocks (inputs to the Tegra SoC) */
30 CLOCK_ID_32KHZ,
31 CLOCK_ID_OSC,
32
33 CLOCK_ID_COUNT, /* number of PLLs */
34
35 /*
36 * These are clock IDs that are used in table clock_source[][]
37 * but will not be assigned as a clock source for any peripheral.
38 */
39 CLOCK_ID_DISPLAY2,
40 CLOCK_ID_CGENERAL2,
41 CLOCK_ID_CGENERAL3,
42 CLOCK_ID_MEMORY2,
43 CLOCK_ID_SRC2,
44
45 CLOCK_ID_NONE = -1,
46};
47
48/* The clocks supported by the hardware */
49enum periph_id {
50 PERIPH_ID_FIRST,
51
52 /* Low word: 31:0 (DEVICES_L) */
53 PERIPH_ID_CPU = PERIPH_ID_FIRST,
54 PERIPH_ID_COP,
55 PERIPH_ID_TRIGSYS,
56 PERIPH_ID_ISPB,
57 PERIPH_ID_RESERVED4,
58 PERIPH_ID_TMR,
59 PERIPH_ID_UART1,
60 PERIPH_ID_UART2,
61
62 /* 8 */
63 PERIPH_ID_GPIO,
64 PERIPH_ID_SDMMC2,
65 PERIPH_ID_SPDIF,
66 PERIPH_ID_I2S1,
67 PERIPH_ID_I2C1,
68 PERIPH_ID_RESERVED13,
69 PERIPH_ID_SDMMC1,
70 PERIPH_ID_SDMMC4,
71
72 /* 16 */
73 PERIPH_ID_TCW,
74 PERIPH_ID_PWM,
75 PERIPH_ID_I2S2,
76 PERIPH_ID_RESERVED19,
77 PERIPH_ID_VI,
78 PERIPH_ID_RESERVED21,
79 PERIPH_ID_USBD,
80 PERIPH_ID_ISP,
81
82 /* 24 */
83 PERIPH_ID_RESERVED24,
84 PERIPH_ID_RESERVED25,
85 PERIPH_ID_DISP2,
86 PERIPH_ID_DISP1,
87 PERIPH_ID_HOST1X,
88 PERIPH_ID_VCP,
89 PERIPH_ID_I2S0,
90 PERIPH_ID_CACHE2,
91
92 /* Middle word: 63:32 (DEVICES_H) */
93 PERIPH_ID_MEM,
94 PERIPH_ID_AHBDMA,
95 PERIPH_ID_APBDMA,
96 PERIPH_ID_RESERVED35,
97 PERIPH_ID_RESERVED36,
98 PERIPH_ID_STAT_MON,
99 PERIPH_ID_RESERVED38,
100 PERIPH_ID_FUSE,
101
102 /* 40 */
103 PERIPH_ID_KFUSE,
104 PERIPH_ID_SBC1,
105 PERIPH_ID_SNOR,
106 PERIPH_ID_RESERVED43,
107 PERIPH_ID_SBC2,
108 PERIPH_ID_XIO,
109 PERIPH_ID_SBC3,
110 PERIPH_ID_I2C5,
111
112 /* 48 */
113 PERIPH_ID_DSI,
114 PERIPH_ID_RESERVED49,
115 PERIPH_ID_HSI,
116 PERIPH_ID_HDMI,
117 PERIPH_ID_CSI,
118 PERIPH_ID_RESERVED53,
119 PERIPH_ID_I2C2,
120 PERIPH_ID_UART3,
121
122 /* 56 */
123 PERIPH_ID_MIPI_CAL,
124 PERIPH_ID_EMC,
125 PERIPH_ID_USB2,
126 PERIPH_ID_USB3,
127 PERIPH_ID_RESERVED60,
128 PERIPH_ID_VDE,
129 PERIPH_ID_BSEA,
130 PERIPH_ID_BSEV,
131
132 /* Upper word 95:64 (DEVICES_U) */
133 PERIPH_ID_RESERVED64,
134 PERIPH_ID_UART4,
135 PERIPH_ID_UART5,
136 PERIPH_ID_I2C3,
137 PERIPH_ID_SBC4,
138 PERIPH_ID_SDMMC3,
139 PERIPH_ID_PCIE,
140 PERIPH_ID_OWR,
141
142 /* 72 */
143 PERIPH_ID_AFI,
144 PERIPH_ID_CORESIGHT,
145 PERIPH_ID_PCIEXCLK,
146 PERIPH_ID_AVPUCQ,
147 PERIPH_ID_LA,
148 PERIPH_ID_TRACECLKIN,
149 PERIPH_ID_SOC_THERM,
150 PERIPH_ID_DTV,
151
152 /* 80 */
153 PERIPH_ID_RESERVED80,
154 PERIPH_ID_I2CSLOW,
155 PERIPH_ID_DSIB,
156 PERIPH_ID_TSEC,
157 PERIPH_ID_RESERVED84,
158 PERIPH_ID_RESERVED85,
159 PERIPH_ID_RESERVED86,
160 PERIPH_ID_EMUCIF,
161
162 /* 88 */
163 PERIPH_ID_RESERVED88,
164 PERIPH_ID_XUSB_HOST,
165 PERIPH_ID_RESERVED90,
166 PERIPH_ID_MSENC,
167 PERIPH_ID_RESERVED92,
168 PERIPH_ID_RESERVED93,
169 PERIPH_ID_RESERVED94,
170 PERIPH_ID_XUSB_DEV,
171
172 PERIPH_ID_VW_FIRST,
173 /* V word: 31:0 */
174 PERIPH_ID_CPUG = PERIPH_ID_VW_FIRST,
175 PERIPH_ID_CPULP,
176 PERIPH_ID_V_RESERVED2,
177 PERIPH_ID_MSELECT,
178 PERIPH_ID_V_RESERVED4,
179 PERIPH_ID_I2S3,
180 PERIPH_ID_I2S4,
181 PERIPH_ID_I2C4,
182
183 /* 104 */
184 PERIPH_ID_SBC5,
185 PERIPH_ID_SBC6,
186 PERIPH_ID_AUDIO,
187 PERIPH_ID_APBIF,
188 PERIPH_ID_DAM0,
189 PERIPH_ID_DAM1,
190 PERIPH_ID_DAM2,
191 PERIPH_ID_HDA2CODEC2X,
192
193 /* 112 */
194 PERIPH_ID_ATOMICS,
195 PERIPH_ID_V_RESERVED17,
196 PERIPH_ID_V_RESERVED18,
197 PERIPH_ID_V_RESERVED19,
198 PERIPH_ID_V_RESERVED20,
199 PERIPH_ID_V_RESERVED21,
200 PERIPH_ID_V_RESERVED22,
201 PERIPH_ID_ACTMON,
202
203 /* 120 */
204 PERIPH_ID_EXTPERIPH1,
205 PERIPH_ID_EXTPERIPH2,
206 PERIPH_ID_EXTPERIPH3,
207 PERIPH_ID_OOB,
208 PERIPH_ID_SATA,
209 PERIPH_ID_HDA,
210 PERIPH_ID_V_RESERVED30,
211 PERIPH_ID_V_RESERVED31,
212
213 /* W word: 31:0 */
214 PERIPH_ID_HDA2HDMICODEC,
215 PERIPH_ID_SATACOLD,
216 PERIPH_ID_W_RESERVED2,
217 PERIPH_ID_W_RESERVED3,
218 PERIPH_ID_W_RESERVED4,
219 PERIPH_ID_W_RESERVED5,
220 PERIPH_ID_W_RESERVED6,
221 PERIPH_ID_W_RESERVED7,
222
223 /* 136 */
224 PERIPH_ID_CEC,
225 PERIPH_ID_W_RESERVED9,
226 PERIPH_ID_W_RESERVED10,
227 PERIPH_ID_W_RESERVED11,
228 PERIPH_ID_W_RESERVED12,
229 PERIPH_ID_W_RESERVED13,
230 PERIPH_ID_XUSB_PADCTL,
231 PERIPH_ID_W_RESERVED15,
232
233 /* 144 */
234 PERIPH_ID_W_RESERVED16,
235 PERIPH_ID_W_RESERVED17,
236 PERIPH_ID_W_RESERVED18,
237 PERIPH_ID_W_RESERVED19,
238 PERIPH_ID_W_RESERVED20,
239 PERIPH_ID_ENTROPY,
240 PERIPH_ID_DDS,
241 PERIPH_ID_W_RESERVED23,
242
243 /* 152 */
244 PERIPH_ID_DP2,
245 PERIPH_ID_AMX0,
246 PERIPH_ID_ADX0,
247 PERIPH_ID_DVFS,
248 PERIPH_ID_XUSB_SS,
249 PERIPH_ID_W_RESERVED29,
250 PERIPH_ID_W_RESERVED30,
251 PERIPH_ID_W_RESERVED31,
252
253 PERIPH_ID_X_FIRST,
254 /* X word: 31:0 */
255 PERIPH_ID_SPARE = PERIPH_ID_X_FIRST,
256 PERIPH_ID_X_RESERVED1,
257 PERIPH_ID_X_RESERVED2,
258 PERIPH_ID_X_RESERVED3,
259 PERIPH_ID_CAM_MCLK,
260 PERIPH_ID_CAM_MCLK2,
261 PERIPH_ID_I2C6,
262 PERIPH_ID_X_RESERVED7,
263
264 /* 168 */
265 PERIPH_ID_X_RESERVED8,
266 PERIPH_ID_X_RESERVED9,
267 PERIPH_ID_X_RESERVED10,
268 PERIPH_ID_VIM2_CLK,
269 PERIPH_ID_X_RESERVED12,
270 PERIPH_ID_X_RESERVED13,
271 PERIPH_ID_EMC_DLL,
272 PERIPH_ID_X_RESERVED15,
273
274 /* 176 */
275 PERIPH_ID_HDMI_AUDIO,
276 PERIPH_ID_CLK72MHZ,
277 PERIPH_ID_VIC,
278 PERIPH_ID_X_RESERVED19,
279 PERIPH_ID_ADX1,
280 PERIPH_ID_DPAUX,
281 PERIPH_ID_SOR0,
282 PERIPH_ID_X_RESERVED23,
283
284 /* 184 */
285 PERIPH_ID_GPU,
286 PERIPH_ID_AMX1,
287 PERIPH_ID_X_RESERVED26,
288 PERIPH_ID_X_RESERVED27,
289 PERIPH_ID_X_RESERVED28,
290 PERIPH_ID_X_RESERVED29,
291 PERIPH_ID_X_RESERVED30,
292 PERIPH_ID_X_RESERVED31,
293
294 PERIPH_ID_COUNT,
295 PERIPH_ID_NONE = -1,
296};
297
298enum pll_out_id {
299 PLL_OUT1,
300 PLL_OUT2,
301 PLL_OUT3,
302 PLL_OUT4
303};
304
305/*
306 * Clock peripheral IDs which sadly don't match up with PERIPH_ID. we want
307 * callers to use the PERIPH_ID for all access to peripheral clocks to avoid
308 * confusion bewteen PERIPH_ID_... and PERIPHC_...
309 *
310 * We don't call this CLOCK_PERIPH_ID or PERIPH_CLOCK_ID as it would just be
311 * confusing.
312 */
313enum periphc_internal_id {
314 /* 0x00 */
315 PERIPHC_I2S1,
316 PERIPHC_I2S2,
317 PERIPHC_SPDIF_OUT,
318 PERIPHC_SPDIF_IN,
319 PERIPHC_PWM,
320 PERIPHC_05h,
321 PERIPHC_SBC2,
322 PERIPHC_SBC3,
323
324 /* 0x08 */
325 PERIPHC_08h,
326 PERIPHC_I2C1,
327 PERIPHC_I2C5,
328 PERIPHC_0bh,
329 PERIPHC_0ch,
330 PERIPHC_SBC1,
331 PERIPHC_DISP1,
332 PERIPHC_DISP2,
333
334 /* 0x10 */
335 PERIPHC_10h,
336 PERIPHC_11h,
337 PERIPHC_VI,
338 PERIPHC_13h,
339 PERIPHC_SDMMC1,
340 PERIPHC_SDMMC2,
341 PERIPHC_G3D,
342 PERIPHC_G2D,
343
344 /* 0x18 */
345 PERIPHC_18h,
346 PERIPHC_SDMMC4,
347 PERIPHC_VFIR,
348 PERIPHC_1Bh,
349 PERIPHC_1Ch,
350 PERIPHC_HSI,
351 PERIPHC_UART1,
352 PERIPHC_UART2,
353
354 /* 0x20 */
355 PERIPHC_HOST1X,
356 PERIPHC_21h,
357 PERIPHC_22h,
358 PERIPHC_HDMI,
359 PERIPHC_24h,
360 PERIPHC_25h,
361 PERIPHC_I2C2,
362 PERIPHC_EMC,
363
364 /* 0x28 */
365 PERIPHC_UART3,
366 PERIPHC_29h,
367 PERIPHC_VI_SENSOR,
368 PERIPHC_2bh,
369 PERIPHC_2ch,
370 PERIPHC_SBC4,
371 PERIPHC_I2C3,
372 PERIPHC_SDMMC3,
373
374 /* 0x30 */
375 PERIPHC_UART4,
376 PERIPHC_UART5,
377 PERIPHC_VDE,
378 PERIPHC_OWR,
379 PERIPHC_NOR,
380 PERIPHC_CSITE,
381 PERIPHC_I2S0,
382 PERIPHC_DTV,
383
384 /* 0x38 */
385 PERIPHC_38h,
386 PERIPHC_39h,
387 PERIPHC_3ah,
388 PERIPHC_3bh,
389 PERIPHC_MSENC,
390 PERIPHC_TSEC,
391 PERIPHC_3eh,
392 PERIPHC_OSC,
393
394 PERIPHC_VW_FIRST,
395 /* 0x40 */
396 PERIPHC_40h = PERIPHC_VW_FIRST,
397 PERIPHC_MSELECT,
398 PERIPHC_TSENSOR,
399 PERIPHC_I2S3,
400 PERIPHC_I2S4,
401 PERIPHC_I2C4,
402 PERIPHC_SBC5,
403 PERIPHC_SBC6,
404
405 /* 0x48 */
406 PERIPHC_AUDIO,
407 PERIPHC_49h,
408 PERIPHC_DAM0,
409 PERIPHC_DAM1,
410 PERIPHC_DAM2,
411 PERIPHC_HDA2CODEC2X,
412 PERIPHC_ACTMON,
413 PERIPHC_EXTPERIPH1,
414
415 /* 0x50 */
416 PERIPHC_EXTPERIPH2,
417 PERIPHC_EXTPERIPH3,
418 PERIPHC_52h,
419 PERIPHC_I2CSLOW,
420 PERIPHC_SYS,
421 PERIPHC_55h,
422 PERIPHC_56h,
423 PERIPHC_57h,
424
425 /* 0x58 */
426 PERIPHC_58h,
427 PERIPHC_59h,
428 PERIPHC_5ah,
429 PERIPHC_5bh,
430 PERIPHC_SATAOOB,
431 PERIPHC_SATA,
432 PERIPHC_HDA, /* 0x428 */
433 PERIPHC_5fh,
434
435 PERIPHC_X_FIRST,
436 /* 0x60 */
437 PERIPHC_XUSB_CORE_HOST = PERIPHC_X_FIRST, /* 0x600 */
438 PERIPHC_XUSB_FALCON,
439 PERIPHC_XUSB_FS,
440 PERIPHC_XUSB_CORE_DEV,
441 PERIPHC_XUSB_SS,
442 PERIPHC_CILAB,
443 PERIPHC_CILCD,
444 PERIPHC_CILE,
445
446 /* 0x68 */
447 PERIPHC_DSIA_LP,
448 PERIPHC_DSIB_LP,
449 PERIPHC_ENTROPY,
450 PERIPHC_DVFS_REF,
451 PERIPHC_DVFS_SOC,
452 PERIPHC_TRACECLKIN,
453 PERIPHC_ADX0,
454 PERIPHC_AMX0,
455
456 /* 0x70 */
457 PERIPHC_EMC_LATENCY,
458 PERIPHC_SOC_THERM,
459 PERIPHC_72h,
460 PERIPHC_73h,
461 PERIPHC_74h,
462 PERIPHC_75h,
463 PERIPHC_VI_SENSOR2,
464 PERIPHC_I2C6,
465
466 /* 0x78 */
467 PERIPHC_78h,
468 PERIPHC_EMC_DLL,
469 PERIPHC_HDMI_AUDIO,
470 PERIPHC_CLK72MHZ,
471 PERIPHC_ADX1,
472 PERIPHC_AMX1,
473 PERIPHC_VIC,
474 PERIPHC_7fh,
475
476 PERIPHC_COUNT,
477
478 PERIPHC_NONE = -1,
479};
480
481/* Converts a clock number to a clock register: 0=L, 1=H, 2=U, 0=V, 1=W */
482#define PERIPH_REG(id) \
483 (id < PERIPH_ID_VW_FIRST) ? \
484 ((id) >> 5) : ((id - PERIPH_ID_VW_FIRST) >> 5)
485
486/* Mask value for a clock (within PERIPH_REG(id)) */
487#define PERIPH_MASK(id) (1 << ((id) & 0x1f))
488
489/* return 1 if a PLL ID is in range */
490#define clock_id_is_pll(id) ((id) >= CLOCK_ID_FIRST && (id) < CLOCK_ID_COUNT)
491
492/* return 1 if a peripheral ID is in range */
493#define clock_periph_id_isvalid(id) ((id) >= PERIPH_ID_FIRST && \
494 (id) < PERIPH_ID_COUNT)
495
496#endif /* _TEGRA124_CLOCK_TABLES_H_ */