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